This is the last part of our Raspberry Pi quadcopter series. For the previous articles, please refer back to DIY Raspberry Pi Drone: Mechanics – Part 1 and DIY Raspberry Pi Drone Part 2 – Naza-M Lite Guide. In this tutorial, we’ll show how to setup FPV. After successful setup, a live video stream from the quadcopter to will be delivered to a mobile device from Raspberry Pi over WiFi. Android phone is required for this tutorial so please make you have one available. We’ll also install propellers for the drone and provide a pre-flight checklist at the end of the article for safe & successful flight.
Test flight video:
Aerial video (taken from quadcopter):
The video from the drone’s Raspberry Pi is sent over a WiFi hotspot to an Android phone. Currently, I have only worked out how to setup FPV streaming to an Android phone. There are three ways that the WiFi hotspot could be hosted
For this example a Nexus 5 phone running Android 6.0.1 was used. However, any phone running at least Android 2.2 (basically every modern phone) should support running WiFi hotspots.
Note: Depending on your phone manufacturer the exact steps and/or appearance of menus pictured in the following steps might differ.
To setup the WiFi hotspot first open your settings app. You should see a similar menu as the one in the picture below.
Figure 1. Android settings menu
Under Wireless & networks click on the More option. Again you should see a similar menu as the one in the picture below.
Figure 2. Network settings
Enter the Tethering & portable hotspot menu and you will be presented with the following menu. From this menu click Setup Wi-Fi hotspot to begin configuring the WiFi hotspot.
Figure 3. Hotspot menu
We will now fill out the presented fields to configure the name, security, and band of our phone’s WiFi network. For Network name you can enter whatever value you like.
We want to make sure our network can only be accessed by our drone and ourselves, so we will set the Security to “WPA2 PSK” and the Password field to “deviceplus”.
The last field Select AP Band is very important. This field specifies what frequency band the WiFi hotspot will use. We have two options for this: 2.4 GHz Band, and 5 GHz band. It is very important to use the 5 GHz band. This is because our RC receiver (which we installed in Part 1 of this series) uses the 2.4 GHz band and running both the hotspot and the RC receiver on the same band increases the chances of interference that could cause you to lose control of the drone.
Figure 4. WiFi hotspot configuration
After you have finished entering the values in each field, click SAVE, and you have just configured the WiFi hotspot! Now whenever you wish to turn on the WiFi hotspot you can tap the slider to the right of Portable Wi-Fi hotspot (see Figure 2) to enable the hotspot.
We need a special app for our phone that will receive the incoming camera stream and display the video on your phone. The app we will be using in this article is RaspberryPi Camera Viewer by EffiSoft. Download and install the app to your phone off the Google Play Store here: https://play.google.com/store/apps/details?id=pl.effisoft.rpicamviewer2.
Figure 5. RaspberryPi Camera Viewer on Google Play
After the Raspberry Pi Camera Viewer app has been downloaded to your phone it is time to configure it. Upon starting the app for the first time you will see a fairly blank interface like the one pictured below.
Figure 6. First time opening live streaming app
To begin setting up the app for our needs, click on the (+) button near the top right corner. By pressing this button we are creating a new settings profile. After clicking the button you will see a menu to edit the pipeline.
Figure 7. Edit pipeline interface with default values
We need to change a lot of options. To start tick the box beside Enable advanced mode to gain access to more settings. Then change the name to QuadcopterFPV or some similar descriptive name. Now we have to configure the most important setting, the pipeline description. The pipeline description basically tells the app how to decode the incoming stream (for those who are more curious, look into GStreamer pipelines).
Replace the text field containing:
tcpclientsrc host=0.0.0.0 port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false
with the following string:
udpsrc port=9000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false
The only difference between the two pipeline descriptions is that our new one uses UDP instead of TCP. We use UDP because there is less of video delay and the video stream can better handle dropped frames/missing information.
The last option we have to configure is Enable application extra features. Simply check the box beside it. This will allow us to take screenshots of the video during flight which is a useful feature.
Figure 8. Final settings
After adjusting all the settings, simply scroll to the bottom of the app and click the SAVE button to save all your changes. In the next few steps we will setup the Raspberry Pi to connect to our hotspot, use the camera, and stream the video.
To ease the Raspberry Pi configuration I created an Raspbian Image that you can easily install on your Raspberry Pi for FPV. You can download the latest version of my custom Raspbian image here: https://github.com/brenton311/drone-files/releases/download/v0.1/image.zip.
To install this image you must extract the zip file, and then follow the most up to date instructions for your operating system on the Raspberry Pi website here: https://www.raspberrypi.org/documentation/installation/installing-images/.
Once installed, your Raspberry Pi will stream video to your phone when you plug in the battery (the Raspberry Pi takes about ~40s to boot and thus the video will not appear immediately on your screen).
Figure 9. Transmitter with relevant control sticks labelled
When flying quadcopters there are a lot of things that can go wrong. To prevent simple mistakes I recommended to make a preflight checklist. The list below includes the checks that I run through before flying the drone.
Before attempting to charge your batteries, refer to the important information about the specifications and proper care of batteries in part 1 of this series: DIY Raspberry Pi Drone: Mechanics – Part 1. You could also check out a guide on LiPo Batteries here.
The exact steps to configure and use a LiPo battery charger vary with each charger but, in general, you must:
Much like our quadcopter has CW (clockwise) and CCW (counter-clockwise) motors, we have CW and CCW propellers. Each CW motor must be paired with a CW propeller, and CCW motors must be paired with CCW propellers. You can determine the direction of a motor by looking at the arrow on the side of the motor. You can determine the direction of a propeller by looking at the colour of its center. Propellers with black centers are for CW motors, and propellers with silver centers are for CCW motors.
Figure 10. CCW propeller (top) and CW propeller (bottom)
To install a propeller on a motor simply place the bottom of the propeller’s center (you will see a threaded hole) on the shaft of the motor. Then hold your motor using your propeller tightener, and spin your propeller in the opposite direction it is intended to be spun until you feel significant resistance. At this point use two fingers to hold the propeller at its center and keep it from rotating and then tighten the propeller my rotating the motor with your propeller tightener.
As a new pilot, you are likely going to crash your quadcopter. And when crashing your quadcopter you can damage components. Hence why I recommend removing the gimbal and camera to prevent damaging expensive components during crashes.
You can remove the camera from the gimbal by loosening the two screws holding the camera on the gimbal and then sliding the camera out of the bracket.
Figure 11: Xiaomi Yi Camera installed in gimbal (note the position of the two screws)
To remove the gimbal from the frame remove the nuts from the four bolts that secure it to the frame. When doing so make sure that the gimbal does not fall, hold the gimbal in one hand and loosen the bolts with the other hand. After removing the four nuts the gimbal should simply slide out of the frame.
Calibrating your compass is an optional step that may make your quadcopter more stable when in GPS mode.
Please refer to step-by-step guide for calibration below [in GPS mode].
Calibration Procedures – DJI Wiki
Figure 12: Holding quadcopter horizontally / ©DJI Wiki
Figure 13: Holding quadcopter vertically / ©DJI Wiki
Note: You don’t need to rotate your multi-rotor on a precise horizontal or vertical surface, but keep at least 45° difference between horizontal and vertical calibration.
When to do re-calibration:
We will use the first flight of the quadcopter both as a way to test that every component of the quadcopter is performing normally and for you to get familiar with the quadcopter’s controls. Before flying, make ensure that:
For your first flight arm the quadcopter (by holding both transmitter stick in the bottom corner closest to the center) and then slowly increase the throttle until the quadcopter takes off. Gingerly manage (don’t make quick movements) to the quadcopter’s throttle until it reaches a height of about 10 feet. When the quadcopter reaches a height of 10 ft put the throttle back to its midpoint.
You can get familiar with the elevator and aileron controls by slowly moving your quadcopter forward and backwards; right and left. As your piloting skills increase you will realize that all movements of the quadcopter are the result of elevator, aileron, and yaw commands.
After a few minutes, you can use the aileron and elevator sticks to direct the quadcopter towards where you want to land. Then slowly lower the throttle until the quadcopter is at rest on the ground. As the quadcopter is descending you may need to make small adjustments with the elevator and aileron sticks to keep the quadcopter over your intended landing location.
This is the point of the article where we will leave you to learn on your own. The purpose of this article was to show you how to configure a drone so that it is ready to fly, not necessarily to teach you how to fly a drone. I would recommend that you consult the excellent guide here as you develop your quadcopter piloting skills.