Quick note: This project uses components from Erle Robotics. I'm not affiliated with the company or its founders, but I do dig their work and open-source ethos. If the scene interests you, a couple other suppliers of robotics components for Raspberry Pi-based projects are Dexter Industries and PiBOT. I'll be bringing you more tutorials from across the makerverse down the line.
Part of the fun of robotics in 2016 is that it can serve as a relatively low-cost hobby, one that tests and enhances your hardware and coding chops. That's largely due to the Raspberry Pi and other cheap micro controllers, to hundreds of components and shields available for custom hacks, and, of course, to an open source community that supports sharing information and advice.
Erle Robotics, which I mentioned in last week's piece about the increasingly important role of Linux in robotics, supplies cheap components for DIY Raspberry Pi projects. I got in touch with the makers at Erle this week to come up with a great tutorial for our readers.
Introducing the $200 DIY smart drone. The project comes courtesy of Victor Mayoral Vilches, a roboticist from Spain, and edited versions of his instructions are included here with permission.
What you'll need
Erle Robotics PXFmini
Raspberry Pi Zero
HobbyKing Spec FPV250
Erle Robotics PXFmini compatible power module
Soldering iron (generic)
Apps / Online
APM flight stack
Debian-based Linux file system for drones
This tutorial demonstrates how to build a Linux drone with the Raspberry Pi Zero that costs less than $200. 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 from Erle Robotics.
Step 1: Assemble the drone kit
Time: ~30 minutes
Once you get all the components start by assembling them. This is where the fun of DIY hardware comes in. Use the picture above for reference.
- 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 are 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, being very mindful of short circuits); b) cut the other end of the power module and resolder the battery connector (previously cut) at that location; Done! This will allow us to easily connect and disconnect the "battery+power module" to the drone.
- Place the "battery+power module" pack underneath using the velcro included in the package.
Step 2: Ready the autopilot
Time: ~30 minutes
Connect the PXFmini shield on top of the Raspberry Pi Zero. Use this image for orientation reference:
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.
If you purchase the PXFmini from Erle Robotics you get access to their Debian images, so you can just fetch a PXFmini compatible Debian image and flash it into a microSD card.
Step 3: Mount the autopilot
Time: ~5 minutes
Mounting the autopilot (Raspberry Pi Zero + PXFmini) in the drone can be done a few ways. 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 you'll need to mount 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.
Step 4: Mount the propellers and get it flying!
Time: ~15 minutes
Two of the propellers turn clockwise (marked with an "R") and two turn counter-clockwise. Place the clockwise propellers on motor 3 and 4 and the counter-clockwise propellers on motors 1 and 2. This is a pretty important step to get right.
Now you'll need to decide how to control your drone. You've got some options.
• 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: The Robot Operating System(ROS) is awesome. You can use a ROS node to visualize the flight mode and control the drone. If you want to go this route, check out this video;
- Traditional RC: Alternatively, you could buy an RC controller with a PPMSUM-enabled receiver and attach it to the autopilot (to the PPM-SUM input channel);
And that's it! Here's a video of the drone in action using the traditional RC method.
Questions on the tutorial? Leave 'em in the comments.