How to Make Drone Flight Controller Using ESP8266

DiY Projects Lab
12 min readOct 13, 2021

Introduction: How to Make Drone Flight Controller Using ESP8266

Hi , friends how are you -:)i hope you all are fine , today i came with a new cool project

today i will make a drone using NodeMCU ESP8266 (12e) we use esp8266 as a flight controller

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:

You can find all of my projects on https://www.diyprojectslab.com/

Thank You NextPCB

This project is successfully completed because of the help and support from NextPCB. Guys if you have a PCB project, please visit their website and get exciting discounts and coupons.

Only 0$ for 5–10pcs PCB Prototypes :- https://www.nextpcb.com/?code

Register and get $100 from NextPCB: https://www.nextpcb.com/register

See more info about PCB Assembly Capabilities: https://www.nextpcb.com/register?

Step 2: What Is ESP8266?

Basically, an ESP8266 is a Wi-Fi module. It has the capability for 2.4 GHz Wi-Fi, which is 802.11 b/g/n. It supports WPA and WPA2. It is a system-on chip integrated with a 32-bit processor which runs 80 MHz (it can also be overclocked to 160 MHz). It has 64 KB of RAM and a 64 KB boot ROM.

The data RAM of ESP8266 is 96 KB. It is cheap, small, and powerful. That’s why everyone uses it for different kinds of projects.

You can use an ESP8266 almost everywhere you need to make IoT wireless and smart.

Step 3: [ Play Video ]

Step 4: 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.

Radio controllers typically consist of both a transmitter and receiver, and they generally operate on a radio frequency that does not require licensing for low-power transmitters

Older transmitter/receiver combinations used frequencies in the MHz band, such as the 72MHz band for model aircraft and the 75MHz band for surface vehicles.

Each of these frequency bands was divided into individual channels, and you needed to find an unused one to operate your aircraft or vehicle.
Nowadays, it is more common to use “spread-spectrum” radios in the 2.4GHz band. The use of spread-spectrum technology eliminates the need to select a channel.

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.

Channels

Not to be confused with the individual RF frequency channels used in older devices, in this context “channels” refers to control channels. Each of these channels is tied to two things:

  • A switch, joystick, potentiometer, or display on the RC Controller.
  • An output or input on the receiver.

TX Modes

You’ll see this term used when describing an RC transmitter. The term “mode” generally applies to using the transmitter with an airplane, and it refers to how the transmitter is configured to control the airplane, i.e. which sticks operate which controls on the plane.

A standard transmitter has two sticks, each capable of both horizontal and vertical movement. Each stick, therefore, has two channels, one for horizontal movements and another for vertical ones.

There are four TX modes in total:

  • Mode 1 — Left stick operates elevator & rudder, right stick operates throttle & ailerons.
  • Mode 2 — Left stick operates throttle & rudder, right stick operates elevator & ailerons.
  • Mode 3 — Left stick operates elevator & ailerons, right stick operates throttle & rudder.
  • Mode 4 — Left stick operates throttle & ailerons, right stick operates elevator & rudder.

Receiver

The receiver included with the Flysky FS-I6X is a 6-channel unit, the FS-IA6B.
This device has two small wire antennas, seven 3-pin connectors for input/output devices, plus two additional 3-pin connectors used for the iBUS transmit and receive connections. (Flysky provides a jumper that can be used to accomplish this.)

Step 5: Yaw, PITCH, ROLL

Yaw

Yaw is the motion of the drone in the xy plane, or the horizontal plane as shown in the previous figure. The opposite kind of pair of propellers will create reaction movements. If the sum of all the movements of each propeller is equal to each other, then there is no yaw motion. But if there is difference movements between any pair of propellers, there will be yaw motion, and the drone will move, as shown in the following figure:

If the drone simply rotates along the z direction, it is known as a yaw motion. This will occur, if there is a stable upward force and the propeller forces are as follows:

below, are the movements of the propellers. …

PITCH

This moves the Quadcopter on the side axis, so it would tilt it up and down from front to back.
By doing this it causes the vehicle to move forwards or backwards depending on which way it is tilted.

A good analogy is nodding your head up and down when using a “yes” gesture.

ROLL

This moves the Quadcopter on the long ( longitudinal) axis, so it would tilt side to side.

Step 6: Battery, Frames, Motors ,Propeller and ESC

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:

You can easily calculate the continuous current output of the battery with the help of the following formula. If the current …

HOW DO YOU CHOOSE THE RIGHT LIPO FOR YOUR DRONE OR QUADCOPTER?

Choosing the right LiPo for your drone or quadcopter is only possible if you know which drone
you want to buy or if you know which motors, Electronic Speed Controllers (ESCs) and propellers you like is going to use for your quadcopter.

Below is a guideline for choosing the right LiPo for your quadcopter:

* 3 inch quadcopter: 450–850mAh

* 4 inch quadcopter: 850–1300mAh

* 5 inch quadcopter: 1300–1800mAh

* 6 inch quadcopter: 1500–2200mAh

* 7 inch quadcopter: 1800–3200mAh

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.

Motors 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.

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:

ESC

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.

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.

for more info About Drone ( Packt.com)

Step 7: Assembling

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.

Things to Know Before You Build a Drone, we were introduced to all the basic components of a drone. In this chapter, we will assemble our drone and make it ready for the next phase.

We will cover the following topics

Assembling Your Drone
Things to Know Before You Build a Drone, we were introduced to all the basic components of a drone.

In this chapter, we will assemble our drone and make it ready for the next phase.

We will cover the following topics.

  1. Assembling the frame
  2. Connecting the motor
  3. Connecting the ESC
  4. Connecting the ArduPilot
  5. Configuring the drone with the ArduPilot
  6. Aerodynamics needed for flying a drone
  7. Knowing security protocols for flying a drone
  8. Preventing the drone from crashing

Assembling the frame

The assembly of the drone frame requires a lot of patience and you are once again advised to follow the instruction manual when doing it for the first time

Connecting the motors
To connect the motors, you need to place the motor on the frame arm and attach the screws, as shown in the following figure, making sure you tighten the screws as much as you can, without breaking the frame arm: The BLDC has three wires coming out of the motor. We need to solder the bullet connector to them to be connected to the ESC. Now, connect the other three motors to the frame arms.

Connecting the ESC
Connecting the ESCs is one of the most important tasks in building a drone or any other drone. You can buy four pieces of ESCs or a four-in-one ESC. I suggest you use a four-in-one ESC, which is lighter and easy to use. If you use single a ESC, connect the wires of the motor to the ESC, as shown in the following figure. The connection of the motor and ESC do not matter because the wires are for changing the phase only:

Step 8: MPU6050

This sensor uses i2c to communicate. So I connected SDA & SCL to D1 and D2 of the NodeMCU. As described in the datasheet it has 3 modes for each sensor.

I’m gonna use 500 degree scale range of the gyroscope and 8g scale range for the accelerometer. To get the angles from it I have to configure these registers.

The Wire library of arduino IDE will easily do this job. Then it requests 14 bytes from the sensor and read the angles in series.

Make sure that you have defined the integers as 16 bit as the data is a 2’s compliment value. The accelerometer provides realtime angle But the gyroscope provides angular velocity.

If I want to get angle from the gyroscope then I have to integrate the angular velocity in each loop. So, I got angles from 2 different sensors.

Well, the motors generates a lot of vibrations which will significantly affect the accelerometer. So I’ve used a complimentary filter to overcome this problem.

Which uses both sensor data to generate a stable angle.

But the gyro sensors have little errors. To get it solved I places the drone level and read the data for 4000 times then took the average and I got gyro errors. In this way I can calibrate once and use everytime.

Then I substracted it in each loop. So, now I get the perfect realtime angles.

Step 9: Wiring Diagram and Code

The wiring diagram is very straightforward.

You have to connect the MPU6050 module pins with Esp8266 pins as per the schematic diagram. The schematic diagram is shown above.

and upload code with pc

Step 10: Make the Circuit

Make the circuit by following the schematic diagram given in the above picture.

I have already explained the connection details of module.

Step 11: Check Things Before Flying

Check things before flying

  • Check all the connections
  • Check transmitter and receiver bindings
  • Check the battery charge and voltage
  • Check whether all the propellers are attached tightly
  • Check all the motor mountings
  • Check all the screws
  • Check the balance of the drone to see if any side is heavier than the other
  • Always unplug the battery after flying; only attach the battery few a seconds before flying
  • Check any obstacles outside
  • Keep children away from the flying area
  • Keep a distance from the drone while you first throttle it
  • Turn on autopilot and return to the home/launch feature if they are available
  • Do not fly a drone with unbalanced …

Step 12: Check Things Before Flying

There are some rules by the government of the country where you fly things in the sky, specially the drone. Always check the security protocols. A few common rules are as follows:

  • You cannot fly a drone within 5 miles of an airport
  • You must keep the drone within your eyesight
  • You are not allowed to go higher than 400 feet (around 0.12 km)
  • You cannot fly a drone in busy traffic areas
  • You must register your drone if you use it for business purposes or professionally; you must have a license
  • Always know the local rules before flying a drone

Step 13: Saving Your Drone From Crashing

You hardly can prevent your drone from crashing and breaking some of the propellers, or even the body. The damage will depend on the crash and the height it falls from. It will also depend on the surface your drone lands on or crashes.

The best place to fly a drone is open fields where there are no trees or any electrical wires hanging. Do not uplift the drone with high throttle at first, increase the throttle gradually. We will know about safe throttling later. For now, you can use the Stabilize mode first. Just remember, throttle is nothing but speeding up the velocity of the propellers of the drone. If you are a beginner, my suggestion is to learn how you can levitate your drone above the ground. Once you …

Step 14: Flight:

So, let’s see how it flies.

This is a very simple Flight Controller. I will upgrade it in upcomming videos. like — adding GPS. compass, autopilot, althold and a lot more things. And talking about this…

I have used WiFi instead of transmitter, So, yes it can provide unlimited range. Don’t worry I’ll make a dedicated video on Tx communication.

And thanks for your support, see you very soon in the next video till then bye bye.

If you enjoyed this article, don’t forget to pass it along! Follow me for more DIY projects and ideas. Thank you !!!

--

--