Building a drone

Published August 25th, 2020

Follow along as I take you through my experience of building my own drone! This also serves as a tutorial if you want to replicate this work.


  1. Introduction
  2. Disclaimer
  3. How a Quadcopter Works
  4. Parts
  5. Tools
  6. Assembly
  7. Software
  8. Conclusion


I've always thought it'd be cool to have a drone. Not only to fly around and take pictures, but also because when I think of the future, I imagine societies relying on drones for common functions. Drones for delivering packages and mail, for defense, for surveying and research, and the like. I want to live in a world where I can order a coffee on the street and have a drone fly it to my hands. But before we build drones that deliver food, I must first build a drone (that flies).


This blog post is for educational purposes only. You may attempt to recreate this work at your own risk, but I will not be liable for any injuries you may sustain, or if you fail to build a working drone from this tutorial. I may not provide support if you ask me questions about this tutorial.

How a Quadcopter Works

Blue props run CCW, red props run CW. Larger props represent higher thrust, smaller props represent lower thrust.

A quadcopter relies on 4 propellers pushing air downwards to generate lift as a reaction force. The propellers can't all spin in the same direction, however; the motors would collectively exert torque on the frame, causing it to spin uncontrollably. Thus, two motors must spin clockwise, and the other two counterclockwise. Different amounts of throttle are applied to each prop to achieve different attitudes, as shown above.

At the start of this project, I toyed with the idea of writing my own flight controller using an Arduino. A flight controller basically takes in user and sensor input and figures out how much throttle each prop needs to maintain level flight or carry out joystick instructions. As it turns out, this is extremely complicated and involves math, electrical engineering, and control theory knowledge that I have yet to discover. So instead, I'll be buying a flight controller to do all the work for me :)

High-level system design

My quadcopter will be powered by a LiPo battery, which will power the Raspberry Pi, FC, ESCs, and motors. The Raspberry Pi will run a script to receive joystick instructions from an Android app over Bluetooth. Those instructions are translated into RC commands and sent along a USB serial connection using the Multiwii Serial Protocol.


After a quick Google search, I've put together a list of parts that will go into each quadcopter. I've also added some optional parts that came in handy for me.

There are some quick things to note. Instead of buying a separate remote controller, I've decided to use a Raspberry Pi flight computer, which I will connect to using Bluetooth from my phone. Also, instead of buying a frame, I got my friend Neal to 3D print one for me! Check out his GitHub!

Each quadcopter requires a few general components; we'll go into my selection for each one-by-one.

  1. Frame
  2. Motors
  3. Propellers
  4. Flight Controller (FC)
  5. Electronic Speed Controllers (ESCs)
  6. Battery
  7. Radio Receiver or Flight Computer

1. Frame

Huge shoutout to Neal for designing and printing this awesome frame!

2. Motors

These are XING-E 2207 1800KV 6S brushless motors. What do all these numbers mean? 2207 can be broken down into 22 (stator diameter) and 07 (stator height). Generally, larger numbers mean more power and higher torque. The KV rating is the theoretical increase in RPM for a 1V input increase with no load. Higher KV motors have a higher top speed, and lower KV motors have more torque. Finally, 6S refers to the maximum number of LiPo battery cells the motor can be connected to: 6. Don't use a battery that exceeds the limits of your components!

3. Propellers

These are Gemfan 51466 Hurricane (5.1x4.66x3) propellers. 5.1 refers to the 5.1in prop diameter. Larger diameter props are more powerful, and require higher torque to spin. 4.66 refers to the pitch (how much the blade is angled). Specifically, it is how far the prop would move if it was forced to spin in a soft solid. The higher the pitch, the more thrust it can produce for the same speed, and the more torque it takes to spin. Finally, the 3 refers to the 3 blades on the prop. More blades = more thrust = more torque required.

4, 5. Flight Controller + ESC Stack

This is the Mamba F405 Mk 2 + Mamba F40 Mk 2 40A 3-6S Flight Controller + ESC stack. You could buy a flight controller and your ESCs separately, but I find that it's more compact to buy them stacked together. The F405 Mk 2 is a Betaflight (firmware) flight controller. The F40 Mk 2 is a 4-in-1 ESCs that can handle power distribution to all 4 motors at once. It can handle 40A per motor continuously, and accepts 3-6 LiPo cells.

6. Battery

This is the R-Line Tattu 4S 1300mAh 95C LiPo battery. 4S refers to the number of cells in the battery. The standard for LiPo cells dictates that each cell has a nominal voltage of 3.8V, maximum of 4.2V, and absolute minimum of 3.0V (you really shouldn't discharge below 3.4V). 1300mAh is the amount of charge that it can hold, and 95C refers to discharge rate. Take the the 1300mAh from the capacity, chop off the 'h' to get 1300mA, and multiply by the C rating to get 1.3A * 95 = 123.5A.

Do your research on LiPo batteries! Make sure you know how to charge and take care of them; if you don't, they WILL catch fire and explode!

7. Flight Computer

Since I'm not using a radio receiver and remote control, I'll be using a Raspberry Pi 3B to send commands to the FC. This is also useful for my future endeavors, such as flying autonomously. For now, it will serve as a link between my Android phone and the flight controller.

8. Miscellaneous

There are some other parts and hardware that I used. They aren't particularly noteworthy and are self-explanatory, so I'll just list them here.


I also had to obtain certain tools in order to assemble the quadcopter. The specific tools I used are of less importance, so I'll just list them here.


Physically assembling the drone was straightforward, albeit tedious.

  1. Put the arms and plate together to form the frame
  2. Install motors onto arms
  3. Solder the XT60 connector (and capacitor, if you have one) to the 4-in-1 ESC battery input.
  4. Loosely secure the FC stack to where is supposed to be; solder the motors to the ESC underneath the FC. Remember the directions of the props! Each motor has 3 wires, each of which can go to any of 3 pads on the ESC. Swap any 2 of 3 wires to reverse drive direction. This took me forever :(
  5. Securely install the FC stack to the frame
  6. Install the RPi to the frame
  7. Strap the battery to the bottom of the frame using VELCRO
  8. Add wiring; connect the splitter to the battery, one side to the USB power adapter and the other to the FC. Connect the USB power adapter to the RPi. Finally, connect the RPi to the FC using USB-MicroUSB.
  9. Install props on motors. Make sure nothing is obstructing your props.
Assembled drone (without wiring and battery)


Now, we have to code our drone! Specifically, we need two pieces of software:

  1. A Python script run on the Raspberry Pi to receive joystick positions from our Android phone over Bluetooth, process those commands, and send them to the FC over a serial connection (USB).
  2. An Android app with joystick inputs that connects to the Raspberry Pi.

The code (and CAD files) are public for your perusal in this GitHub repository.

Android Controller App

The Android app was heavily inspired by Blue Dot. I modified the source code to give me 2 joystick pads, with the left pad for throttle and rudder, and the right pad for elevator and aileron.

Dual d-pad remote control on Android app

Raspberry Pi Python Script

To receive joystick data via Bluetooth, I used the aforementioned Blue Dot library. The data received is in the form of coordinates on each d-pad, while the format I needed to send to the FC is an RC command over the Multiwii Serial Protocol (MSP).

There are libraries out there that abstract away the inner workings of MSP; I made some of my own changes to pymultiwii, an open source project. However, I needed to build the RC command myself. An RC command is composed of 8 short integers, each on a range of 1000-2000, representing aileron, elevator, throttle, rudder, aux1, aux2, aux3, aux4, respectively. You can see some of the processing code below:

# calculate roll, pitch, yaw and throttle from dpad positions
x, y = 0.0, -1.0
if leftStick and leftStick.is_pressed:
x, y = leftStick.position.x, leftStick.position.y
throttle = (y + 1.0) / 2.0
rudder = x

x, y = 0.0, 0.0
if rightStick and rightStick.is_pressed:
x, y = rightStick.position.x, rightStick.position.y
aileron = x
elevator = y

# roll, pitch, yaw, throttle, aux1, aux2, aux3, aux4, each from 1000 to 2000
buf = []
push16(buf, int(aileron * 500 + 1500))
push16(buf, int(elevator * 500 + 1500))
push16(buf, int(throttle * 1000 + 1000))
push16(buf, int(rudder * 500 + 1500))
push16(buf, 1500)
push16(buf, 1000)
push16(buf, 1000)
push16(buf, 1000)

Finally, to run the script on boot, head into /etc/profile and add the command to start the Python script:

python3 /home/pi/Documents/drone/raspberry-pi/


If you've been following along and building your own drone, you should have a flyable drone now! Please observe drone laws in your locality, and fly safely. I do plan on implementing autonomous functionality into my drone by way of the Raspberry Pi and more sensors (barometer and GPS), and I'll keep this blog posted on how it all goes! For now, have a video of me flying my drone :)