Home Data Building Smart Drones with ESP8266 and Arduino

Building Smart Drones with ESP8266 and Arduino

By Syed Omar Faruk Towaha
books-svg-icon Book
eBook $25.99 $17.99
Print $32.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $25.99 $17.99
Print $32.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Things to Know Before You Build a Drone
About this book
With the use of drones, DIY projects have taken off. Programmers are rapidly moving from traditional application programming to developing exciting multi-utility projects. This book will teach you to build industry-level drones with Arduino and ESP8266 and their modified versions of hardware. With this book, you will explore techniques for leveraging the tiny WiFi chip to enhance your drone and control it over a mobile phone. This book will start with teaching you how to solve problems while building your own WiFi controlled Arduino based drone. You will also learn how to build a Quadcopter and a mission critical drone. Moving on you will learn how to build a prototype drone that will be given a mission to complete which it will do it itself. You will also learn to build various exciting projects such as gliding and racing drones. By the end of this book you will learn how to maintain and troubleshoot your drone. By the end of this book, you will have learned to build drones using ESP8266 and Arduino and leverage their functionalities to the fullest.
Publication date:
February 2018
Publisher
Packt
Pages
212
ISBN
9781788477512

 

Things to Know Before You Build a Drone

Let me guess why you are reading this chapter—because you have some knowledge of Arduino and you are interested in building something awesome with it, which is a drone. Right? If yes, then this book is for you. Throughout this book, we will learn how to build a full-phase drone with the help of Arduino and other technologies. We will also build some prototype drones. If you don't have a basic idea about Arduino, I would recommend you read Learning C for Arduino before starting this book. In this book, we will learn how to build a drone from scratch and we will also modify the drone to serve our other purposes, such as Follow Me drones, mission-control drones, selfie drones, gliding drones, and racing drones. We will also learn how to maintain the drones and troubleshoot when needed.

In this chapter, we will cover the following topics:

  • Definition and usages of drones
  • Types of drones
  • How we can identify or differentiate drones
  • Introducing things needed to build a drone

If you feel enthusiastic about build your own drone, then come with me; let's start a journey together to build drones and have a lot of fun.

 

Drone

When you were a kid, did you have fun with paper planes? They were so much fun. So, what is a gliding drone? Well, before answering this, let me be clear that there are other types of drones, too. We will know all common types of drones soon, but before doing that, let's find out what a drone first. Drones are commonly known as Unnamed Aerial Vehicles (UAV). A UAV is a flying thing without a human pilot on it. Here, by thing we mean the aircraft. For drones, there is the Unnamed Aircraft System (UAS), which allows you to communicate with the physical drone and the controller on the ground. Drones are usually controlled by a human pilot, but they can also be autonomously controlled by the system integrated on the drone itself. So what the UAS does, is it communicates between the UAS and UAV. Simply, the system that communicates between the drone and the controller, which is done by the commands of a person from the ground control station, is known as the UAS. Drones are basically used for doing something where humans cannot go or carrying out a mission that is impossible for humans. Drones are used mainly by military men, scientific research, agriculture, surveillance, product delivery, aerial photography, recreations, traffic control, and of course, for terrorist attacks and smuggling drugs, which we will not be discussing in this book.

Types of drones

Drones can be categorized into the following six types based on their mission:

  • Combat: Combat drones are used for attacking in the high-risk missions. They are also known as Unnamed Combat Aerial Vehicles (UCAV). They carry missiles for the missions. Combat drones are much like planes. The following is a picture of a combat drone:
  • Logistics: Logistics drones are used for delivering goods or cargo. There are a number of famous companies, such as Amazon and Domino's, which deliver goods and pizzas via drones. It is easier to ship cargo with drones when there is a lot of traffic on the streets, or the route is not easy to drive. The following diagram shows a logistic drone:
  • Civil: Civil drones are for general usage, such as monitoring the agriculture fields, data collection, and aerial photography. The following picture is of an aerial photography drone:
  • Reconnaissance: These kinds of drones are also known as mission-control drones. A drone is assigned to do a task and it does it automatically, and usually returns to the base by itself, so they are used to get information from the enemy on the battlefield. These kinds of drones are supposed to be small and easy to hide. The following diagram is a reconnaissance drone for your reference, they may vary depending on the usage:
  • Target and decoy: These kinds of drones are like combat drones, but the difference is, the combat drone provides the attack capabilities for the high-risk mission and the target and decoy drones provide the ground and aerial gunnery with a target that simulates the missile or enemy aircrafts. You can look at the following figure to get an idea what a target and decoy drone looks like:
  • Research and development: These types of drones are used for collecting data from the air. For example, some drones are used for collecting weather data or for providing internet.

We can also classify drones by their wing types. There are three types of drones depending on their wings or flying mechanism:

  • Fixed wing: A fixed wing drone has a rigid wing. They look like airplanes. These types of drones have a very good battery life, as they use only one motor (or less than the multiwing). They can fly at a high altitude. They can carry more weight because they can float on air for the wings. There are also some disadvantages of fixed wing drones. They are expensive and require a good knowledge of aerodynamics. They break a lot and training is required to fly them. The launching of the drone is hard and the landing of these types of drones is difficult. The most important thing you should know about the fixed wing drones is they can only move forward. To change the directions to left or right, we need to create air pressure from the wing. We will build one fixed wing drone in this book. I hope you would like to fly one.
  • Single rotor: Single rotor drones are simply like helicopter. They are strong and the propeller is designed in a way that it helps to both hover and change directions. Remember, the single rotor drones can only hover vertically in the air. They are good with battery power as they consume less power than a multirotor. The payload capacity of a single rotor is good. However, they are difficult to fly. Their wing or the propeller can be dangerous if it loosens.
  • Multirotor: Multirotor drones are the most common among the drones. They are classified depending on the number of wings they have, such as tricopter (three propellers or rotors), quadcopter (four rotors), hexacopter (six rotors), and octocopter (eight rotors). The most common multirotor is the quadcopter. The multirotors are easy to control. They are good with payload delivery. They can take off and land vertically, almost anywhere. The flight is more stable than the single rotor and the fixed wing. One of the disadvantages of the multirotor is power consumption. As they have a number of motors, they consume a lot of power.

How can we differentiate between drones

We can also classify multirotor drones by their body structure. They can be known by the number of propellers used on them. Some drones have three propellers. They are called tricopters. If there are four propellers or rotors, they are called quadcopters. There are hexacopters and octacopters with six and eight propellers, respectively.

The gliding drones or fixed wings do not have a structure like copters. They look like the airplane. The shapes and sizes of the drones vary from purpose to purpose. If you need a spy drone, you will not make a big octacopter right? If you need to deliver a cargo to your friend's house, you can use a multirotor or a single rotor:

  • The Ready to Fly (RTF) drones do not require any assembly of the parts after buying. You can fly them just after buying them. RTF drones are great for the beginners. They require no complex setup or programming knowledge.
  • The Bind N Fly (BNF) drones do not come with a transmitter. This means, if you have bought a transmitter for your other drone, you can bind it with this type of drone and fly. The problem is that an old model of transmitter might not work with them and the BNF drones are for experienced flyers who have already flown drones with safety, and had the transmitter to test with other drones.
  • The Almost Ready to Fly (ARF) drones come with everything needed to fly, but a few parts might be missing that might keep it from flying properly. Just kidding! They come with all the parts, but you have to assemble them together before flying. You might lose one or two things while assembling. So be careful if you buy ARF drones. I always lose screws or spare small parts of the drones while I assemble. From the name of these types of drones, you can imagine why they are called by this name. The ARF drones require a lot of patience to assemble and bind to fly. Just be calm while assembling. Don't throw away the user manuals like me. You might end up with either pocket screws or lack of screws or parts.

Drone frames

Basically, the drone frame is the most important to build a drone. It helps to mount the motors, battery, and other parts on it. If you want to build a copter or a glide, you first need to decide what frame you will buy or build. For example, if you choose a tricopter, your drone will be smaller, the number of motors will be three, the number of propellers will be three, the number of ESC will be three, and so on. If you choose a quadcopter it will require four of each of the earlier specifications. For the gliding drone, the number of parts will vary. So, choosing a frame is important as the target of making the drone depends on the body of the drone. And a drone's body skeleton is the frame. In this book, we will build a quadcopter, as it is a medium size drone and we can implement all the things we want on it.

If you want to buy the drone frame, there are lots of online shops who sell ready-made drone frames. Make sure you read the specification before buying the frames. While buying frames, always double check the motor mount and the other screw mountings. If you cannot mount your motors firmly, you will lose the stability of the drone in the air. About the aerodynamics of the drone flying, we will discuss them soon. The following figure shows a number of drone frames. All of them are pre-made and do not need any calculation to assemble.

You will be given a manual which is really easy to follow:

You should also choose a material which light but strong. My personal choice is carbon fiber. But if you want to save some money, you can buy strong plastic frames. You can also buy acrylic frames. When you buy the frame, you will get all the parts of the frame unassembled, as mentioned earlier.

The following picture shows how the frame will be shipped to you, if you buy from the online shop:

If you want to build your own frame, you will require a lot of calculations and knowledge about the materials. You need to focus on how the assembling will be done, if you build a frame by yourself. The thrust of the motor after mounting on the frame is really important. It will tell you whether your drone will float in the air or fall down or become imbalanced. To calculate the thrust of the motor, you can follow the equation that we will speak about next.

If P is the payload capacity of your drone (how much your drone can lift. I'll explain how you can find it), M is the number of motors, W is the weight of the drone itself, and H is the hover throttle % (will be explained later). Then, our thrust of the motors T will be as follows:

The drone's payload capacity can be found with the following equation:

Remember to keep the frame balanced and the center of gravity remains in the hands of the drone.
 

Types of motors used for drones

There are a few types of motors that are use to build drones. But as the drone needs to be thrust in the air to float, we should use some powerful motors. The cheap, lightweight, small, and powerful motors used in drones are Brushless DC motors (BLDC). For small drones, we do not use BLDC motors, but instead use small DC gear motors.

Several types of speed controllers

You cannot control the speed of motors of your drone unless you use speed controllers. They enable you to control the voltage and current of the motors and hence control the speed, which is the first priority to move the drone one place to another, after floating in the air. You need to increase and decrease the speed of motor(s) to move the drone forward, backward, left, or right.

The connection between the controller board of the drone and ESC and the battery/power distribution board will be shown in Chapter 2, Assembling Your Drone:

Refer to the following circuit diagram:

Flight control board

This is one of the most important things to control the drone from the ground. There are a number of flight control boards on the market. Some of them are open source and some of them are not. The following list has the most famous and top-rated flight controllers:

  • KK 2.0
  • CC3D
  • Naze32
  • KISS
  • ArduPilot
  • Vector
  • 3DR Pixhawk
  • DJI Nava M
  • LUX flight controller
  • DJI A3

In this book, we will use ArduPilot, as it is cheap and it is best for copters. It also covers our book title. The following picture of some flight controllers.

The ArduPilot is one of the best flight controllers for drones because of the following reasons:

  • It has a free, open source autopilot framework supporting different types of drones
  • It supports hundreds of 3D waypoints
  • It allows you to do the autonomous take-off, landing, and camera control
  • It has 4 MB onboard data-logging memory
  • It has a built-in hardware fail-safe processor
  • It has full mission scripting
  • It is really simple to set up

The following picture is an ArduPilot:

We will discuss more about the ArduPilot later.

 

Radio transmitter and receiver

What the transmitter does is it sends a signal to the receiver. The receiver receives this signal and does according to the command from the transmitter. Since the drone floats in the sky, it needs to send signals to command the drone to move or do something. So we need the transmitter and receiver. There are lots of transmitters and receivers out there. The transmitter looks like a remote, which is controlled by the drone pilot and the receiver is connected to the flight controller. So, if the pilot gives commands from the transmitter to the drone, the drone receives it via the receiver and the flight controller processes the signal and does, as per the command of the pilot.

 

Battery

A drone is useless without a battery. All motors, flight controllers, radio, and processing require power. But it is not a wise decision to use the heavy battery to fly your drone because most of the energy will be spent on the thrust of a drone to fly. So, we need to choose light but powerful batteries. In a drone, we usually use lithium polymer batteries.

Choosing the right battery for the drone is one of the most critical things. Before choosing batteries for your drone, keep the following things in mind:

  • Battery size and weight
  • Battery discharge rate
  • Battery capacity
  • Battery voltage
  • Battery connectors

You can easily calculate the continuous current output of the battery with the help of the following formula. If the current is I, battery capacity is C, and discharge rate is D, then the instantaneous current draw is I = C X D. So always choose the highest capacity batteries, depending on the size and weight of the batteries. The LiPo, or Lithium Polymer battery has cells. Say you have three cells in your battery and each of them is 5,000 mAh and the discharge rating is 10 C.

So, the current draw is:

Here, we converted mAh to Ah by dividing by 1,000. The following figure shows LiPo batteries for a drone:

Propellers

When you choose propellers for your drone, choose the lightest but strongest propellers. You also need to keep in mind that the propellers should be balanced on both sides. Most drone flight failure are due to a fault in the propellers. So choose carefully. Always choose the right size propellers. Follow the motor manuals to choose which size suits best.

The following figure shows different types of propellers:

 

Battery adapters/chargers

Battery chargers are required to recharge your LiPo batteries. There are lots of LiPo chargers on the market. Always buy according to the manual of your battery. My suggestion is to buy a balance charger, which allows your battery to be charged with balance for all the cells.

 

Connectors

Connectors are the most important things for the power and other parts of the drone. If the connectors lose your drone, it might meet with an accident. So, buy connectors with special care according to the drone's power distribution system. You need to solder connectors properly with the batteries, ESCs, and other parts of the drone.

You need to buy bullet connectors, XT60, or T-plug connectors and use them where they suit:

 

Some modules to make the drone smarter

There are other modules to make the drone even smarter such as GPS, Wi-Fi module (for example, ESP8266), battery checkers, and range booster antennae, and so on.

Power distribution board

The power distribution board of the drone allows the components of the drone to get a proper current and draw a perfect voltage. We will have four ESCs; we can buy a power distribution board to deliver the proper current to all the ESCs. The following picture is a power distribution board of a drone:

 

Summary

In this first chapter, we have learned what sort of things we will need to build a drone. We have learned a few tweaks for choosing batteries and frames. If you want to build your own drone, I hope you buy them before going to Chapter 2, Assembling Your Drone, because from this chapter onward, we will start assembling and flying our drone. Well, the full parts list will be given, so that you can buy the equipment in the proper quantities. So let's get started with Chapter 2, Assembling Your Drone.

About the Author
  • Syed Omar Faruk Towaha

    Syed Omar Faruk Towaha is a data scientist, and currently working at Meta. He has two bachelor's degrees, one in Physics, another in Computer Science and a Master's in Data Science. He is based in London, England, and has interests in data science and IoTs. While Syed is not busy with his jobs, he uses his time to write something about new technologies. His recent publications include Building Smart Drones With ESP8266 and Arduino, Introduction to Rust Programming, Learning C for Arduino, and JavaScript Projects for Kids.

    Browse publications by this author
Latest Reviews (7 reviews total)
Easy, quick and works ok!
Book do not help build first drone. There is no specifications how to mach parts. You need to have experience in drone building.
I have an extensive background in aviation, avionics and R/C modelling. Even with that background, the book was very hard to understand. It was obviously written by someone very knowledgeable in UAV technology, but I don't think the author's first language is English, and it was a a struggle to understand some of his topics. Some terminology is poorly explained, or not explained at all. Illustrations and diagrams in the E-book version are small, crude and very hard to read. For those seeking an introduction to UAV technology, I would have to advise looking elsewhere.
Building Smart Drones with ESP8266 and Arduino
Unlock this book and the full library FREE for 7 days
Start now