Drone ProjectsESP8266 ProjectsIoT Projects

Build ESP8266 Flight Controller For Drone


How to make ESP8266 Flight Controller, you are excited by the title! well, I am going to show how I made this Flight controller Using ESP8266.

The search to make quadcopters without a flight controller ends here. I was kind of making a drone for my project. For a long time, I’ve dreamt about my own Flight Controller. Yes, I made my own Flight Controller including the best of all the features I’ve upgraded till now. So, let’s break those limitations.

I was making a drone for my project I was thinking to make it without a flight controller as the flight controller goes too expensive so I was surfing the net all night without the flight controller to make it work and it was very disappointing that I didn’t do one. So I decided to make this blog so it’s easier for people who will be making a quadcopter without a flight controller. The Ultimate Guide to How To Build a Drone At Home: Guide for Beginners

Required Material – ESP8266 Flight Controller

🌀 Project Parts ~

🌀 Drone Kit ~

FC (flight controller ) working:

flight controller apm2.8 e1666421284446

A drone flight controller is a little device that is used to control the flight of a drone. It is generally a small, hand-held device that is used to control the flight of a drone by sending signals to the drone’s motors. The flight controller is the brain of the drone, and it is what allows the drone to be controlled. It is responsible for receiving inputs from the pilot and then sending signals to the drone’s motors to control the flight.

An FC mainly contains 4 segments. The input segment takes instructions from the user on where to move the drone. And the Output segment sends a PWM signal to the ESCs and controls the motor speed in order to fly according to the instructions.

The most common channels are pitch, yaw, and throttle. The pitch channel is used to control the angle of the drone’s nose, and the yaw channel is used to control the direction of the drone’s flight. The throttle channel is used to control the speed of the drone’s motors.

The IMU simply measures the tilt angle in 3 axes. The processing unit collects all data and corrects the tilt angle using the PID controller. We can also include peripherals devices like GPS, and compass. But that would be for another video.


esp8266 e1662866239966

NodeMcu is an open-source IoT platform. It is based on the ESP8266 chip and provides WiFi connectivity. It is very easy to use and can be programmed using the Arduino IDE. NodeMcu is perfect for building IoT applications due to its low cost and ease of use.

Actually, this little device is way more powerful than I thought. It has WiFi, it runs on 80Mhz and it has an inbuilt floating point processor so that’s quite awesome For the IMU I’m gonna use MPU6050. It comes with a gyroscope and an accelerometer sensor. Here I’m not using any Tx Rx, I will use WiFi for communication



The MPU6050 is a six-axis gyroscope and accelerometer in a single chip. It is used in mobile devices, gaming controllers, drones, and other applications where reliable motion sensing is required. It’s relatively inexpensive and easy to use, making it a popular choice for many projects.

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 a 500-degree scale range for the gyroscope and an 8-g 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 bits as the data is a 2’s complement value. The accelerometer provides real-time angle But the gyroscope provides angular velocity. If I want to get the 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 generate 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 few errors. To get it solved I place the drone level and read the data 4000 times then took the average and I got gyro errors.

In this way, I can calibrate it once and use it every time. Then I subtracted it in each loop. So, now I get the perfect real-time angles.



Pulse Width Modulation (PWM) and Electronic Speed Control (ESC) are two common methods used to control the speed of motors. PWM is a type of modulation where the width of the pulse is varied to control the speed of the motor.

ESC is a type of electronic speed control that uses electronic signals to control the speed of the motor. PWM is commonly used in RC applications to control the speed of brushed motors.

Before getting into the ESCs we need to know about PWM. PWM is a method of producing a pulse of the HIGH & LOW states of a pin. The data transferred through it is the time between the rising edge and the falling edge of the pulse and it is refreshed periodically. Which is the frequency of the PWM signal. Check more  how-brushless-motor-and-ESC-work

Then pull down each of the 4 pins connected to the ESC according to the throttle to be sent to the ESCs. In this portion, we got 600 microseconds so I can put other codes here.

And still, the refresh rate will be 2000 microseconds giving us a PWM frequency of 500Hz.


PID, or Proportional Integral Derivative controllers, are a type of feedback control system. PID controllers are commonly used in industrial control applications such as temperature control, speed control, and pressure control.

So, now we can control the speed of individual motors. But to sync it with the angle in order to correct the tilt angles I’m gonna use the PID controller. It uses three types of controllers. The PID controller changes its value proportional to the angle using some formula.

The more you tilt the drone the more it will increase and will reduce if the tilt angle decreases. But only with it, the drone will be wobbly. Something like this. So we need some braking system. And here the D controller comes into place.

In order to fly a drone, the pilot must first calibrate the flight controller. This is done by setting the trim for each channel. The trim is the point at which the drone is level, and it is used to ensure that the drone is level when it is flying. Once the flight controller is calibrated, the pilot can then start flying the drone. To do this, the pilot will use the throttle channel to increase or decrease the speed of the drone’s motors. The pitch channel is used to control the angle of the Drone.

Circuit Diagram – ESP8266 Flight Controller

we’ll be making a circuit diagram for an ESP8266 flight controller. This guide will go over the basics of circuit diagrams and how to create one for your flight controller.Esp8266 flight controller e1666419889141 The wiring diagram is very clear. You have to connect the MPU6050 module and ESC pins with Esp8266 pins as per the schematic diagram. The schematic diagram is shown above.

Make the Circuit

Make the circuit by following the schematic diagram given in the above image. I have already explained the each component.

BUild Nodemcu esp8266 drone

Software and Libraries

First, download the Arduino sketch and installed all the libraries. Download and Install the following Libraries:

  • ESP8266WiFi.h

Plugin the USB cable into the NODEMCU with your laptop or desktop PC. Set the correct board and COM Port number and upload the code into the ESP8266.

Source Code

Click here for the full code and diagram on the GitHub page NodeMCU-FlightController-MPU6050 

Video Tutorial:

Nodemcu esp8266 drones

Similar Post

  1. Build Obstacle Avoidance Drone Using Arduino
  2. Make ESP8266 Drone (This Drone Can Climb on Wall)
  3. Important Parts Of A Drone – Every Component Explained
  4. The Ultimate Guide to How To Build a Drone At Home: Guide for Beginners 
  5. Make Arduino RC transmitter For RC Toys – Drone or Plane

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker