Chapter 4. Flight Controller

What Is a Flight Controller?

Basically, the flight controller is the brain of your drone. It measures the performance of your aircraft through an array of various sensors, hundreds of times per second, and then manages all the microadjustments that are needed on each motor to keep your aircraft stable in the air. Think of what happens when you walk down the street. You are not thinking about the variations needed in your gait due to an uneven sidewalk or headwind. You just walk, and your brain comes up with those details and executes them while your only thought is “forward.” The flight controller acts in the same manner. When you give your drone the command to move forward at 10 miles per hour, the flight controller is taking your overall command and breaking it down into hundreds of commands per second for each of the motors in order to achieve said command. If the drone encounters some type of resistance, such as a headwind, the flight controller will attempt to make up the difference needed to still achieve your command without extra input from the pilot.

Open Source Versus Closed Source

You can break all the flight controllers in the world down into two categories: open source and closed source. Some popular open source flight controllers include APM (AudruPilot), Open Pilot’s CC3D, Sparky, and various flavors of MultiWii. These projects all have one thing in common: anyone can download the build files and software needed to make their own. We highly encourage you to spend a little time online to check out all these projects. They all have great communities built around them and offer a vast wealth of knowledge on UAVs.

Closed source flight controllers come in all types of configurations. Some of the more popular models are the Wookong and Naza by DJI as well as the Super-X and Mini-X by X-Aircraft. These systems are usually proprietary and do not offer the user the chance to modify the software code itself.

Sensors

The heart of the flight controller is the inertial measurement unit (IMU); see Figure 4-1. This unit contains a suite of sensors to help the flight controller monitor the activity of the aircraft. The most typical sensors include an accelerometer, gyroscope, and barometer. These measure the acceleration and rate of rotation of the aircraft, and the air pressure (which can often be converted to the aircraft’s altitude). These three sensors provide all the data that the autopilot needs to keep the aircraft stable in the air.

Additional sensors are also used outside of the IMU for advanced functionality. These include GPS receivers, magnetometers, optical flow sensors, and air speed sensors. As time moves forward, we will see even more sensors introduced into flight controllers to help with tasks such as Sense and Avoid, computer vision, and artificial intelligence (AI).

Alt Text
Figure 4-1. This flight controller has a built-in IMU and ports for external sensors.
Here is an overview of the APM and all of the inputs/outputs (I/Os):
Inputs 1–8
These ports will be connected to our radio receiver. This collects our flight instructions from the ground and delivers them to the APM.
GPS
This port will be connected to our GPS sensor.
I2C (inter-integrated circuit, pronounced I-squared-C)
This is a standardized serial computer bus that is used for many types of peripherals. If you have used an Arduino before, you may be familiar with the I2C protocol. We will be using this port for our external compass.
PM
This is our power module port. This allows us to monitor our power supply.
JP1
This is a jumper port used to tell the APM if there should be a power module in use.
Outputs1–8
These will supply the signal we need for our electronic speed controllers. Alternatively, these could send a signal to a set of servos if you used APM for a model airplane or inputs to a gimbal controller if you asked APM to control a camera mount on your drone.
Telem
Our telemetry radio plugs in here.
A0–A11
Just as in an Arduino, these are our user assignable analog pins. These will not be used in this book.

Flight Characteristics

While they are all adjustable to a certain extent, each flight controller usually brings its own set of flight characteristics to the table. Some controllers are more soft and mushy and allow the copter to just loft about in a very fluid manner. Those types of flight characteristics are more sought after by aerial photographers or videographers with larger aircraft. Others may tend to be more snappy and have a greater feeling of authority, such as those used by first-person view (FPV) racers.

Software Assistant

All modern flight controllers have some type of software interface (see Figure 4-2). This allows the user to gain access to many important parameters within the flight controller. While some software assistants are more robust than others, they all generally control the aircraft configuration, communications setup, and autolevel gains. Software assistants can connect through Bluetooth, USB, or telemetry radio, and are developed for both mobile and desktop platforms.

The assistant that we will be using, called Mission Planner, also includes a built-in ground station. This allows the application to display important information that is sent back from the aircraft, such as geolocation and sensor readings. Access to this information on the ground can be a tremendous help for certain types of flights—such as mapping or agriculture monitoring missions—and really helps during any type of troubleshooting process.

If you are following along in the book with the companion kit, download Ardupilot’s Mission Planner software application. If you are on a Mac, try using APM Planner instead.

Alt Text
Figure 4-2. The Tower flight controller app from 3D Robotics running on an Android tablet.

Step-by-Step Build Instructions

For this portion of the build, you will need:

  • One inch of foam double-sided tape
  • Scissors
  • Fine-point paint pen or Sharpie
  • Small zip ties

Step 1: Mount the Flight Controller

The APM flight controller will be mounted on the bottom plate of the clean frame. Use two small pieces of double-sided tape at either end of the flight controller to attach it firmly to the frame (see Figures 4-3 and 4-4). Avoid using one large piece of tape, which can be difficult to remove later. The tape does have some vibration isolation qualities, so generally the thicker tape you can find, the better (up to a degree; there’s no need for 1/2-inch thick tape). Make sure that the forward arrow on the APM flight controller is pointing forward on the UAV, and that the flight controller is positioned directly in the center of the frame before pushing it into place (see Figure 4-5).

Figure 4-3. Cut off about an inch of double-sided tape to use in the mounting of the APM.
Figure 4-4. Cut your tape in half and place each portion at one end of the APM, then peel off the backing.
Figure 4-5. With the adhesive tape exposed, position the APM in the center—making sure it is pointing in the right direction—and firmly press into place.

Step 2: Wire up the Flight Controller Outputs

As we have discussed, the flight controller is nothing more than a microprocessor that takes an array of inputs, runs calculations on those inputs, and then sends out the appropriate signals to keep you airborne. At this point, the only things we have to wire up to the flight controller are our motors and ESCs (outputs). Take a look at the outputs labeled 1–8 on the APM. Notice that each output has three header pins that are vertically stacked under the number that labels it. Those three pins are for the signal, power, and ground found in each servo lead on your ESCs. They are even labeled on the right of the pins (S, +, -); look directly at them from the back of the unit.

Outputs 1 and 2 are for the NE and SW motors, respectively. Identify the speed controller that handles each motor, and plug the servo lead from that ESC into the appropriate output port. Make sure that all ground (black) wires are at the bottom of the servo lead when plugged in. Repeat this step, adding the NW motor to output 3, and SE motor to output 4. This is clearly illustrated in Figure 4-6.

Figure 4-6. Each motor has a dedicated output and rotation direction; the APM unit and the APM diagram are both pointing in the same forward direction.

To properly route these cables, take a small paint pen or Sharpie and label each ESC plug with its corresponding output number. Once they are clearly labeled, align the tips of all the plugs and place a small zip tie or two along the cable length just below the plugs. This will help keep everything neat and organized. Now push that group of cables through one of the four rectangular holes in the back of the clean frame (near the APM output pins). See Figure 4-7 for a detailed photo of this process.

Now, simply plug each of the ESC plugs in to the APM output that you labeled earlier. If you followed these steps correctly, you should have a nice neat connection between your APM and the aircraft’s ESCs, similar to Figure 4-8. Notice the attention we paid to keep the wiring as neat as possible. A clean build is easier to work on.

Figure 4-7. Our ESC leads route nicely from the dirty frame up through a hole in the back of the clean frame, giving them easy access to the output ports on the APM (note that the top clean frame plate was removed so we could get a better photo—it is not required to do this).
Warning
If you are using a flight controller other than the APM, check your instruction manual for the proper motor output sequence. APMs always start with output 1 and count up depending on how many motors your drone uses. A hexacopter always uses outputs 1–6, while an Octocopter always uses outputs 1–8.
Figure 4-8. All of our ESCs are plugged in to the APM outputs (Note: the top clean frame plate was removed so we could get a better photo. It is not required to do this).

Step 3: Attach the Two Subframes to Each Other

Now that we have our ESCs wired into the APM, we can go ahead and attach the two subframes to each other. If you remember, we covered this step at the end of Chapter 2 while we were building out the frame. If you don’t recall this step, refer back to “Step 4: Attach the Two Subframes Together”. As a quick review, you are running four 5-mm mounting screws through the mounting tabs on the clean frame into the short standoffs located on the top of the dirty frame. Figure 4-9 may jog your memory.

Figure 4-9. Finally, we are ready to attach our two subframes to each other!

Wrapping Up

By now we have our flight controller firmly mounted to the clean frame, and have outputs going to the four motors. Double-check all connections and make sure that the appropriate wires are going into the appropriate ports. Double-checking now can save you headaches later.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.190.93