Earlier this year, I set my heart on building a drone that can fly itself. I know I’m not the best pilot, so I wanted something that could more-or-less take care of things on its own. It was (and is) a very long road, which started with me buying a Raspberry Pi 4B.
Since then, I’ve constructed a vehicle that can hold an extremely steady position a few feet above the ground. That’s about the extent of its autopilot so far, but that is a remarkable thing in itself. Your standard remote-control quadcopters may be able to “stabilize” themselves in the air, but they have no idea where they are in relation to the world around them and therefore can’t “stand still”. If the wind blows them, they’ll drift unless the pilot intervenes. It may sound like a small difference but it’s much more substantial when you’re working with precise movement in an area full of obstacles.
Let me also take a moment to say that if anyone reading this is encountering issues with any of the parts or workflows mentioned below, leave a comment and I’ll be happy to help out. So, let me list off the salient components of my project (which I’ve christened W.A.T.N.E. — in honour of the character Mark Watney from the novel The Martian by Andy Weir.
- The Frame – DJI Flame Wheel F450 ARF Kit. It came with motors, electronic speed controllers (ESCs), a sturdy set of arms, and a top plate + bottom plate.
- The Flight Controller – Navio2. Most people opt to buy a standalone FC and connect a “companion computer” (usually an SBC like a Raspberry Pi or Nvidia Jetson Nano) over UART. I operated through the path of least resistance and got what I knew best: a Raspberry Pi Hat. RPi Hats are basically daughter boards that connect to the GPIO pins on the Pi and give it extended functionality. In this case, it’s giving my model 4B the capability to be an integrated 2-in-1 flight controller and Linux companion computer. I’ll talk more about the implications of that later, but please do read what I have to say before you invest in a Navio2 or any other FC that runs off the Linux stack.
- Cellular Uplink: Netgear 340U USB LTE Modem. A rare find and a royal pain to configure for Linux, but I got there in the end.
- Tracking: Intel RealSense T265 Tracking Camera. (Tests are underway to implement this device for precision landing.)
- Obstacle Avoidance: Intel RealSense D435i Depth Camera.
- Intelligent Object Recognition: Intel Neural Compute Stick 2 (not currently set up).
- Radio Receiver: FrSky R9
- Radio Transmitter: FrSky Taranis Lite with R9M ACCESS (long-range module).
- FrSky SBEC
- PiJuice UPS/Power Management Hat
- 4S Li-Po High-Discharge Power Cell
- Lots of cables, wires, connectors, Flex Tape, and hair ties.
I’ll be honest with you, I had little to no clue what I was doing when I started. My dad, who is an Internet Pioneer that founded this blog several years before my birth, raised me with an intermediate understanding of computers. However, this was hitherto my first foray into the world of UNIX commands. I familiarized myself with syntax by messing around with online examples aimed at kids. Like most things, you’ll find that the most intuitive way to learn coding is with the materials aimed at kids. I started off with Scratch by MIT just a few months after its release over a decade and a half ago.
When I thought I was ready to take on the big project (I was woefully misguided, but if I had known what I was in for I may not have started at all), I ordered the frame kit. That was my big initial commitment to the project. Assembling it was easy enough, once I got used to the soldering iron. You only need it for fusing the ESC cables to the bottom-plate. Pretty much everything else is plug-in if you play your cards right.
It’s not hard to build a quadcopter. We live in a blessed era of over-information, we need only have the skill to discern the pertinent from the irrelevant.
- Flash an SD card with Emlid Raspbian. You’re stuck with their distro because the Navio2 needs a custom kernel.
- Assemble the frame kit. Only put the propellers on when you’re ready to fly it but make sure you know which props go on which motors.
- Assemble your Big Brain Module, in my case it’s a Pi and two hats. Oh, and put that SD card in there too.
- Connect the ESC wires to the servo rail, and the Navio2 Power Module to the port on the back-right corner of the FC. WARNING: I hate to be the guy to tell you that the boogeyman is gonna get you if you don’t eat your vegetables, but if you don’t follow the wiring diagram exactly, your drone will keep flipping when you try to take off and you’ll never know why. Trust me.
Connect the power module to the flight battery. I mean, you can do it just to make sure power goes through it but all the motors will do is beep at you in a distressed fashion until it gets a data input. Maybe just leave it disconnected for now.- Connect the power module to the bottom-plate. I use XT60 connectors and I had to solder an XT60 connector to my bottom-plate for the power running to the motors.
- Connect the radio to the port on the servo rail marked “1”. it’s the column of pins reserved for the only radio so don’t put your motors or anything else there.
That’s it for hardware, assuming everything was done right the first time. A lot of this stuff is trial and error, as it has been since time immemorial. Remember that everything you do is a result of the culmination of thousands of years of societal and technological research and infrastructure. We stand on the shoulders of giants, all of us. We are nothing without the efforts of our predecessors and keeping that in mind seems to temper me when my patience runs thin.
So far, I’ve described how to build something theoretically capable of flight. There’s not much to do software-wise, just some basic calibration done through the ground control application. I use QGroundControl but if you use Windows I’ve heard Mission Planner is way better.
If you configured everything right, you have yourself a remote control quadcopter. It should arm in stabilize mode even without a GPS lock (don’t get me started on GPS just yet).
In the next post I’ll go over all the tweaks and tricks I’ve done to make it do more than just be an RC toy.