Flight Controller Tutorial | Arduino Based Quadcopter Drone

1 54489 Medium

Hey, what's up, Guys! Akarsh here from CETech.

Quadcopters or Multicopters as you might have heard are some of the most fascinating things nowadays. With every passing day, quadcopters are gaining popularity amongst people in the whole world. Multicopters are available in a variety of sizes. They can be as small as a little sparrow and can be as big as a human being itself and according to the size, there are many applications in which these multicopters can be used. They can be used for surveillance, Weather monitoring, supplying goods, sprinkling fertilizers in farms, video recording, and whatnot. This variety of applications of the multicopters have made them so popular that people from every type of region, whether rural or urban. People want to have their own quadcopter, and many people want to make them on their own. So here we are with a three-part tutorial on How to make a Quadcopter of your own. The main parts of a Quadcopter are readily available in the market but their costs are very high. So we are going to make those parts by ourselves and assemble them to make a complete working drone of our own.

In this part of the tutorial, we are going to make the Flight Controller of our Drone. Our Flight Controller will be based on Arduino which will be connected to 3 Axis Gyroscope and Accelerometer Sensor and will be programmed to operate as the flight controller. We will use a simulation Software named Multiwii to calibrate and test the working of our flight controller. The code that we are going to upload is also made available to us by multiwii. This is going to be a simple task and I am sure that you will love it. So let's move to the fun part.

 

Get PCBs for Your Projects Manufactured

projectImage

You must check out PCBWAY for ordering PCBs online for cheap!

You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. Check out their online Gerber viewer function. PCBWAY takes care of its customers a lot that's why they offer reward points with every purchase that you make from them these reward points can be redeemed for various useful items from their gift shop.

 

What Is a Flight Controller?

projectImage

Before we start making the flight Controller we need to know that what a flight controller is and what is its importance in the working of a quadcopter. So as its name suggests, a flight controller is something that controls the flight of a Quadcopter. It is programmed and calibrated in such a manner that it adjusts the speed of motors according to the position and orientation of the Quadcopter to help them maintain a stable flight. A Flight Controller is like the brain of the Quadcopter as it controls almost all the important features of its flight. It is the flight controller that collects the signals received by the RF receiver sent by the Transmitter in our hand and after collecting those signals it sends the signal to the Electronic Speed Controllers which adjusts the speed of the motors in accordance with that signal. 

projectImage

A flight controller is also responsible to store the flight mode of the Quadcopter and according to that flight mode, it bounds the operation of the Quadcopter. Talking about the architecture of the Flight Controller, Nearly all flight controllers have basic sensors such as Gyro (Gyroscopes) and Acc (Accelerometer). Some Flight Controllers includes more advanced sensors such as Barometer (barometric pressure sensors) and magnetometer (compass). Drone flight controllers are rapidly evolving with time and are becoming smaller, with more features integrated, and using better processors and hardware.

projectImage

A Flight Controller also acts as a hub for a range of sensors and objects that can be integrated with the drone such as the GPS etc. It collects the data from them and provides a power supply to the attachments as well. As it controls the flight and orientation of the drone, that's why the positioning of the Flight Controller on the drone is also very important, it should be placed in the center of the drone and we should know about the front part of the flight controller and that of the drone because the direction of rotation of motors is decided according to that.

 

About Multiwii Software

projectImage

Multiwii is open-source software that is used to calibrate a flight controller and also used to visualize the operation of the Flight controller through various graphs and other simulations on its GUI. MultiWii is software written for stabilizing and controlling various aircraft, the majority of which are multirotor. The name MultiWii came about from the first MultiWii controller boards which utilized components from a Wii controller in order to stabilize a multirotor - hence MultiWii. MultiWii is a massive open-source project which is continuously being updated with better features and more advanced algorithms. The code that we are going to upload to our Arduino board in order to make it a Flight Controller is also provided by Multiwii. The Multiwii GUI (Graphical User Interface) is a Java-based application that works on any operating system and allows the user to adjust certain settings on a multirotor via a USB connection. The MultiWii GUI uses PID values in order to attain a stable state. The PID values can be tuned by the user through the Multiwii GUI according to their needs. When we open the Multiwii code we will see that the code has a number of fields such as the type of quadcopter for which we are making the flight controller and other than that, the configurational settings for the drone are also available in the code itself. We are also going to do some simple changes in the code before uploading that and you will understand why we did those changes. Now in the next step, we are going to complete the Flight controller build and after that, we will test that.

 

Flight Controller Build

In this step, we are going to build our Flight Controller. We will first connect the Arduino Nano and the MPU6050 Sensor and after that, we will upload the code in the Arduino Nano. Before we start we should have a look at the materials required. 

The things required are as given below:-

MPU6050 Sensor

Arduino Nano

Breadboard

Jumper Wires

 

For trial and testing purposes, you can make the flight controller on the breadboard with the help of jumper wires but once you are done with testing, I will suggest you make a PCB of this as it is very important for the drone and any loose wire may lead to problems.

projectImage

Now for building the Flight Controller, you need to follow the steps given below:-

First of all, we need to connect our MPU6050 Sensor to our Arduino Nano. These should be connected as given below:-

VCC pin of MPU6050 to 5V pin of the Arduino Nano.

GND pin of MPU6050 to GND pin of the Arduino Nano.

SCL pin of MPU6050 to A5 pin of the Arduino Nano.

SDA pin of MPU6050 to A4 pin of the Arduino Nano and with this we will be done on the Hardware end.

 

projectImage

Now as we are done with the Hardware we need to head over to our laptops and complete the Software part of the build. For that, we first need to download the Multiwii code and Software from the Github repository of the project which you can access from ​here. In the repository, you will see a folder named Multiwii_2_4. You need to download the folder.

Once you are done with the download, you need to extract the folder as it is in zip format. In the extracted folder, you will see two other folders named Multiwii and MultiwiiConf. You need to open the Multiwii folder. In that folder, you will see an ino file named "Multiwii". This is the code that we are going to upload in our Arduino Nano but before that, we need to do some small changes in the code which are given in the next step.

projectImage

Once you have opened the code, you will see a number of tabs that are present in the code. Leaving all other tabs as it is, you need to open the tab named "config.h". In the tab as you scroll down a bit, you will see a list of the type of multicopters in which several different types of Quadcopters are named under comments. We need to uncomment the line with the name QUADX as we are going to make a Quadcopter with the shape "X".

projectImage

After that, we need to scroll down a bit further and we will some fields such as MAXTHROTTLE, MINTHROTTLE, and MINCOMMAND. We need to set these values. I have settled the MAXTHROTTLE at 2000, MINTHROTTLE to 1200, and the MINCOMMAND to 1000.

projectImage

After that, as we scroll further down a bit, we will see a list of types of IMU boards which is basically the type of flight controller that we are trying to make. In this list we need to uncomment the line having Nanowii in it as we are making a Flight controller on Arduino Nano board.

projectImage

Now after doing all this we need to press Ctrl+F and search for "PPM Sum receiver" in the code there you will PPM Sum receiver configurations in those, you need to uncomment the line "#define SERIAL_SUM_PPM THROTTLE,YAW,PITCH,ROLL,AUX1,AUX2,AUX3,AUX4,8,9,10,11"

With this, we are done with the changes that were required in the code. Now you can connect the Arduino Nano to the PC and after selecting the correct board and COM port, you can hit the upload button.

And with this step, we are done with the building of the Flight Controller for our Drone. Now in the next step, we will be going to test our flight Controller. Keep in mind that the pins for the Arduino Nano to which the motors will be connected are all defined in the code and the connections will be done accordingly in the assembly part of the quadcopter.

 

Testing the Flight Controller

In the previous step, we completed the building of our Arduino-based flight Controller. Now in this step, we are going to test and calibrate the flight controller that we have made. For this, now we need to go back to the folder we extracted. In that folder, we need to open the folder named "MultiwiiConf". It is the folder in which our Multiwii Java GUI app is present. There are folders according to the different configurations of the PC. Open the folder that corresponds to the configuration and OS of your PC. In my case, I need to open the folder for windows 64 bit. In the folder, you will see an application named MultiwiiConf. This will open up the multiwii application. Keep in mind that for this whole process, we need to keep our Arduino Nano connected to the PC. When the application is opened you have to select the correct COM port and hit the start button. After clicking start, you will see that the graphs will start fluctuating and the values for several quantities will also change. Now you need to place the Flight Controller on flat surface and then click the CALIB_ACC button and hold the flight controller stable for 10-15 seconds. This will calibrate the flight controller and now you can see that as you move the flight controller in the air in different directions you will see that the drone showed in the bottom right will move and you will also see fluctuations in the Graphs and different quantities present there.

projectImage

So in this way, we have created a Flight Controller of our own which we will place on our drone in the later parts of this article series. In the next part of this series, we will make the Transmitter and Receiver for the controlling of our drone. Until then Goodbye!

 

License
All Rights
Reserved
licensBg
1