This tutorial demonstrates how to build a Linux drone with the Raspberry Pi Zero using a BOM (Bill of Materials) of less than 200 US$. The drone uses a real-time capable Linux kernel, a Debian-based file system and Dronecode’s APM flight stack compiled for the PXFmini autopilot board. All these components have been put together by Erle Robotics in their OS image for the PXFmini.
Required time: 30 minutes
Once you get all the components start by assembling your drone:
- Get the black frame together and place the motors on top.
- Fix the ESC (Electronic Speed Controllers) to the frame using some tape and connect them to the motors.
- Put together the power (red) and ground (black) ends of the ESCs into the individual cable (to be connected later to the battery) and fix everything underneath the frame.
- Adjust the power module connectors to the battery ones. There several ways to do this but here's a quick one: a) cut the connectors and solder battery and power module together (do it one at a time, careful with short circuits!). b) cut the other end of the power module and resolder the battery connector (previously cut) there. c) Done!, this will allow us to easily connect and disconnect the "battery+power module" to the drone.
- Place the "battery+power module" pack underneath, use the velcro included in the package to do so.
Required time: 30 minutes
Connect the PXFmini shield on top of the Raspberry Pi Zero as described in the following content:
You're almost done but you still need to get the right software on the Raspberry Pi Zero+PXFmini set. This should include the flight stack, an appropriate kernel, enabled daemons that auto-launch on boot, and additional goodies...
Fortunately, if you purchased the PXFmini from Erle Robotics you'll get access to their Debian images which include all this so just fetch a PXFmini compatible Debian image and flash it into a microSD card.Step 3: Mount the autopilot
Required time: 5 minutes
Mounting the autopilot (Raspberry Pi Zero + PXFmini) in the drone can be done using several methods. Pick yours and connect the JST GH cable from the power module to the PXFmini. This will to power the autopilot when the battery gets connected.
Next is mounting the PWM channels in the autopilot. Get your ESC cables and connect ESC 1 (corresponding with motor 1) to PWM channel 1, ESC 2 to PWM 2 and so on.
Required time: 15 minutes
There's two kinds of propellers clockwise (marked with an "R") and counter-clockwise. Place the clockwise propellers in motor 3 and 4 and the counter-clockwise ones in motors 1 and 2.
Finally, you'll need a way to control your drone. I propose two methods:
- WiFi + gamepad: Have the autopilot create its own WiFi network with a USB dongle (Erle Robotics images support this by default) and use a common gamepath to control the drone through a Ground Control Station.
- WiFi + ROS: Do you happen to know about the Robot Operating System (ROS)? You can use a ROS node to visualize the flight mode, state and control the drone. Have a look at https://www.youtube.com/watch?v=XxogeasbHyI.
- Traditional RC: Alternatively you could buy an RC controller with PPMSUM-enabled receiver and attach it to the autopilot (to the PPM-SUM input channel).
The following video shows how to pilot the drone using the last option.Related projects