You are on page 1of 75

instructables

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM


Navio2 Flight Controller

by Simkaisheng

Ardupilot is a widely used open source unmanned the following guides linking the step numbers to
vehicle autopilot software that is capable of section names may be useful:
performing many functions. Documentations and
various sources have provided us with the basic Intro Introduction
knowledge of the setups and use each separate
component of a drone but none has provided a Step 1-15 1.0 Full Component List
detailed guide on how to put them together to build
the drone’s hardware with guided steps of component Step 16-19 2.0 Thrust-to-weight ratio
setup and assembly from scratch, together with all
necessary con guration and setups. Step 20-21 3.0 Navio2 hardware setup

This article is written to combine all scattered Step 22-37 4.0 Drone Hardware Setups
information into one piece, to provide a step-by-step
guidance from head to tail of how to build and Step 38-42 5.0 Flashing OS into microSd card
assemble a quadcopter from scratch and how to
perform all setup con gurations required using the Step 43-49 6.0 Raspberry Pi Wi-Fi network
Navio2 Ardupilot ight controller. Other ight con guration setting
controllers from APM or others can also partly rely on
this guide. Step 50-53 7.0 SSH Raspberry Pi on your laptop using
PuTTY
In each of the steps shown below, there are pictures
or tables that helps you to understand more. Note Step 54-57 8.0 Setting up Ardupilot
that the pictures or tables illustrates the details of
texts within the involved step itself only. You will need Step 58-66 9.0 Connecting to your Ground Control
to click on the image to see in full size. A PDF version Station (GCS)
of the entire guide is attached below, which is much
clearer and less confusing in showing the details Step 67-79 10.0 Flight calibration on Mission Planner
regarding tables and photos. There are a total of 16 (MP)
sections and all the steps below are all derived and
organised from the 16 sections of the PDF le Step 80-86 11.0 Change the ight mode on mission
attached. There are sub-sections for each sections planner with respect to radio transmitter
grouped as steps. Again, if you nd it confusing or
troublesome, simply download the attached PDF le Step 87 12.0 Installing a turn-o switch to the RPi3
that is ready-made.
Step 88-95 13.0 Running an autonomous mission
If you would still prefer to adhere to the steps below,
Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 1
Step 96-99 14.0 Manual Flight control

Step 100-106 15.0 Data Flash Log Analysis

Step 107-115 16.0 Object Avoidance Implementation

First let us select and purchase all the components


that are required. The components can be purchased
from di erent sites or sources but a basic requirement
guide for all components will be provided as shown. A
summarised list of the required components and the
links to purchase each of the components are as
shown in the PDF le named Drone BOM List (All
pricing are converted into Malaysia Ringgit MYR or
RM). Those components are the low-cost, high quality
components that I have searched through the
internet. Most of the components are from Chinese
companies. I have tested them I believe they have
similar qualities with their western counterparts but
at much lower prices. However, you need to be extra
careful when you want to purchase components from
Alibaba because strangely cheap components from
untrusted sites may have compromised qualities.

Otherwise, I also have included A liate Links into


each component for your reference to buy from
Alibaba or Amazon. Those a liate links were not
included in the PDF les attached.

To purchase a slightly more complete guide backed


with some researches based on technical papers:

https://payhip.com/b/7b4G

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 2
Download
https://www.instructables.com/ORIG/FRH/YY7H/JK8KBSBG/FRHYY7HJK8KBSBG.pdf

Step 1: 1.0 Full Component List

Make your BOM list of components online from links ready-made drone to hone your ying skill rst:
like in the PDF le named ‘drone BOM list’ attached
below. Those are the links where I purchase my A liate Links: Amazon Common rugged drone for
components. Components from other sites can be practising)
used but bear in mind that the rule of thumb of
buying components from online is to avoid buying https://amzn.to/33nMRJA
components that are too cheap. The more you pay, the
better the quality you will get. (Note: e.g. Amazon may pay me commission if you
purchase through the A liate link)
Before your ight, consider buying a reliable
Download
https://www.instructables.com/ORIG/FDE/9QXW/JJEJWSLX/FDE9QXWJJEJWSLX.pdf

Step 2: 1.1 Navio2 Emlid Flight Controller

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 3
The main function of the Flight Controller is to direction of heading
provide control for the Electronic Speed Controller
(ESC) to direct the rpm of motors based on inputs 5. Extension ports allocate for additional sensors and
from the transmitter. radio telemetry.

One of the advantages of using the Navio2 ight 6. Radio Communication co-processors accept PPM or
controller is because it has most of the components SBUS inputs from receiver, and output 14 PWM
built-in so we do not need to buy them separately and channels for motors and servos at the servo rails
integrate them by ourselves. The components that
comes together in the Navio2 ight controller include The link to the o cial website to purchase Navio2
Flight Controller is as follows
1. Dual Inertial Measurement Unit (IMU)
https://store.emlid.com/product/navio2/
2. Barometers measure altitude accurate to 10 cm of
resolution. Remember to also buy the dampener ball to connect
the Navio2 board to its 3D printed holder (You will
3. GNSS receiver tracks satellites from all over the also need to 3D print the holder or purchase it online.
world. Refer to Step 3>

4. Compass or magnetometer determines the

Step 3: 1.2 Raspberry Pi3 Model B

Raspberry Pi is a micro-computer at the size of an components, that is GPIO 17 (Pin 11), GPIO18 (Pin 12),
average credit card for data processing. With the and GPIO 26 (Pin 37).
General Purpose Input Output (GPIO) pins, the
Raspberry Pi has high processing capability to run Amazon A liate Link for Raspberry Pi3 Model B:
functions like ying a drone. Of the 40 pins of
extended GPIOs, Navio2 has utilised 37 of them for https://amzn.to/2Z24by8
ight control, leaving only 3 free GPIOs for additional

Step 4: 1.3 Airframe

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 4
The airframe makes up the body of the quadcopter You will need a connector to connect between the
with arms, landing gears, mounts, power distribution PDB and the power module, whereby one end of the
boards and blade protectors. The X frame is chosen connector is to be soldered onto the PDB. For the
because of good symmetry, simpler design, more other end, you need to make sure its connector head
exibility and suitable for abrupt tilting. The selected is compatible with your Power Module wire. The
frame size has a frame of 485 mm. The arrangement power module splits the current from the battery to
of the airframe size has to match with those of the the PDB and a small part to the Flight Controller.
batteries, propellers, as well as motors, as shown in Therefore, its terminal connector also has to be
the table above. compatible with that of the battery. Referring to the
image above, XT-60 connectors are to be connected
To tighten the screws connecting the di erent parts to its XT-60 counterparts, whereas T-connectors has to
of the airframe, you will need Alan keys of suitable be connected to its T-connector counterpart.
sizes. Assemble the airframe tightly using suitable
sizes of Alan keys (Vibrations may cause the screws to Amazon A liate Link to S500 drone air frame:
fall apart), according to guides provided by your
supplier. https://amzn.to/2Wg4YPc

The airframe should come together with a Power Amazon A liate Link to purchase Connector from
Distribution Board (PDB) where we solder all wiring on Power Distribution Board to Power Module:
its terminals to connect the battery to the Flight
Controller (through Power Module wire), to the ESCs https://amzn.to/2BAJHm7
and Motors (through the ESCs wiring).

1. The Airframe sizes with their corresponding props, Motor and Battery sizes.

Step 5: 1.4 Motors 2216/950KV


Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 5
The selection of the motor type depends on the size 250-------------2204-2208-------2000-2300------6
of the propellers or drone. A larger propeller should
be powered by rotors of lower rpm because of the 330-350-------2208-2212-------1500-1600------7-8
higher air resistance. A 950 KV motor means the motor
has a 950 rpm of speed for each volt it is connected 450-500-------2212-2216-------800-1000--------9-12
across. 2216 speci es the motor size. The following
data (also shown in the image for the Component - 1.2 It is recommended to buy a few spares of the motor
Airframe) can act as a general guide but the most caps (as shown in the third photo). A motor cap covers
suitable motor sizes can be those suggested by the and holds the propellers in place, and can falls o
manufacturer/dealer. easily if the cap is not tightened enough (It is highly
recommended to tighten it fully using a spanner). It
Frame Size---Motor size---Motor KV/Speed--Prop can be troublesome to look for fallen motor caps
size(In) especially in grassy areas. If the motor cap falls o , it
usually will be somewhere near to your quadcopter.
<120------------1104-1105-------4000+-----------3 Look for it around and not far from the the drone.

150-160-------1306-1407-------3000+------------3-4 Try to buy motors of di erent colours to di erentiate


the direction of rotations. 2 motors will be rotated
180-------------1806-2204-------2600+------------4 clockwise and 2 motors anti-clockwise, depending on
how you will connect it to the 3-phase ESC output,
210-------------2204-2206-------2300-2700------5 which will be discussed in the Hardware setup section
later on.

If you are buying a motor for drone, it should come Amazon A liate Link to purchase BLDC Motors:
with connectors to your ESCs. Contact your dealer to https://amzn.to/2SjpDMm
check if the package includes the connector. Some
suppliers has ready-made (3 phase) bullet connectors
attached to the motor while some include them in the
package for the buyers to solder on themselves.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 6
Step 6: 1.5 Electronic Speed Controller (ESC)

An Electronic Speed Controller (ESC) draws current to the ESC exceeds that of the motor current rating.
drive the rotor based on output from the Flight
Controller’s servo rail. The ESC is graded with the It is recommended to use ESCs without a Battery
maximum amount of current that it allows to pass Eliminator Circuit (BEC). The navio2 ight controller
through. Therefore, the selection of ESC is supposed can provide power supply to the ESC circuit and the
to be such that the ESC rating is 1.2 to 1.5 times of the receiver through the servo rail. BECs are therefore not
maximum rating of the rotor. For example, since the required. However, if your ESC comes with BEC, it can
selected motor draws a maximum of 15 Amps (look still be used. Follow through the steps in the 'Drone
for the maximum current draw from the motor Hardware Setups' Section to insulate the terminal.
datasheet or current rating speci cations provided by
the supplier) 20 Amps of ESC for each rotor would Amazon A liate Link to Purchase ESC: (With BEC)
su ce without causing any overheating or burnouts.
According to the equation below, https://amzn.to/2Wjtzm2

ESC Rating/Maximum Motor Rating = 20/15 = 1.3333 AliExpress A liate Link to purchase ESC:
AliExpress.com Product - Hobbywing Skywalker 15A
It is best that the above equation yields values within 20A 30A 40A 50A 60A 80A ESC Speed Controller With
the range of 1.2 to 1.5. And since the maximum UBEC For RC Airplanes Helicopter
current draw is rare, 20 A of ESC will su ce so long

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 7
Step 7: 1.6 Propellers

The propeller has to be selected based on the minimises vibrations that could arise from
intended reliability and then sized according to the unbalanced propellers. Mount the propellers on the
motor speed (Refer to the image Guide in Component propeller balancer, turn o your fan, and then tape
1.2). Carbon bre propellers are of higher quality but the end of a lighter propeller blade until balance. You
may not necessarily worth the cost. After all, carbon can shift the tape across the length of the blade to
bre propellers will also break under similar nd the spot for perfect balancing. While balancing,
circumstances of impact. A softer propellers, on the always make sure that the propeller movement is not
other hand, may even be more exible and less restricted. It should be able to swing freely on the
'fragile'. They are also less sti er in resisting air, thus propeller balancer even with the slightest breeze. The
may be better at reducing possibilities of motor grip of the propeller balancer must not be too tight.
heating in large drones. With relatively large airframe
of 485 mm (580 mm including the propeller AliExpress A liate Link to purchase Propellers: (Search
protectors), the rotor speed selected is lower at 950 your speci c size of propellers and try to purchase in
KV, and the propeller size is correspondingly larger at bulk. Consider buying more for spare. You certainly
12 inches or 30.48 cm. Propellers are balanced on a will break some propellers before you can get your
propeller balancer using additional electrical tapes to ight stable)
make sure both blades are of equal mass. This

rel="nofollow">AliExpress.com Product - 5Pairs/Lot RC Amazon A liate Link to purchase Propellers:


Drone Propellers CW CCW Glass Fiber Enhanced https://amzn.to/2IfQcOp
Nylon Propeller
8045/9045/1045/1055/1145/1245/1355MR
1045/1238SF

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 8
Step 8: 1.7 GNSS Receiver With Antenna

A Global Navigational Satellite System (GNSS) receiver photographs on the right).


is the built-in GPS (and other satellites’) receiver in
Navio2. It requires an antenna that is raised high up Make sure you purchase the right connector for your
away from the ight controller to avoid magnetic APM ight controller in which case Navio2 uses an
interferences generated from the components MCX connector:
leading to GPS glitches or inaccuracy of satellite signal
reception. A GPS stand is where the antenna is being https://store.emlid.com/product/gpsgnss-antenna-
mounted to, while the other end connects to the mc...
ight controller’s GNSS receiver through a micro
coaxial (MCX) connector. The micro co-axial connector AliExpress A liate Link to purchase GPS antenna
will come with the GPS antenna set purchased, but holder/mount: AliExpress.com Product -
the GPS stand has to be purchased separately, or 3D- Quadrocopter Kit F450 GPS Folding Antenna Mount
printed online. It is recommended to have it Bracket Naza tarot 650 680 diy drone kit Rc FPV gps
purchased online because those are designed to be antenna mount
bent when you want to place your drone upside-
down during calibration (as shown in the

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 9
Step 9: 1.8 Transmitter

A high grade transmitter is what required to enable in a pair.


good control of a ying vehicle. This is crucial because
otherwise, fatal injuries could be the result following AliExpress A liate Link to purchase AT10 Radiolink
an impaired communication. The Radiolink AT10II Transmitter C/W receiver: AliExpress.com Product -
series is by far the most advanced transmitter the F07627 RadioLink AT10 2.4GHz 10CH Remote Control
company has developed, o ering hybrid of Direct System 10 Channel Transmitter Receiver R10D for RC
Sequence Spread Spectrum (DSSS) and Frequency Helicopter
Hopping Spread Spectrum (FHSS) radio
communication protocol with the receiver, which then Amazon A liate Link to purchase AT10 Radiolink
communicates with the ight controller via Serial Bus Transmitter C/W receiver: https://amzn.to/2Ac2WlU
(SBUS) single communication cable. The transmitter
can be powered with a small 2200 mAh Li-Po battery
provided by the supplier to save battery replacement
cost. The transmitter will also come with the receiver

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 10
Step 10: 1.9 Receiver

It is highly recommended to use a transceiver pair built-in decoder to decode SBUS RC input values
whose receiver can communicate with Navio2 before passing them to the Ardupilot. To connect the
through SBUS communication protocol. The R12DS receiver to the ight controller, you will need three
receiver I used receives signals from the transmitter female-to-female jumpers to connect the signal,
and then relay the signal to the ight controller via positive and negative terminals of the SBUS line from
SBUS communication protocol. SBUS is a new single- the receiver to the respective signal, positive and
wire communication protocol (saves a lot of messy negative terminals in the servo rail of the Navio2
wirings) that is supported by Navio2. One signal wire ight controller. Use shorter jumpers for better
transmit all radio values of all 12 channels from the tidiness.
receiver (which is in turn transmitted wirelessly from
the transmitter) to the ight controller. Navio2 has

Step 11: 1.10 MicroSD Card

Similar to a computer that requires Hard Disk Drive Sandisk: AliExpress.com Product - SanDisk Ultra A1
(HDD) or the latest Solid State Drive (SSD) as storage, Microsd Memory Card 200GB 128GB 64GB 32GB 16GB
the Raspberry Pi uses a microSD card in which the microSDHC/SDXC UHS-I 98MB/s TF Card micro sd
operating system (Raspbian) is being installed. It cartao de memoria
contains crucial les that store system data such as
connection IP addresses, le directories with codings Amazon A liate Link to purchase 32GB microSD
for di erent features, etc. Sandisk: https://amzn.to/2V8hb42

AliExpress A liate Link to purchase 32GB microSD

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 11
Step 12: 1.11 Lithium-Polymer (Li-Po) Battery

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 12
Lithium battery has one of the highest power-to- connect between the board and the power module. A
weight ratio, making it one of the best choices for T-type connector battery is used. If this type of
powering UAVs. However, Li-Po battery has to be connector is selected, the Li-Po charger and the power
taken care of thoroughly and have its voltage module’s type T connector head should also be
monitored so that each cell stays at least 3V (3.4V to selected accordingly. A professional Li-Po charger is
be safe) before it is being recharged. recommended because it can monitor the charging
voltage and current ow throughout the charging to
The Li-Po battery used is a 5200 mAh battery with 25 C avoid overcharging. It can also trigger alarms when
rating. To determine if the discharge limit, C is fault occurs.
su cient for the motors used, the maximum
discharge current is calculated from. Important Note! Before purchase, Make sure to check
that the connector can match the connector type of
I_max = C×Ah = 25×5.2 = 130A your APM wire and power module. If you are using a T-
type connector, all the mentioned components have
This selection is in line with the ESC and battery size, to have T-type connector. If you want to use an XT60
with each ESC rating being 20 A, and a maximum of connector, all the mentioned components have to
80 A (for quadcopter with 4 motors) will be drawn have XT60 connector. If in doubt, ask your dealer for
from the battery at a time. Occasions where full clari cation of the connection type before you
throttle are applied are rare and therefore 130 A from purchase.
a 25 C battery is more than enough.
AliExpress A liate Link to purchase LiPo:
Li-Po battery size selection has to be made by taking AliExpress.com Product - MOS 11.1v 5200mah 25c lipo
into account the size of the copter for optimum ying battery for rc airplane free shipping
duration. If a large drone is powered by relatively
smaller sized battery, the ight time will be limited. If Amazon A liate Link to purchase LiPo:
a small drone is powered by large batteries out of the https://amzn.to/2rQOOKD
optimum range, the battery drains even faster due to
the extra weight allocated. The selection of Li-Po AliExpress A liate Link to purchase LiPo Charger
battery are best to be as according to the table to Professional: AliExpress.com Product - IMAX B6 80W
achieve maximum available ight time. LCD Screen Lipro Balance Charger Discharger for Li-
Ion/Li-Po/Li-Fe/Ni-Cd/Ni-MH Battery Intelligent
You will also have to purchase a wire with suitable Digital Charger
that is soldered on the power distribution board to

Amazon A liate Link to purchase Li-Po Charger


Professional: https://amzn.to/2RbzoyK

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 13
Step 13: 1.12 Low-voltage Alarm

To protect the Li-Po battery from possibilities of over- AliExpress A liate Link to purchase Low-Voltage BB
discharging, a BB alarm – a loud warning alarm when Alarm: AliExpress.com Product - 1 Piece HotRC New
battery voltage of any cells of the Li-Po dropped Design BX100 1-8S Lipo Battery Voltage Tester/ Low
below set values – is in place to monitor the battery Voltage Alarm/ Voltage Checker for RC Model
voltage from time to time. If the battery is allowed to
discharge under 3 V per cell, it can be permanently Amazon A liate Link to Purchase Low-Voltage Alarm:
damaged and never be able to recharge back again. https://amzn.to/2SjsKE2

Step 14: 1.13 Power Module

Because the same Li-Po battery supplies both the and Power distribution board (PDB).
Raspberry Pi and the motors, a power module
controls the voltage across the two according to their https://store.emlid.com/product/power-module/
optimal requirements. A power module splits the
battery current to the power distribution board (to AliExpress A liate Link to purchase Power Module:
the ESCs) and the power port in the navio2 ight AliExpress.com Product - NEW APM Power Module
controller. The power module should be carefully 5.3V BEC With XT60 / T Type Connectors ARDUPILOT
selected such that the connector matches that of the APM 2.5.2 dks
battery. A power module with the T-connector head is
used if the battery purchased also has a T-connector. Amazon A liate Link for power Module:
https://amzn.to/2rSrVGy
Important Note! Again, before purchase, make sure
you check the connector match that of the battery

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 14
Step 15: 1.14 Telemetry

A radio telemetry consists of a Universal Serial Bus https://amzn.to/2Wk33t0


(USB) ground module to be connected to the Ground
Control Station (GCS) which is your laptop, and a Amazon A liate Link to Purchase Telemetry Module:
Universal Asynchronous Receiver-Transmitter (UART) https://amzn.to/2Lx6rYN
air module to be connected to the navio2 ight
controller. The GCS’s purpose is to plan ight path and AliExpress A liate Link to purchase MicroHeader pin
monitor ight data. If the UART port’s serial lines have for Navio2:
to be used for other purposes such as for obstacle
avoidance, or the GPIO 17 of the UART port is used for AliExpress.com Product - CUAV U-BLOX NEO-M8N
installation of turn-o switch, the Air Module of the HIGH PRECISION GPS with two 6pins +4pins DF13 1.25
telemetry can be interchanged with that of the plugs for Navio2 autopilot
Ground Module, with the Ground Module’s USB head
connected to the RPi3. The Air Module’s UART requires Amazon A liate Link to purchase MicroHeader pin for
an additional USB-TTL CP2012 converter to Navio2:
communicate with the GCS, or computer through the
Silicon Labs CP210X USB-UART Bridge driver (can be https://amzn.to/2QBL37l
downloaded online). The Amazon A liate Link to
purchase CP2012 converter (optional):

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 15
Step 16: 1.15 FPVs and Camera

A Good Camera and Gimbal will enable you to take Camera Holder (optional): https://amzn.to/2RbA2MG
awesome FPV in ight.
Camera Holder: https://amzn.to/2SfP0P2
Considering to buy a good camera and gimbal only
after you have successfully stabilised your drone. Camera: https://amzn.to/2SfP0P2 (Resolution will be
proportionate to price)
Amazon A liate Link to purchase 3-Axis Gimbal/

Step 17: 2.0 Thrust-to-weight Ratio

The calculation of thrust-to-weight ratio of a quadcopter is essential to make sure the quadcopter can take o and
y stably with desired payloads.

Step 18: Calculating the “unladen” Weight of the Quadcopter

The total unladen mass of the quadcopter without any payloads is around 1.336 kg as shown in the table above.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 16
Step 19: Formula for Calculating Generated Thrust

For the drone to be able to take o , the thrust that the rotors produce in total has to exceed that value, or better,
twice of that.

Total thrust=2×Total Weight of quadcopter

Step 20: Calculating Thrust to Weight Ratio

The thrust of each motor can also be obtained directly The thrust to weight ratio of the quadcopter without
from the motor datasheet. As shown in the above any payloads ratio
table the equivalent mass of the thrust given is 1110 g
for a maximum of 18 A current drawn to each of the =(equivalent mass of thrust)/( ight mass of
rotor. From here, the total equivalent mass of the quadcopter)
thrust can be calculated by simply multiplying the
thrust by 4 rotors, giving m=4×1.11=4.44 kg. The =4.44/1.34
thrust to power ratio decreases as the power rises
faster at higher throttle, with minimum of 5.55 g/W at =3.4
the highest throttle.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 17
Step 21: 3.0 Navio2 Hardware Setup

The rst step was to set up RPi3 for Ardupilot. The https://docs.emlid.com/navio2/ardupilot/hardware-s...
Navio2 shield was stacked onto the RPi3 and screws
were in place to bind the two securely. Navio2 Link of Holder parts to 3D-print
together with the RPi3 would act as the FC of the
quadcopter built. Meanwhile, a 3D model holder Top:
through which the FC will be secured onto the https://github.com/emlid/hardware/blob/master/Vibr.
quadcopter’s airframe was printed. Two parts of the ..
holder were bonded together through 8 shock-
absorbing balls. The link provided for the full Bottom:
component list in the PDF le “Drone BOM list” also https://github.com/emlid/hardware/blob/master/Vibr.
included these balls. ..

The link to the documented Navio2 hardware setup is


as follows:

Step 22: To Insert the Shock-absorbing Balls to Hold the 2 Printed Holder Parts Together

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 18
To insert the shock-absorbing balls to hold the 2 Amazon A liate Link to purchase the dampener ball:
printed holder parts together, do not be too gentle to
the balls or it will take you forever to complete the https://amzn.to/3122Kl3
task. Note that these balls are made to be exible and
stretchable. Utilise thin tools like a small Allen key to AliExpress A liate Link to purchase the dampener
push the tips of a ball so that they get stuck at the ball:
necks into the holes between the 2 printed parts,
which have been correctly oriented as shown in the AliExpress.com Product - 4pcs Universal Anti Vibration
gure above. Repeat for another 7 balls, 2 at each Ball Dampening Rubber Balls Shock Absorber for
corner. Then, attach the back of your Raspberry Pi Quadcopter 4-axis Camera Gimbal GoPro Hero Drone
onto the upper surface of the printed holder (the one
with the larger surface area) using the screws
provided.

Step 23: 4.0 Drone Hardware Setups

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 19
After the previous step is done, leave the Raspberry Pi your power module and all 4 of your ESCs to each
(stacked with the Navio2 ight controller) with the corners of the power distribution board. All 4 ESCs
holder and then proceed with setting up the airframe. and motors are the same and can be connected to
anywhere so you need not worry which of them to be
You can try assemble your airframe rst if you would connected to which corner. Solder the red cables to
love to try out, but you will have to disassemble it for the positive terminals on the board and the black
soldering purposes after your motors and ESCs arrive. wires to the negative terminals on the board. The
central cable(s) (usually) is the signal cable to be
Your airframe should consist of a power distribution connected to the navio2 ight controller.
board. Find the surface of the board that has circular
copper terminals marked with positive and negative Make sure the positive and negative terminals do not
signs that are meant for soldering of your short and test the connectivity again after the solder.
components. Use a multimeter’s connectivity test to Secure the connection to the board with more solders
test that all the positive terminals are connected, so in place and test the connection by slightly pulling
do all the negative terminals. I use the soldered the cables. Upon completion, the power distribution
surface to be facing up, so I need to make sure that board should look like a board with hanging threads
when I solder the cables, they will not obstruct any connecting securely, 4 ESCs and 1 power module. Each
screw openings connected to the top central cross of these components is connecetd by 2 wires – red for
arm connector. Find appropriate positive and ground positive and black for negative.
terminals on the power distribution board to solder

Step 24: 4.1

Then, assemble the top central cross arm connector other wirings but needs to diassemble the airframe
with the quadcopter arms using suitably sized Allen for resoldering, which can be extremely rare). Now,
keys, and then connect the combined structure with mount the holder containing the Raspberry Pi 3 and
the power distribution board. Adjust the wirings of Navio2 onto the central cross arm connector using
the ESCs so that they will not obstruct the connection thick double-sided tapes.
points, if you decided to have the soldered surface
facing upward (less possibility of short circuiting with

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 20
Step 25: 4.2

Mount the motor on the end of each of the quadcopter’s arm together with the propeller protector (optional), with
the 3-phase wires facing inward parallel to each quadcopter’s arm. Secure them tightly in place using the provided
screws.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 21
Step 26: 4.3

Then, if the motors do not have readily soldered bullet connectors, solder the bullet connector to the end of each
of the 3-phase wires of the motors. To do this, use a thin head plier to secure the bullet head connector (may be
very hot during soldering), then melt solders into the cylindrical opening. Before the solder hardens, push the wire
from the motor into the bullet head connector.

Step 27: 4.4

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 22
Hold for a few seconds for the solder to harden lay it over the exposed metal part (with solder
completely before you move. Try apply force to test connected) under the bullet head, and then apply
the strength of connection. Loose connections may heat from your soldering gun or a lighter to shrink
cause motor failure in the mid ight leading to and have it covered. Otherwise, use an electrical
crashes. If the supplier provided the heat-shrink tubes insulation tape.
for insulation, cut a su cient amount of the tube and

Step 28: 4.5

Next, secure the each ESC on the top (or bottom) stator alternatedly such that they repel the
surface of each arm of the quadcopter using cable permanent magnets (rotor) to turn. The sequence of
ties. Then, for now, randomly connect the bullet head the 3-phase input to the motor will determine the
connector (may be other types of connectors) of the direction of the rotation of motor. To make sure that
3-phase wires of the Brushless DC motors to the 3 the ESCs output a correct sequence of AC current to
outputs of the ESCs by applying a decent amount of turn the motor in required directions, you will need to
strength. The three-phase quasi AC input to the BLDC test it out later on.
motor will magnetise coils in the excitable coils in the

Step 29: 4.6

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 23
When you have your quadcopter armed for the rst 1. Front right – Anti-clockwise
time (after you have performed all steps that follows),
with all propellers removed, you need to make sure 2. Rear left – Anti-clockwise
that the direction of motor rotation for each motor is
as follows. If any of the motor(s) do not rotate in the 3. Front left – Clockwise
direction as required, simply interchange any 2 wires
that you have randomly connected from the motor 4. Rear right – Clockwise
(which has wrong direction of rotation) to its
powering ESC. Use your nger to feel all motors
rotating in the correction direction as in

Step 30: 4.7

But that is only one of the last steps you would do You should now have your ESCs positive and negative
before which there are still many to be done. Keep this inputs soldered onto the Power Distribution board,
section toward the end (you will be reminded about the central signal cable should be those to connect to
this once again after that) and proceed with the the servo rail. Now, the connection of each ESC must
following. be speci c. Looking from the left of the servo rail, the
leftmost column is the SBUS communication lines (we
Before that, you will need to connect the ESC to the will deal with it later). The second column, third, forth
servo rails of the ight controller as shown in the and fth column, is meant for the rst, second, third
gure above. Refer to the Emlid documentation in the and forth ESCs respectively. Please connect them
link: according to the diagram provided by Emlid above.

docs.emlid.com/navio2/ardupilot/hardware-setup/

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 24
Step 31: 4.8

Let’s name the central wire of our ESC as the signal of the ESCs with 2 signal wires (with the actual signal
wires. The signal wires consist of the actual signal wire, wire and ground wire). We know that usually the
the BEC wire and the ground wire. “central of the central” is the BEC wire, but to
di erentiate between the actual signal wire and the
The signal wire (central of ESC) consists of 2 wires (for ground wire, you have to test it out. Again, do this
ESCs without BEC) and 3 wires (for ESCs with BEC). If toward the end after you arm your quadcopter. If your
your ESC is without a BEC, it will not have a central motors don’t work as according to the transmitters
BEC wire. The central of the signal wires is empty. If command (you can hear the change in speed), you
your ESC has a BEC, the BEC wire is usually ‘the centre have had it connected wrongly. As a rule of thumb,
of the centre’. It is usually the central wire of your 3 more often than not, the black or dark coloured wire
signal wires, which is located in the centre of an ESC is the ground wire. On the servo rail side, the signal,
input. positive and negative terminals are clearly labelled as
the top, middle and bottom row, respectively. The
If your ESC has a Battery Eliminator Circuit (BEC), middle (positive) row is where the remaining one BEC
connect only the BEC wire of your rst ESC (can be any wire (if you have one) should connect to, while the
other ESCs as long as only one), as shown in the actual signal wire should be connected to the rst row
diagram above, on the left, as the orange wire (of the respective column) marked with the square-
extending from the rst ESC. For other ESCs the BEC wave signal icon. Lastly, the ground wires should be
cable is cut o and insulated (don’t cut wrong- only connected to the respective columns in the last row of
“the centre of the centre”). This means that only one the servo rail.
of your ESC’s central wire (BEC wire) of the central
signal wires is connected to the servo rail. The other If your ESCs do not have a BEC, you will not need to
BEC wires from the other 3 ESCs are removed. This remove or add anything.
leaves only the rst ESC with 3 signal wires (with BEC
wire, actual signal wire and ground wire) and the rest

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 25
Step 32: 4.9

To connect the receiver to the ight controller, you positive and negative terminal for the SBUS
will need three female-to-female jumpers to connect communication on the rst, second and third line
the signal, positive and negative terminals of the respectively. Use shorter jumpers (for better tidiness)
SBUS line from the receiver to the respective signal, to connect those to their counterparts in the receiver.
positive and negative terminals in the servo rail of the Secure the receiver with a cable tie.
Navio2 ight controller. The rst or the leftmost
column labelled as ‘PPM/SB’ provides the signal,

Step 33: 4.10

After the connection of the ESCs, motors, power module and receiver with the airframe, we are left with the
telemetry module, GPS antenna and the battery. The telemetry module comes in a pair – one air module and
another ground module. The air module usually comes with a UART micro-header pin connection to be connected
to the navio2’s UART port as shown below, whereas the ground module comes with USB connector to connect to
your PC.

Step 34: 4.11


Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 26
(Skip the following section if you are connecting it the pin on the telemetry air module side, and cut o the
normal way) Nonetheless, you can interchange the air micro-header pin connecting to the UART port.
and ground module by connecting the ground Judging from their connection to the UART port of
module (with USB connector) to the Raspberry Pi, and Navio2, we can know exactly which of the wires are TX,
the air module (with UART connector) to your PC. The RX, 5V and GND. The port label can be found
latter will require an additional USB-TTL CP2102 underneath the Navio2 board or as shown below. The
converter in order that the air module can be wire that connects to RX on the UART port leads to TX
connected to the COM port of your PC. The terminal on the air module, while the wire that
connection of the air module to the converter connects to TX on the UART port leads to RX terminal
required soldering, and is as shown in the gure on the air module. Based on the similar working
below. principle, TX terminal on the air module should be
soldered to a jumper connecting to RX of the USB-TTL
The label on the USB-TTL converter is clear and converter, and vice versa.
correct, but on the air module the label within the
cover may not be accurate. Maintain the micro-header

Step 35: 4.12

With the 5V and Ground pins connected, the LEDs on data for GCS. To achieve this, minor settings have to
the air module will start to blink, signifying the be done over the RPi3 by logging into the
complete circuit in powering up the air module. Make microcomputer’s OS.
sure that the RX pin of the converter was connected
to the TX of the telemetry air module, while the TX pin From the “etc/default/arducopter” le, the connection
of the converter was connected to the RX of the air con guration was updated to allow this. Details of
module. Completed connection will show solid light this is shown in the later steps when you will go into
for LED when both the air and ground module are setting up in the section “Connecting to your Ground
communicating with one another, but that did not Control Station (GCS)”.
imply the telemetry can work in terms of transmitting

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 27
Step 36: 4.13

A GPS stand is where the antenna is being mounted to, while the other end connects to the ight controller’s GNSS
receiver through a micro coaxial (MCX) connector.

Step 37: 4.14

The battery is tied securely under the battery holder using the connecting tie/strip for battery and connected to
the Power Module as shown below. One of the outputs of the power module should now been soldered to the
power distribution board. The other output, a 6-pin micro-header branches out from the power module, is now
connected to the power port of your navio2 ight controller as shown in the diagram above.

Step 38: 4.15

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 28
With the battery connected, you will be powering up The assembled quadcopter is as shown below.
your Raspberry Pi, Navio2, receiver, and your Remember to tie all loose components securely using
telemetry. Navio2 will have blinking LEDs whose a cable tie. Then, after you have done with all the
colours will determine the di erent conditions of the hardware setups, you will need to perform a series of
ight controller. The telemetry module has blinking software setups, network con gurations and ight
LED that turns solid when connection is established calibrations before you can set it for its maiden ight.
with its ground counterparts. The receiver should also
have LEDs indicative of its supply to the power.

Step 39: 5.0 Flashing OS Into MicroSd Card

A microSD card which will be used as the storage for https://docs.emlid.com/navio2/common/ardupilot/co


the micro-computer, RPi3, has to have the Raspbian n guring-raspberry-pi/ and download the OS image
Operating system (OS) installed. Choose a suitable size to your computer. Remember where you store the le
of 16GB or 32GB. Visit the Navio2 developer’s because this zipped le downloaded will be “ ashed”
documentation at to your microSD card later on.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 29
Step 40: 5.1

Then, we need a software to ash the downloaded OS into your microSD card. Visit https://etcher.io/ to download
and install Etcher. Etcher le is extracted and run on your PC.

Step 41: 5.2

After we get Etcher running, the OS image in the your PC using a suitable card reader or a microUSB
archive le selected is ‘ ashed’ into the microSD card. adapter. Usually Etcher will automatically select the
It was found that this process may not be compatible microSD card as the device to ash. Otherwise change
with some PCs, which required other PCs to be used the device to your microSD card before selecting the
instead. OS image.

Plug in your new or newly formatted microSD card to

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 30
Step 42: 5.3

Select the OS image zip le from where you had it downloaded. Then click ash after it is illuminated!

Step 43: 5.4

This is all required to ash the OS image to your partition manager can be used for this purpose.
microSD card. The OS image by Ardupilot is a simple
one without fancy GUI, and is simple to use. Note that After the “ ash”, your microSD card can now be
your microSD card has now been partitioned for use inserted into your Raspberry Pi3, and then begin
of the Navio2 Flight Controller. If you wish to format it network con guration settings, followed by secure
(if somehow it corrupts after ashing or after several shell (SSH) your Raspberry Pi to your laptop using
times of boots), remember to delete the partitions PuTTY.
after your formatting. Softwares such as AOMEI

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 31
Step 44: 6.0 Raspberry Pi Wi-Fi Network Configuration Setting

To secure shell your Raspberry Pi to your laptop, you LAN cable splitter. Split the LAN port to 2 LAN cables.
need to connect both your Raspberry Pi and your One connect to your laptop and the other to your RPi.
laptop to the same LAN network – be it through Just like on your PC, if you are connecting to the
wireless (Wi-Fi), or with cable (Ethernet) connection. internet using the Ethernet cable, you would not need
to perform WPA network con guration (security) on
Let’s start with connecting your Raspberry Pi to the your Raspberry Pi micro-computer so you can skip the
internet. It is easier if you are using LAN (or Ethernet) step below.
cable. Connect both the RPi and your laptop to the
same LAN cable port, and this requires you to have a

Step 45: 6.1

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 32
Otherwise, if you do not have a splitter or if you are As aforementioned, if you are using the Ethernet
not using a LAN cable port, then follow through the cable, you can skip the following step and directly go
wireless con guration step below, just like you would to “SSH Raspberry Pi on laptop”.
set up connection of your PC to wireless networks – it
is only slightly more complicated than how you would Otherwise, network con guration setting is required.
normally connect your daily devices to Wi-Fi. Because this step is to enable SSH Raspberry Pi onto
your laptop, before that can be done, you can only
Please note that this network con guration setting is login Raspberry Pi using an external HDMI monitor
just to connect Raspberry Pi to Wi-Fi network so that it and a keyboard. Only for the rst time of connection
shares with your PC the same network you would setup (unless you prefer not to use SSH on your
connect your PC to. It is di erent from the network laptop but always use a monitor instead), connect
con guration that you will perform for Ground your Raspberry Pi to a HDMI monitor or use a HDMI-
Control Station (GCS) communication via a telemetry to-VGA converter to connect to a VGA monitor.
module, which will be discussed later on.

Step 46: 6.2

Power up the Raspberry Pi either by connecting a microUSB charge cable, or by connecting it to the Li-Po battery
through the power module. Note that if you are using the Li-Po battery, always attach a BB alarm to monitor the
battery voltage to avoid the irrepairable damage if the battery voltage falls below 3 V per cell.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 33
Step 47: 6.3

Then, by looking at the monitor screen, login to the OS by entering the default username and password. The
default username is ‘pi’ and the password is ‘raspberry’. The password may not show up but anyways hit enter for
each command entered.

Step 48: 6.4

The moment when you login to the OS, you will be greeted with the page as follows

Step 49: 6.5

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 34
Copy and paste the command: for ssid line and the password of your Wi-Fi network
for psk line. If your local network is not password-
sudo nano /boot/wpa_supplicant.conf protected, just leave the psk’s “” empty. These are
nothing but the network name and password that
and hit enter to go to the le to con gure Wi-Fi you would normally enter to connect your devices to
setting. Password and username of the network over the Wi-Fi. To move the green text insertion cursor, use
which both the RPi3 and your laptop (with PuTTY) the arrow keys.
would connect to, is entered as shown. Fill your
network name between the “ ” as in “NETWORK NAME”

Step 50: 6.6

After that, press “Ctrl+X” to quit and hit key “Y” able to automatically connect to your set Wi-Fi
followed by “Enter” to save what you have editted on network when it is booted (though it may take some
the network con guration le. Reboot the ardupilot time for the connections). The connection of both
by typing the command sudo reboot. your Raspberry Pi and your laptop to the same LAN
(either Wi-Fi or Ethernet) is necessary for SSH
If you do not have a monitor or a keyboard, the whole connection in the following step.
editing process can also be done by editing the text
le named wpa_supplicant.conf in the microSD card. Note: Using mobile or PC hotspot is also the same as
To do this, just remove the micro SD card from your using ordinary Wi-Fi. You can monitor from your
Raspberry Pi, plug it into your laptop or PC, and then phone or computer the devices that are connected to
look for the text le to edit the ssid and psk setting your network. If it cannot connect you may restart the
just as you would edit it using the monitor. This time, RPi3 or recheck the network con guration name and
right-click the le and open with suitable softwares password you have edited in your text le (note that
such as WordPad. Save the txt le after editting. they are case-sensitive and there should not be
additional spacing when there is actually none), and
Then, if you are on the monitor display, reboot your wait until it connects (both navio and your PC) and is
Raspberry Pi by typing the command sudo reboot. shown.
After device reboot, your Raspberry Pi will then be

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 35
Step 51: 7.0 SSH Raspberry Pi on Your Laptop Using PuTTY

PuTTY is one of the network terminal emulator PuTTY.


software that enables login to Raspberry Pi using your
laptop. It is ne if you do not wish to SSH your Install PuTTY from the link below and follow through
Raspberry Pi with your laptop, but this will require you all the installation steps. Then search in your PC for
to connect your Raspberry Pi to a monitor and PuTTY desktop app and run it.
keyboard every time you want to make a
con guration settings, such as setting up the Link to PuTTY download:
Ardupilot, or setting up GCS communication. If that is
the case, you don’t even have to perform the Wi-Fi https://www.chiark.greenend.org.uk/~sgtatham/putty
con guration setting and do not need any internet /latest.html
connection. Just directly proceed to “setting up
Ardupilot” through the monitor instead of through

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 36
Step 52: 7.1

To connect with PuTTY, type in the con guration “navio.local” as the IP address and enter (or verify) the default port
22 as shown in the gure. Restart PuTTY and try it for several times if it prompts error that local host does not exist.
If the condition persists, try disconnect supply to your Raspberry Pi and then reconnect it, i.e. to reboot your
Raspberry Pi.

Step 53: 7.2

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 37
Repeat the action until PuTTY is started and you are means that you didn’t manage to connect both your
prompted with a warning message from PuTTY. Allow laptop and your Raspberry Pi to the same and
connection by hitting “Yes”. Then, after entering the working network. Try using your mobile hotspot to see
default “pi” as username and “raspberry” as password, if both your laptop and Raspberry Pi (default name of
you will be greeted with the same interface you would device is navio) are in the list of connected device. If
nd by connecting your Raspberry Pi directly to a the navio device is not connected, check back to your
monitor, but this time is an SSH to your laptop. network con guration setting.

If the error “Local host does not exist” persists, it

Step 54: 7.3

The entire setup steps can be referred from the o cial navio documentation:

https://docs.emlid.com/navio2/common/ardupilot/installation-and-running/

Step 55: 8.0 Setting Up Ardupilot

If you have powered your Raspberry Pi from Li-Po recommended so in the following step because using
battery through the Power Module that also powers a microUSB cable will add physical di culties to the
your ESCs, the ESC will beeps continuously until you calibration process. Switch to battery connection
have done calibrating your hardware. If you think the during the ight calibration steps will ease things out.
beeping sound is annoying, use a microUSB cable to
power up the board instead. However, it is not

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 38
Step 56: 8.1

Once the connection was established, entering the default ‘pi’ and ‘raspberry’ username and password will bring
forward the same simple interface as shown below. As mentioned, you can lead to this interface either through SSH
it on your laptop (where you have to connect both your laptop and RPi to the same LAN) or directly through a
monitor.

Step 57: 8.2

In order to set up Ardupilot, the vehicle type, version The interface will show as below. Follow through the
and board had to be selected through the command selection of your vehicle type – copter, version of
“sudo emlidtool ardupilot”. Ardupilot, frame – Arducopter, whether you want
Ardupilot to start on boot – enable, start the
Use right-click (not Ctrl-C and Ctrl-V) if you want to Arducopter and Apply.
copy and paste, and hit enter to run the command.

Step 58: 8.3

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 39
Then, hit ‘q’ to exit. To check if the ardupilot will be sudo systemctl daemon-reload
started on boot of the Raspberry Pi, the command:
"systemctl is-enabled arducopter" is entered. sudo systemctl start arducopter

The change in vehicle setting required reloading and Or less preferably,


restarting of the vehicle through the commands, one
after another: sudo reboot

sudo systemctl stop arducopter to directly reboot the arducopter

Step 59: 9.0 Connecting to Your Ground Control Station (GCS)

A Ground Control station is your laptop with a connect.


software such as Mission Planner used to monitor the
ight in real-time. For both udp and telemetry connection, a one-time
con guration setting is required for the GCS
You can connect your quadcopter with your Ground communication. Type the command to con gure
Control Station (GCS) using LAN connection (udp telemetry network communication setting:
connection), just as you would do to set up SSH
communication. Udp connection is useful when you sudo nano /etc/default/arducopter
want to connect your drone to the GCS for simple
tasks such as pre- ight checking, post- ight analysis If the GCS is going to be connected to the Arducopter
or retrieving ight data. However, it is recommended through udp, i.e. LAN connection, the IP address of
that to monitor a ight, a telemetry module pair is the network, followed by the default udp baud rate,
used because they are more reliable (do not rely on 14550 is entered.
network connectivity strength), and are easier to

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 40
Step 60: 9.1

The network IP address was obtained from network and sharing centre shown in the gure. Take for example this
case, we will replace

TELEM1=“-A udp:10.122.12.111:14550” with

TELEM1=“-A udp:192.168.43.94:14550”

Step 61: 9.2

To open the network connection details in network and sharing centre, go to your control panel and press “view
network status and task”

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 41
Step 62: 9.3

From the network and sharing centre, select the common LAN that you have had both your Raspberry Pi and your
laptop connected to. The network address is taken from the IPV4 address shown above.

Step 63: 9.4

Now if the GCS is going to be connected through a replace the “AMA” in the line with “USB” as
pair of telemetry module, the second line with
‘TELEM2’ was updated. Simply uncomment the line by TELEM3=“-D /dev/ttyUSB0”
removing the # symbol in the beginning of the line
By specifying all entered ‘TELEM1’ to ‘TELEM3’ as your
TELEM2=“-C /dev/ttyAMA0” options, any types of connections as mentioned can
be established without the need of a recon guration
If a USB telemetry (usually a ground module) is used, in this interface.
the third line with ‘TELEM3’ was added. This time

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 42
Step 64: 9.5

Again, press ctrl-X to leave and ‘Y’ followed by enter to as discussed through easy-to-use interfaces.
save the changes. Then, reboot your Raspberry Pi Download the latest version of Mission Planner from
through ‘sudo reboot’.
http://ardupilot.org/planner/docs/mission-planner-...
The GCS software used was Mission Planner by
Michael Oborne which supports a variety of functions

Step 65: 9.6

If you are using a common LAN for GCS-navio2 consider restarting your Raspberry Pi, through sudo
communication, select on the top right corner (after reboot on PuTTY, or directly unplug and reconnect
you editted the telemetry network con guration supply to the Raspberry Pi. Note that it will never
address) UDP connection and hit ‘connect’. The baud connect if your IP address of your network have
rate will automatically show, and parameters will be changed but you have not updated the telemetry
loaded soon. Changes in the values of ight data on network con guration in the above step. Check out
the bottom left in Mission Planner will a signify the IPV4 address at your network and sharing centre!
successful connection. If mavlink connection takes
too long – after the 30-second counting down –

Step 66: 9.7

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 43
If you are connecting using a telemetry module pair, automatically loaded. Save the setting after process is
plug in the air module to the UART port on navio2 complete. Then go to the other tab and come back to
and the ground module to your laptop through USB. see if the paramteres are still there. If this fails, try to
Wait until the LEDs on both modules stop ashing (i.e. reboot the RPi and attempt several times.
emitting a solid light), go to Initial setup > Optional
hardware > Sik Radio on Mission Planner. To do this Please note that all hardware connections are shown
you will not have to establish udp or any connections in the “drone hardware setup” section.
before that. Then, press the button “Load setting” and
wait as the parameters in the blank spaces are

Step 67: 9.8

Then, change the connection to COM4 (the baud rate will also be automatically loaded), and then hit ‘connect’.
Telemetry connection usually takes longer time to load parameters but should also show responses within seconds.
Again, retry again after rebooting the RPi if this step fails.

Step 68: 10.0 Flight Calibration on Mission Planner (MP)

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 44
If we connect the power of the Raspberry Pi through ight. To proceed we rst connect the Mission Planner
the Power Module from the battery, instead of the GCS to the drone from the previous step, through udp
micro-USB cable, the esc will beep continuously connection, or through a pair of telemetry module
signifying the setup procedure is yet to complete and (recommended).
the esc does not recognise the ight controller. Only
after all calibrations are done, the esc beeping will It is not necessary to follow through the steps in the
stop. setup wizard, that is designed to guide new users
through the calibration procedures. The calibration
Flight calibration is a crucial and compulsory step to steps are as follows:
complete before the quadcopter can be armed for a

Step 69: 10.1

1. Go to Initial Setup tab > Mandatory Hardware > Frame type

Step 70: 10.2

2. The quadcopter airframe type – X-frame – is selected.

Step 71: 10.3

3. Perform accelerometer calibration. Simply place the drone on at level and then hit “Calibrate Accel”.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 45
Step 72: 10.4

4. The quadcopter is then placed still on a at surface This step overrides the current state of the
for level calibration. Di erent orientations of tilting, as quadcopter as level and in di erent positions, and can
instructed: on level, on its right, on its left, nose up, be done everytime you see from the attitude indicator
nose down and on its back, is calibrated. Press the (as above) that the quadcopter is not leveled properly.
button after each position is properly adjusted. As
mentioned, this calibration process is much simpler Note: Telemetry’s connection requires a one-time
done when your RPi is connected wirelessly to the GCS con guration through Sik Radio connection in
through a telemetry and has power supplied through optional hardware in the Initial Setup tab, by loading
a battery, instead of using LAN cable or power from the settings after both the air and ground modules’
MicroUSB cable because otherwise movements of the LED are in green, solid emitted state.
quadcopter will be restricted by the cables.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 46
Step 73: 10.5

5. Magnetometer or compass calibration is required for the accuracy of the quadcopter’s headings, and is
performed by moving the quadcopter to cover all directions of the 3-axis planes. To start this, simply hit the start
button as shown in the gure below. Calibration will begin collecting required sensor data and the progress of the
calibration of the selected compass is shown in the green progress bar.

Step 74: 10.5.1

To calibrate the compass, turn the drone’s top toward you and move it in circle like how you would steer a car to
exceed one cycle. Then repeat the actions with the drone’s top facing away from you. Then, rotate the drone on its
level then rotate again with it upside down. The video demonstration by Ardupilot on magnetometer calibration is
as: https://youtu.be/DmsueBS0J3E

Step 75: 10.5.2

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 47
By the end the progress bar should have reached its problematic compass, i.e. use only compass 1 if
end and a message to tell completion and prompt compass 2’s progress keeps reloading and use
restart will be shown. compass 2 if compass 1’s progress keeps reload.

There are 2 built-in compasses in the navio2 ight Don’t use the setup wizard if there is problem
controller. If both compass 1 and 2 are used (checked). recurring in the magnetometer calibration. After the
They both have to be calibrated. If any of the calibration is complete, press Ctrl+F to open ‘temps’
compasses keeps reload (the green progress bar and reboot pixhawk as shown.
keeps restart again after it progresses to the end
repeatedly) when being calibrated, uncheck that

Step 76: 10.5.3

After rebooting, in order to see the newly calibrated from the pre-arm check list if you are restricted from
compass o set value, click to go to any other tabs and arming your quadcopter due to “compass o set too
then back to the compass calibration tab. The o set high” after all the calibrations are completed. This is
values are preferably less than 150 for all directions to done by going to the Con guring tab > Standard
be considered successful (values are shown in green). Params > click the ‘Find’ button and search for arm
If the values are more than 150 (in yellow or in red), checks. Uncheck ‘All’ and then individually reselect all
redo the calibration. O sets value that are too high but compass and write (save) the parameters.
may cause the quadcopter to fail the pre-arm check Sometimes the failure to arm a quadcopter due to
list. compass o set disappears even after you re-check
compass as a component of the pre-arm check
If several attempts of recalibration turns out similar requirement.
results, and have ruled out interference of
surrounding metal objects, uncheck the compass

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 48
Step 77: 10.6

6. Radio calibration was carried out to let the Flight to the right channel as discussed, modi cation on the
controller (FC) know the range of PWM that each transmitter has to be made, but the transmitter
channel of radio is sent from the transmitter to the usually would only allow modi cation on channels
receiver before the FC can translate them into ight other than the rst 4, which are xed for
control actions. To begin with the calibration, hit the
button “Calibrate Radio”. Then, move the left and right a. Channel 1: Roll
sticks on your trnsmitter in all directions while
checking that each of them is responding to the right b. Channel 2: Pitch
channel as shown below. The left stick controls the
yaw (left and right) and throttle (up and down), while c. Channel 3: Throttle
the right stick controls roll (left and right) and pitch
(up and down). Bring each stick to their 2 extreme d. Channel 4: Yaw
ends to get the full range of their PWM value
recorded. As the stick is pushed to its extremes, and Note: Please make sure that the transmitter vehicle
the red markers that specify the range of radio PWM setting is copter and not other types of vehicles.
will expand to the side. If the stick does not respond

Step 78: 10.6.1

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 49
If the direction of the response of any radio channel is available channels have their radio calibrated by
inverted, reverse the channel signal either through throwing each switch into di erent directions.
setting on the transmitter or the Mission Planner. For
example, if the pitch is shown to be positive in the Motor and ESC calibration is performed for better
radio con guration when you push the right stick up, power delivery and motor rotation.
that radio channel can be reversed. After that, all

Step 79: 10.7

7. To perform ESC calibration, hit the calibrate ESC supply, and is marked by long beeping sounds with
button. With the transmitter throttle stick (left) fully the FC LED blinking in read and blue.
pushed up, start your ight controller. Then, after a
while, pull the throttle down. The ESC calibration will After all calibration the beeping sound is gone. If not
complete after the long beeping sound stops. If the then the calibration steps may not be complete.
beeping persists forever, give up the calibration and Follow through all the wizard just to make sure you
restart your quadcopter normally with your throttle at covered all the mandatory calibration and setups.
minimum. Some ESC calibration will be performed Check also if the selected frame type is correct.
every time they are rst connected to the power

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 50
Step 80: 10.8

8. Failsafe Radio communication is a crucial component whose


failure can cause your quadcopter to be gone forever.
It is recommended to set failsafe for the quadcopter Do not use components that can have interference
to land at low board voltage (unless the board with the radio channel frequency and always check
voltage measurement by the FC is not accurate. It is the transmitter voltage and functionality. Safeguard
easier and more convenient to use a BB alarm instead. your quadcopter by setting a failsafe for the radio
The BB alarm is connected to the Li-Po battery to communication by which the quadcopter will Return
trigger an alarm whenever the battery voltage drops to Launch (RTL) whenever the radio communication is
below a speci ed limit. The battery voltage below lost.
which the alarm is triggered can be set easily through
a simple button push that can be found on the BB The quadcopter can only be armed after all the safety
alarm. It is safe to set it at 3.2-3.4V where when either pre-arm checks are completed, which also includes all
one of the cells drops below the threshold, you will be of the above ight calibration steps.
alarmed to land your quadcopter.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 51
Step 81: 11.0 Change the Flight Mode on Mission Planner With Respect to Radio
Transmitter Channel

As aforementioned, the primary channels (channel 1 channel. Each channel is controlled by a switch on the
to 4) are xed for the speci c type of vehicle selected. transmitter. All we need to do is to change the
The Auxiliary channel on the other hand, can be channel’s switch to the speci c switch that we want to
altered according to our needs. Di erent transmitters use to control the speci c channel.
have di erent methods of setting for the auxiliary

Step 82: 11.1

The radio channel setting on your radio transmitter switch position is at Bottom), Flight Mode 4 (when
has to be collaborated with the setting on the Mission switch position is Mid) and Flight Mode 6 (when
Planning, and the actual mode that your quadcopter switch position is at top). Now change on Mission
holds to will be as shown in the Mission Planner (not Planner the by selecting from the drop-down list the
as shown in your Radio transmitter). modes that we want the quadcopter to engage, i.e. for
my case, selecting the modes for ight modes 1, 4 and
To go to the ight mode setting on Mission Planner, 6.
connect your GCS to your quadcopter (through udp
or telemetry), then go to Con guring > Flight Modes. Now try to look at the current mode shown to see the
The ight mode setting in the Mission Planner uses changes as you throw your switch across di erent
xed and default channel 5 from your radio. Our aim positions. In my case, for example, the current mode
here is we want to utilise most out of the 6 ight will change from stabilise (bottom) to Altitude Hold
modes switching o ered by Mission Planner across (Mid) and Loiter (Top).
the PWM range in channel 5.
Need not worry if your radio transmitter only has 2-
Therefore, on your radio transmitter, change the way switches. Use the 2 Flight Modes for the mode
auxiliary channel, Channel 5, to be controlled by a you think is most important for you. I would suggest
suitable 3-way switch (if you have one). Throw your Stabilise (the basic one), and Altitude Hold (Important
switch to di erent positions to test which ight modes if you are not pro at controlling throttle).
that were being engaged at di erent positions. My 3-
way switch at channel 5 engages Flight Mode 1 (when

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 52
Step 83: 11.2

Landing a quadcopter is equally challenging and you may want to include that as well. I would suggest Land mode
to be set from a separate channel so you can leave channel 5 alone for other modes. Simply go to Con guring >
Extended Tuning for the mode settings for other channels

Step 84: 11.3

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 53
Again, match the setting on your radio transmitter The PWM value of the channel at a particular switch
with that on Mission Planner. For example, we rst position is shown below the ight mode. It is not
made sure that we set channel 8 to be controlled by a recommended to use a knob you are con dent
switch (2-way) that we want to use to Land the because it is hard to gauge the position and the
quadcopter, and then on the Mission Planner, I set accurate PWM output.
channel 8 Opt as Land. Land will be a prioritised mode
over all others. This means that if my channel 5 is set Some radio transmitter allow logic control of switches
as stabilise (say with switch C at bottom), and my to control a single channel. This means that 2 switches
channel 8 is set to land (say with switch F on), the can be used to control, say channel 5 for more
quadcopter will go for Land. Always note that the outputs. An example is shown above just for better
actual mode that the quadcopter engages is shown in illustration. This setting can be done on your radio
the Current Mode shown in Con guration > Flight transmitter (if it has this feature) under logic switch
Modes. From there, always test out di erent switching which may be di erent for every transmitter. Spend
of the switches you have set to see if the quadcopter some time to look through how to perform the
really engage the modes that you desire at all times. setting.
As shown in the above diagram, there are 2 more
channels from channel 6 and channel 7 where you
can use to engage other desired ight modes.

Step 85: 11.4

However, it is not recommended to use logic switch that the di erent switches will engage. This helps you
unless you are con dent because it might easily cause to be able to respond immediately to emergency
confusion due to the complexity of switching and can cases such as land the quadcopter or disengage a
be dangerous at times of panic. To be on the safe side, failing mode, than having to gure out which switch
always use a single 3-way switch and make clear labels to control.
on your radio transmitters for the di erent modes

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 54
Step 86: 11.5

Above shows the summary of my switch setting as an example for your reference based on the gure on MP
(extended tuning) above. The 3 fundamental modes that you may consider setting are Land, Stabilise and Altitude
hold.

Step 87: 11.6

Understanding di erent important ight modes

After the ight mode is set on both your transmitter and your Mission Planner (connected to your drone), you will
not require connection to the MP anymore to start the ight, unless you want to monitor your ight. However,
make sure you are clear of the modes you are switching into!

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 55
Step 88: 12.0 Installing a Turn-off Switch to the RPi3

To turn o the Arducopter, a sudo halt command is used to install a turn-o switch for the Raspberry Pi.
required. Similar to a PC, no proper shutting down of Only 3 free GPIOs can be used, that is GPIO 17 (Pin 11),
devices may corrupt the storage in the long run. GPIO18 (Pin 12), and GPIO 26 (Pin 37). The idea is to
Therefore, a switch is installed and the program for write a program that runs on boot in the Raspberry Pi,
the switch operation to turn the device o is being that whenever GPIO 17 (Pin 11), for example, is
executed on start of the RPi. The switch installation shorted to the ground (through a momentary push
details were being discussed in the hardware button switch), the Raspberry Pi will run the
component setup section. command to shut itself down automatically.

The Raspberry Pi starts booting as soon as it receives To add a turn-o button to the Raspberry Pi, simply
power supply from the battery. However, there is follow through the steps in the following link by E TA
slightly more trouble when it comes to shutting it Prim e . It is very straightforward and easy for
down appropriately. everyone.

We all know that appropriate shutdowns of the https://www.youtube.com/watch?v=4nTuzIY0i3k


Raspberry Pi microcomputer can be as important as
shutting down your PCs appropriately. The shutting The RetroPie text le can be downloaded from
down can only be executed after logging into
Raspberry Pi, either through proper connections with https://mega.nz/#!ppdynJjK!eclxScK_XLy0UmSQeyTK5
keyboard or mouse and monitor, or secure shell (SSH) WyzE5QfmQu0DKZp0WPX9Hc
to laptop via PuTTY. Forced shutting down by
unplugging the supply may result in SD card The contents of the RetroPie text le can be opened
corruption in the long run. with notepad or WordPad, and the commands in the
text le are copied one after another, into the
Therefore, one of the free GPIOs of the Raspberry Pi – pi@navio command interface as shown below
that is not used up by the Navio2 Flight controller – is

Step 89: 13.0 Running an Autonomous Mission


Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 56
Please refer to manual ight rst if this is the rst time the map, and then use the left-click to drag the map
you arm your quadcopter. to interactively navigate to any directions. A pop-out
dialogue box will ask if you want to set the current
To test out, rst nd a wide and empty open eld with coordinate of your drone as the Home location (the
little obstructions or trees. Carry with you your laptop point for your drone to take-o ). Press ‘Yes’ to do so.
(Mission Planner), your drone, and all necessary With this the quadcopter icon (your drone’s location)
equipment (such as transmitter, spare propellers, on the map will then merge with the ‘H’ icon (Home
spanner for tightening the motor cap if needed, cable location) on the map.
ties if needed, etc.) to the empty eld. Connect your
telemetry ground and air module to your laptop and With the GPS antenna properly connected to the MCX
to the ight controller respectively. Making sure the connector on the Flight Controller (see component
telemetry connection has been con gured as in the setup), the Google map will load automatically the
section “Connecting to ground control station”, press map where your drone is currently at. Note that the
‘Connect’ on the top right corner after both the home button (‘H’ icon) is loaded as your current
ground and air module has the same solid LED lights drone’s location (quadcopter icon), i.e. the ‘H’ icon
(not ashing). must be coinciding with the quadcopter icon.
Otherwise, press ‘Home location’ as shown above to
On Mission Planner, go to the Flight Mode tab. Use a do so.
mouse to easier navigate through the map. The
mouse scroll wheel can be used to zoom in and out of

https://www.youtube.com/watch?v=9brGgojJEnc&t=99s

Step 90: 13.1

Next, on the map, perform path planning or mission planning by clicking on points (WP) where you want your
drone to follow through as shown below, one WP after another.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 57
Step 91: 13.2

During the path planning, a WayPoint table is automatically generated. The WP table contains the coordinates of
location of each of the selected WP and the commands we want the drone to execute at speci c WPs. Move your
cursor to the line that separates between the map and your table and pull down to enlarge the map with respect to
the table.

Step 92: 13.3

To enable the drone to carry out a complete mission, WP another new WP and set the new last WP
add a WP above the rst WP and change the command to be ‘Land’. An example of the WP table is
command for the new rst WP to be ‘TakeO ’. To add a as shown above.
WP, click on the row below which you want to insert
the WP in sequence, and then press ‘Add below’. WP To delete a WP, click ‘X’ and the entire row will be
will be added below the row, and press the arrow UP deleted.
or DOWN to exchange the sequence of the WP. Move
the ‘TakeO ’ WP to the top. Then, add below the last

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 58
Step 93: 13.4

Make sure that your drone will not hit any objects sure also that the ight path is complete and there is
such as trees, poles and etc. that arise near the path no WPs that is out of the zone. Be very careful in this
planned by avoiding drawing any WP near to them because sometimes WPs that are not desired will
altogether. Set the desired altitude to a suitable value. appear in between and that is shown by yellow lines
It is advisable that the autonomous ight has a extending to other locations, Make sure to delete the
ground clearance of at least 5 metres. Set it higher to wrong WPs before any actions are done.
overcome trees, lampposts and other objects. Make

Step 94: 13.5

On the action panel as shown above, there are 4 button to save the WP table on Mission Planner. After
actions that are important, which are Save, Load, that, press ‘Read’ to send the WP le to the Flight
Read and Write. Any WP tables generated on Mission Controller so that the drone will follow through the
Planner can be saved to your PC as a text le (WP le) path. This requires the drone to be connected with the
so that it can be loaded to the Mission Planner GCS through a telemetry module. After the ‘Read’,
whenever you want to run the same mission. To load a Mission Planner will ask again if you want to set the
saved WP le, press the Load button and direct to Home location (Launch location) to be at the current
where you have saved your WP le and open it. The loaded drone coordinate. Press ‘No’ to maintain the
WP table will be loaded to your Mission Planner. WP le. Perform the read for several times to make
Double check if the loaded mission is really the sure your drone is told what to do.
mission you intend to run. Then, press the Write

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 59
Step 95: 13.6

When ‘Read’ is complete, arm your drone through means your drone is set to move horizontally at a
your transmitter by pushing the left throttle stick (at speed of 4 metre per second. If you are not con dent
zero throttle) fully to the right and hold. Your drone of your GPS accuracy, set the speed to be less than 3
should now be placed as mentioned such that the metre per second.
loaded coordinates coincide with the Home Location
(press the Home Location button to do so if they are The Landing speed is equally important. Land speed
at di erent locations on the map). Your drone will not can be set in the full parameter list by searching and
arm in autonomous mode or land mode. Switch to editing the LAND_SPEED parameter. The landing
stabilise mode rst before you arm. For details on the speed is the vertical nal touch down speed when
switching between di erent ight modes, please refer your drone is about to touch the ground. This value
to the section “change the ight mode on the Mission can be best set to be as low as 10 cm/s. The vertical
Planner”. Immediately after your drone is armed, descend speed (before nal touch down) of your
engage the autonomous mode, and then give a drone is set from WPNAV_SPEED_DN in the full
gentle slight push to the throttle to initiate parameter list. If you are not con dent, or if you have
autonomous mode. The drone will take o barometer sensing errors, set the descend speed to be
automatically to the selected altitude and then begin as low as 10 cm/s as well. Again, this can be easier set
moving to the rst and subsequent WPs. on the extended tuning tab, where ‘Speed Dn’ in the
gure shown below means the quadcopter will
The speed across which your drone will y across the descend at a speed of 1.5 metre/s before reducing to
WPs can be set from the Full Parameter list by its nal touch down speed at your set LAND_SPEED.
searching for and editing the WPNAV_SPEED Remember to hit the ‘Write Params’ button to save
parameter. It is easier done on the Con guring tab > any changes.
Extended Tuning as shown below. The Speed 400.000

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 60
Step 96: 13.7

To disengage the autonomous mode in the mid ight your transmitter, engage it to take back control from
can be challenging. You would not want to do this if auto-mode, it is easier to control in Loiter Mode since
you are new and inexperienced. However, you will still it includes Altitude Hold.
need this when errors occur mid- ight such as the
drone moves too slowly, or you realise you have After the path planning is complete, your drone will
selected a WP that may hit objects, or you did not set land at the last WP and the throttle will automatically
your drone to Land at the last WP or at a suitable spot turn o as soon as it touches the ground. If it doesn’t,
or etc. Do not switch to Land Mode as the drone may pull your throttle fully down and engage stabilise
fall from the sky! Push the throttle up above the mid mode, then disarm your drone manually. Disarm your
throttle level before you switch to Stabilise mode. drone by pushing the throttle stick fully to the left at
Prepare to take control over the throttle to prevent it zero throttle position.
plummeting from the sky. Fly it to safety before you
land your drone. If you have pre-set Loiter mode on

Step 97: 14.0 Manual Flight Control

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 61
Make sure that you have done with all the calibration pushing the throttle stick at zero throttle position
and setup in the previous steps. Make sure also you fully to the right. If this is the rst time you arm your
have set all basic required modes ready on the quadcopter, you are going to make sure that the
transmitter and on Mission Planner such as Stablise, directions of your motor rotation are correct. Arm it
Altitude Hold, and Land. Refer to “Change the ight with your propellers o , and then feel with your nger
mode on mission planner with respect to radio if the direction of rotation of each motor is correct.
transmitter channel” for more details. Otherwise, interchange any 2 connections (bullet
connector) between the speci c ESC and motor. Please
Place your quadcopter on a at ground in a wide open refer to motor setup in the section “Drone Hardware
eld and then plug in the battery. Wait until the long Setup”.
beeping sound stops. Then arm your quadcopter by

Step 98: 14.1

If your quadcopter cannot arm, connect your drone to The pre-arm check’s components can be selectively
the Mission Planner to see what is causing the pre- disabled by going to the Con guring tab > Standard
arm check to trigger. For example, if the compass Params > click the ‘Find’ button and search for arm
o set is too high, you need to re-calibrate your checks. Uncheck ‘All’ and then individually reselect all
magnetometer. Google search the pre-arm check but the faulty components and then press ‘Write
error message followed by the keyword “Ardupilot” Params’ to save. Make sure you do this after making
(eg: Compass o set too high Ardupilot) to look for sure the faulty components will not result in crashes.
methods to resolve the error.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 62
Step 99: 14.2

After your quadcopter is armed, i.e. the motors are Altitude Hold) rst before you pilot your self-built
spinning at minimum speed, push the throttle gently drone. Some drones has built-in Altitude Hold ability,
and slowly up until you see your drone begins to lift, and learning over those drones will not help you
give more thrust to help it lift and rise into the air. At master the skill of controlling the drone’s altitude
your desired altitude, switch to Altitude Hold to manually.
remain the altitude. Switch to Loiter mode if you want
the drone to stay at the current GPS location while You can begin moving your drone horizontally after
maintaining at the same altitude. Your drone should your drone is in the air with suitable amount of
stay at the last altitude when you switch to these ground clearance. Your drone moves by rotating
modes. If it falls or descends, you can still push the around three-axes:
throttle up to control the ight.
1. Rolling to the left and rolling to the right (Please
If you do not wish to use the Altitude Hold mode, refer to the transmitter control diagram)
make sure you are con dent at controlling the
altitude by constantly pushing the throttle stick up 2. Pitching nose down and pitching nose up
when it descends, and push it back down when it
rises, while at the same time controlling the pitch, roll 3. Yawing to the left (anti-clockwise) and yawing to
and yaw of your quadcopter. You are advised to test the right (clockwise)
your pilot skill on a cheaper Chinese drone (without

Step 100: 14.3

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 63
Make sure you always monitor the battery voltage drones rst.
using a BB alarm battery voltage monitor. Land your
quadcopter as soon as the alarm triggers o . The A soon as your quadcopter touches the ground, the
vertical landing speed can be adjusted together with throttle will turn o automatically. If it doesn’t, pull
the descend speed as shown in the section “Running your throttle fully down and engage the stabilise
an autonomous mission”. If you do not want to use the mode, then disarm your drone manually. Disarm your
Land Mode, slowly descend your quadcopter to the drone by pushing the throttle stick fully to the left at
ground by controlling the throttle stick up and down. zero throttle position.
That again, requires a lot of practices to master a
perfect landing. Make sure to try this out on cheaper

Step 101: 15.0 Data Flash Log Analysis

Post- ight analysis tells you everything about your necessary telemetry network con guration as shown
ight ranging from barometer altitude, GPS locations, in the section “Connecting to the Ground Control
satellite reception, battery voltage, attitude Station”.
responses, desired attitude, radio communication,
speed, motor current, to 3D images of the ight path Next, press the data ash log tab as shown above >
and modes. Download DataFlash Log via Mavlink > and then
select the log les of ights (based on accurate time
To load the data ash log from Mission Planner, you and date) that you want analyse > Download selected
should not connect the Mission Planner to your drone les. The downloaded log les will be stored in your
through a radio telemetry. Instead, you will need to PC.
establish udp connection by connecting both (RPi3
and your laptop) to the same LAN and perform

Step 102: 15.1

The downloaded binary log les can be loaded to the Mission Planner for analyses without having to connect to the
drone. Simply press ‘Review a Log’ and then open to load the desired ight data based on recorded time and date.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 64
You will be automatically directed to where the ash logs are stored when you want to review them. Otherwise,
they can be found in

C:\Users\Username\ Mission Planner\logs\QUADROTOR\1

Step 103: 15.2

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 65
Double-click on the selected binary log le to open d. Lng: Longitudinal coordinates throughout the
the ash log. From the ash log, some of the popular ight
and useful parameters in the data ash logs include:
e. Alt: GPS measured altitude
1. Attitude
f. Spd: Speed
a. Desired roll/pitch/yaw: Your intended attitude or
yaw value from radio g. GCrs: Ground Course (Heading of quadcopter)

b. Roll/pitch/yaw: Actual attitude and yaw response 5. IMU


measured by on-board sensors
a. Gyr X/Y/Z: Gyroscope IMU data
2. BARO
b. Acc X/Y/Z: Accelerometer IMU data
a. Alt: Barometer altitude sensing
6. RCIN: Input radio channel value
3. ThO: Output Throttle value
7. RCOUT
4. GPS
a. C1/C2/C3/C4: Motor current for Motor 1 to 4
a. NSats: Number of satellite reception
8. VIBE
b. HDOP: Horizontal Dilution of Precision to tell GPS
accuracy a. Vibe X/Y/Z: Vibration in di erent axes

c. Lat: Latitudinal coordinates throughout the ight

Step 104: 15.3

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 66
Simply check the box of the parameter you want to If you want to save the graph, right-click and ‘save
analsye on the bottom right panel and the respective image as’. Even easier, use a Snipping tool to crop
graph of that parameter will be generated. It is wherever you want to save or copy. The link to
advisable to uncheck unrelated parameters before download Snipping Tool is as follow:
you analyse a new parameter so that the graph’s scale
can be reset suitably. To increase the size of the graph, https://snipping-tool-plus-plus.en.softonic.com/do...
move your cursor to the double dotted lines and then
drag it down to expand the graph. This takes up in It requires Java tools to work: The link to download
turn the space below it. Java is as follows https://www.java.com/en/

Step 105: 15.4

The ight data is useful to nd out reasons behind crashes, malfunctionalities, or inability to carry out speci c
functions. For example, if the quadcopter keeps falling down in the Altitude Hold mode, look at the barometer data
to see if the barometer sensing of altitude is working properly.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 67
Step 106: 15.5

Together with the downloaded binary log les is the KMZ le of the ight. KMZ les can be opened using the
Goggle Earth pro software. Navigate in your PC to C:\Users\Username\ Mission Planner\logs\QUADROTOR\1 and
then open the KMZ le with Google Earth Pro.

From Google Earth Pro, you will be able to analyse your ight in 3D street view,

Step 107: 15.6

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 68
3D street view image can be observed using Google quadcopter has followed through while the
earth pro. Di erent ight paths are di erentiated overlapping purple path is the second lap of auto
based on the switch of ight modes as shown on the mode.
left panel above. The ight paths can be deselected
from the list as shown in the left panel. Unchecked Horizontal distance measurement of the ight path
ight modes will disappear from the 3D map leaving can be done using the ruler tool in the software.
only the checked ight path. From the diagram above,
green path is the rst lap of auto mode ight path the

Step 108: 16.0 Object Avoidance Implementation

APM supports object avoidance in a maximum of 2 digital converter (ADC) pins, connecting as shown in
directions at most. Through the LV-MaxSonar-EZ0 below, the voltage, ground and analog pin from the
high performance sonar by Maxbotix, the quadcopter FC to the sonar. To establish physical connection, the
is able to avoid obstacles up to a range of 6.45 m. This micro-header pin for the 6-pin ADC adopted by
expensive EZ0 sensor is used only for object detection Navio2 had to be purchased online. The header pins
above the quadcopter, to avoid hitting objects when will also t the other ports so long the number of pins
the quadcopter takes o or rises. The connection of matches.
the MaxSonar to Navio2 FC is through the analog to

Step 109: 16.1

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 69
As studied, a 100uF capacitor is added in parallel to software’s “Full Parameter List” tab to enable the
the supply to stabilise the voltage supply during range nder and to specify the direction it will act
times of high current consumption and a 100 against. Range nder orientation is set as 24 for UP
resistor connected in series to adjust the high logical orientation and the range nder pin is set as 5 with
state during idle. Together this con guration brings connection to the pin ADC 3 on Navio2 as shown
about a consistent values of readings from the below. Other required settings in the parameter list
MaxSonar sensor. required are shown. Search for them using the “ nd”
function.
Settings have been made in the Mission Planner

Step 110: 16.2

The real-time sensor data was not shown for all orientations other than down or 25 in the range nder tab in initial
setup, but was shown in the radius radar initiated from the proximity button in the temps menu initiated by Ctrl-F
shortcut key. Note that the 2-Dimensional radar will not show distance when the orientation is set to up, or down.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 70
Step 111: 16.3

After making sure that the sonar was working development by Emlid developers. The limitations
through monitoring from the radar window and include expensive ultrasonic sensors, limitations of
testing out the data with di erent distances, the the modes in which object avoidance can work, and
quadcopter was then safe for ight with obstacle limitation of the directions against which the object
avoidance. The sensor is mounted properly according avoidance system can work.
to the orientation being set, making sure that no
objects from the quadcopter, such as wiring or GPS Shao Fu from https://shaofuhw.github.io/Portfolio/
stand, comes in the pings’ travel path. The quadcopter have come up with a solution of using HC-SR04
is armed and then switched to only either guided or ultrasonic sensor for the implementation of object
altitude hold mode for object avoidance. avoidance in his YouTube channel
https://www.youtube.com/watch?v=kmpxkKq3zNA
Several limitations are underlined in the existing
object avoidance system which is currently still under

Step 112: 16.4

As shown above, ve inexpensive ultrasonic sensors HC-SR04 were used for object detection in the front, right, rear,
left and down direction. Arduino microcontroller acts as the processor for the receiving sensor data and generate
responses accordingly. Arduino Nano was used because of its small size and relatively lighter weight. The Arduino
connections with all sensors were sketched and the complete circuit diagram was drawn.

Step 113: 16.5

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 71
This time, the system was connected to the FC where now the ground module was connected
through the UART serial port. 5V and ground through USB port at the FC, and the air module was
completes the supply circuit to power the Arduino connected to the GCS. Details of this is explained in
Nano, while Transmitter (TX) pin of the FC was the section “Drone Hardware Setup” under the
connected to Receiver (RX) pin of Arduino Nano. telemetry component.
Similarly, RX pin of the FC was connected to TX pin at
the Arduino. The UART port was initially used for the Connection points required were being precisely and
air module of telemetry to enable communication tightly soldered on a copper board. Jumpers were
with the ground module in the GCS. To make way for used to ease out connections and female header pins
the object avoidance system a simple modi cation were soldered on place for the installation of
and an extra component was required so the UART ultrasonic sensors in each direction, as shown below.
port can be spared. Again, capacitors and resistors were added to improve
consistency of each sensor.
The trick is to exchange the ground and air module

Step 114: 16.6

The software of the object avoidance system was built Pitch and roll responses can be realised by sending
with the Arduino Software (IDE). For distance mavlink pakages containing signals to override the
measurement, NewPing library was used to retrieve existing roll and pitch value. From the data ash logs,
raw sensor data directly in centimetre. To improve the input RC channel shows a value nearing 1500 for
overall sensor data consistency, averaged value of 5 both pitch and roll values when the quadcopter is
sensor readings were taken. It was learnt that sonar stable. When the quadcopter pitches nose down, the
outputting zero distance is not uncommon. It value drops below 1500, whereas when pitched up,
happens when the distance of the object is out of the the value rises above 1500 in the pitch channel.
detection range, or when there is a directional Likewise, when the quadcopter tilts to the right, it
uncertainty. To avoid the average values getting rises above 1500, in the roll channel, and vice versa.
a ected by such errors, only average values with at
least 4 non-zero readings are taken, otherwise
discarded.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 72
Step 115: 16.7

This piece of information is vital because the Mavlink messages that were sent from the Arduino microcontroller to
the FC will be the messages to override those values in the respective radio channels. The Arduino software was
coded in a way that the change in roll-pitch values increase when the nearest distance detected reduces.

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 73
Step 116: 16.8

Responses will not be initiated just as soon as the the quadcopter will not be made to tilt to the back
criteria stated in table above is met. Several other even if there is obstacle that appears to ful l the rst
conditions have to be ful lled at the same time to 2 conditions stated.
make sure that responses only take place when
necessary and when the environment allows so. During the upload of sketch on Arduino Nano, TX and
RX pins have to be disconnected from Arduino to the
Firstly, the quadcopter will only begin its object FC. Blinking LEDs on the Arduino signi es certain
avoidance, in any ight modes, when the ‘down’ exchange of information between the 2 components.
ultrasonic sensor shows altitude over a certain For instance, Arduino is coded to receive at its RX pins
heights. This stabilises the ight during takeo s, heartbeat signal from the FC for every passing
where unnecessary tilting can lead to parts of the second. In the other way round, the TX pin of Arduino
quadcopter hitting the ground. Only after making will be sending overriding signal to the FC whenever
sure that the quadcopter has su cient clearance the conditions stated are ful lled for a speci ed set of
from the ground to perform as de ned a pitch or roll, response to be initiated.
object avoidance will take control of the ight.
When all conditions ful l, RC overriding mavlink
Secondly, the object detection distance of a particular message containing new RollOut and PitchOut values
sensor has to be ‘near’ as in lesser in distance than a are sent in a standard UART send function. Because
speci ed value, i.e. 100 cm. ‘Near’ in its context has the program runs in loop, as soon as the obstacle is
been de ned as a non-zero value – in case obstacles distanced from the particular sensor, the response
are too far away – below 100 cm. should stop and return to initialised value of zero
pitch or roll, i.e. at 1500.
Thirdly, distance sensor along the same axis has to
agree upon a response in a way that the direction for Tests for object avoidance were carried out by
response where the quadcopter will act toward must constraining 4 sides of the quadcopter to the PVC
have no obstacles. In other words, if the di erence in rectangular structure built as shown above.
the distance of object at the front sensor and that of
the rear sensor does not exceed a safe speci ed value,

Hi, brilliant tutorial and thanks very much for that. I was wondering if you could help me with
something.

I am trying to upload the arduino sketch. How did you do that? Did you upload the entire .zip file
from github? I haven't been able to include mavlink.h
This is great. It opened my eyes to unforeseen danger and now it's as if I can build an autonomous
drone already, lol. I will follow this guide in my current project. Thanks

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 74
Sorry If I missed it. Could you post a link at top of article of Build videos if avail and flight demo
videos?
Found this, but not sure and only one video
https://www.youtube.com/channel/UCZ9u6rmOrUhoYyASrLzY4LQ
We are working on a project as a group.
How to stream video and look throught the computer when drone is in air?

Find instructable Raspberry pi cctv

Very Cool. I have always wanted to build a drone. Thanks for the reference guide.

Thank You!

wow, the most informative and illustrated instructible I have seen so far. curious to know what
altitude can your quadcopter achieve?? this build would obviously be out of reach for most people
because of cost and electronics knowledge but one can always dream or win a lottery LOL.
gerry
Thank you gersec! I have never tried out the maximum of how far my drone can reach, because I
fear it could go signal lost, and a drone of this size can be dangerous to the community. But
technically it would be as far as the receiver can receive signals from the transmitter.

Costwise I tried to order components online from chinese companies which are cheaper. But we
should not also trust components that are too cheap.
One of the best instructable I've ever seen. All steps to build a drone from scratch. I always wanted
to build one, now I actually can make it happen! Thanks!
Thank you GIFrank!

Unbelieveable. Astounding instructable! You are amazing. Thank you! I'll be following this guide
very soon!
Thank You Jespoir! All the best to you!

Pi in the sky...

Wow! 10 marks out of 10 for the article. Fantastic.


There's a lot to be said for DIY - the satisfaction of producing something from your own efforts, and
the chutzpah of taking it to the flying club and flying what everybody knows is 'yours'. And then,
there's all the experience you get, and the things you learn along the way - which is probably
priceless.
However, talking of price, I find that it is only worth making something if it is unique, and cannot be
found on the market. If a product is available, it is usually cheaper to simply buy it. Compared with
commercially available drones with a similar spec to yours, how did you find the cost of making it?
Is this better than a high end, store bought drone?

Step-by-step Guidance to Build a Drone From Scratch Using Ardupilot APM Navio2 Flight Controller: Page 75

You might also like