A Flight Controller’s View of the World

by | Apr 30, 2014 | theory | 0 comments

Flight controllers are the metaphorical brains inside every multirotor aircraft. They handle all of the functions related to keeping the multirotor stably airborne and executing commands from the pilot. Flight controllers have a complicated, multi-faceted job:

  • they use an array of onboard sensors to determine the position and orientation of the multirotor in space
  • based on sensor readings, they constantly adjust the speed of the motors to keep the multirotor stable in the air
  • they receive commands from the pilot and, using complicated mathematical algorithms, translate those commands into adjustments to the rotational speeds of the motors
  • they monitor the onboard power system to make sure all components are working correctly and that the battery pack has sufficient charge to power the aircraft
  • they control accessories on the multirotor aircraft, like lights and camera gimbals
  • they can be programmed by the pilot to fine tune the multirotor’s performance

There are many different flight control boards available from different sellers around the world and each has its own unique set of features. The flight controller I use in the tutorials on this site is the KK2.1 from HobbyKing. The KK2.1 is just a basic flight controller with a basic set of features, but I use it because it is very inexpensive and it is very easy to setup and program.

I think that while building and flying multirotor aircraft, it is valuable to understand how multirotor flight controllers are able to understand and adjust the orientation of the quadcopter.

Flight Controller Sensors

So let’s start by discussing how flight controllers figure out the orientation of the multirotor in the air. All flight controllers are equipped with, at minimum, two different sensors used to track the orientation and movement of the craft, an accelerometer and a gyroscope.

Accelerometers

The first of these sensors is an accelerometer. As you can probably figure out from the name, accelerometers measure linear acceleration. The accelerometer on board flight controllers measures both static and dynamic acceleration.

Dynamic acceleration is the type you probably conceptualize in your mind when you think of acceleration; it is caused by the movement of the multirotor aircraft. Since multirotors can move in any direction (left, right, forward, backward, up, or down) the accelerometers used on flight control boards are capable of detecting acceleration in any direction, which is why they are referred to as triple-axis accelerometers.

The other type of acceleration measured by flight control boards is static acceleration, which is caused by the earth’s gravitational pull on the multirotor. All multirotors, and for that matter everything else, on Earth experiences a constant gravitational acceleration of about 9.81 m/s<sup>2</sup>. The point of measuring the static acceleration is that it allows the flight controller to detect which way is down. This in turn allows the flight controller to figure out how the multirotor is tipping.

Gyroscopes

The second sensor with which all flight controllers are equipped is a gyroscope. Gyroscopes measure angular velocity, or how fast the multirotor is rotating and in what direction it is rotating. Just like the accelerometers on board flight controllers are designed to measure linear acceleration in any direction, the gyroscopes on board flight controllers are designed to measure rotation in any direction around the roll, pitch, and yaw axes.

Other Sensors

All flight controllers are equipped with, at minimum, one accelerometer and one gyroscope, as these are the minimum sensors flight controllers require to get a complete picture of the movement and orientation of a multirotor aircraft. Many flight controllers, however, contain other sensors used to gather even more information about the multirotor’s position in space.

Many flight controllers are equipped with magnetometers. A magnetometer is simply an electronic compass. Using a magnetometer in conjunction with an accelerometer and gyroscope allows flight controllers to get an even better idea of the multirotor’s orientation in space. In autonomous multirotors, a magnetometer is also used in the same way humans use compasses, to figure out which direction is north for navigational purposes.

Another useful sensor with which many mid-range flight controllers are equipped is a barometer. A barometer measures atmospheric pressure. Since atmospheric pressure decreases with altitude, a barometer can be used to sense the altitude of the multirotor. Most mid-range flight controllers can sense altitude with a resolution of about 10cm.

Higher-end flight controllers may also contain a GPS module. These types of flight controllers are used on autonomous drones where the ability to pinpoint the multirotor’s exact position on the globe is very important for running unmanned missions.

FLight Controller Motor Control

Now that we understand how, by using several types of sensors, a flight controller is able to determine a multirotor’s orientation in space, let’s move on to discussing how a flight controller is able to control the multirotor’s motors in order to adjust the craft’s position and orientation. In order to control the movement of the quadcopter, the flight controller adjusts the lift produced by each of the motor’s on the multirotor aircraft (of which there can be anywhere from three to eight or more). By adjusting the amount of lift produced in just the right way, the flight controller can make the craft ascend, descend, or tilt to move in any direction.

In order to determine exactly how to control each motor, flight controllers use, as you might expect, quite a lot of math. I am not going to explain how all this math works – frankly I don’t understand it all myself – but I will explain the mathematical foundation upon which all of the flight calculations rely. In order to calculate the lift required by each motor correctly, a flight controller must know the exact position of each of the multirotor’s motors relative to itself. By knowing these positions, flight controllers can calculate the leverage each arm has over the orientation of the quadcopter. Using this information, the flight controller can calculate how to adjust the lift produced by each motor and move the craft.

So this then is where we, as multirotor pilots, have a job to do. In order to enable the flight controller to control the craft, we have to program the flight controller by telling it the locations of all the craft’s motors. In order to express the motors’ locations in a way that the multirotor can understand, we will have to do some math of our own. The calculations we must perform is the subject of the next  step and the task of actually programming the flight controller is discussed in each of the multirotor build tutorials on this site.