Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

instructables

Arduino Drone With GPS

by elementguy

We set out to build an Arduino-controlled and away with a drone.


stabilized, GPS-enabled first-person-view (FPV)
quadcopter drone with return to home, go to The setup is as follows:
coordinate, and GPS hold functions. We naively
assumed that combining existing Arduino programs In the materials list, parts with no asterisk are
and wiring for a quadcopter without GPS with those required for both goals.
of a GPS transmission system would be relatively
straightforward and that we could quickly move on to Parts with one asterisk are required only for the
more complex programming tasks. However, a unfinished project of a more autonomous quadcopter.
surprising amount had to change in order to mesh
these two projects, and thus we ended up making a Parts with two asterisks are required only for the
more limited quadcopter.
Arduino Drone With GPS: Page 1
more limited quadcopter.
GPS-enabled FPV quadcopter, without any of the
added functionality. Steps common to both projects have no marker after
the title
We have included instructions on how to replicate our
product if you are happy with the more limited Steps only required for the more limited non-
quadcopter. autonomous quadcopter have "(Uno)" after the title.

We have also included all the steps we took on the Steps only required for the in-progress autonomous
way to a more autonomous quadcopter. If you feel quadcopter have "(Mega)" after the title.
comfortable digging deep into Arduino or already
have a lot of Arduino experience and would like to To build the Uno-based quad, follow steps in order,
take our stopping point as a jumping-off point for your skipping any steps with "(Mega)" after the title.
own exploration, then this Instructable is also for you.
To work on the Mega-based quad, follow steps in
This a great project to learn something about building order, skipping any steps with "(Uno)" after the title.
and coding for Arduino no matter how much
experience you have. Also, you will hopefully walk

Step 1: Gather Materials

Arduino Drone With GPS: Page 2


Components : different wiring) ($45)

1) One quadcopter frame (the exact frame likely 11) Two HC-12 wireless transceivers (2x$5 = $10)
doesn't matter) ($15)
12) One MPU- 6050, 6DOF (degree of freedom)
2) Four 2830, 900kV brushless motors (or similar), gyro/accelerometer ($5)
and four mounting accessory packs (4x$6 + 4x$4 =
$40 total) 13) One Turnigy 9x 2.4GHz, 9 channel
transmitter/receiver pair ($70)
3) Four 20A UBEC ESCs (4x$10 = $40 total)
14) Arduino female (stackable) headers ($20)
4) One power distribution board (with XT-60
connection) ($20) 15) LiPo Battery Balance charger (and 12V DC
adapter, not, included) ($20)
5) One 3s, 3000-5000mAh LiPo battery with XT-60
connection (3000mAh corresponds with approx. 20 17) USB A to B male to male adapter cord ($5)
min of flight time) ($25)
17) Duct tape
6) Lots of propellors (these break a lot) ($10)
18) Shrink tubing
7) One Arduino Mega 2560* ($40)
Equipment:
8) One Arduino Uno R3 ($20)
1) A soldering iron
9) A second Arduino Uno R3** ($20)
2) Solder
10) One Arduino Ultimate GPS Shield (you don't
need the shield, but using a different GPS will require 3) Plastic Epoxy

4) Lighter If starting from scratch (but with a soldering iron,


etc...), no FPV system: ~$370
5) Wire stripper
If you already have an RC transmitter/receiver, LiPo
6) A set of Allen wrenches battery charger, and LiPo battery: ~$260

Optional components for real-time FPV (first person Cost of FPV system: $80
view) video transmission:

1) A small FPV camera (this links to the pretty cheap


and bad-quality one we used, you may substitute a
better one) ($20)

2) 5.6GHz video transmitter/receiver pair (832 models


used) ($30)

3) 500mAh, 3s (11.1V) LiPo battery ($7) (we used on


with a banana plug, but we recommend in retrospect
that you use the linked battery, as it has a connector
compatible with the TS832 transmitter, and thus
doesn't require soldering).
Arduino Drone With GPS: Page 3
4) 2 1000mAh 2s (7.4V) LiPo battery, or similar ($5).
Number of mAh not critical as long as it is more than
1000mAh or so. The same statement as above
applies to the plug type for one of the two batteries.
The other will be used to power the monitor, so you'll
have to solder no matter what. Probably best to get
one with a XT-60 plug for this (that is what we did). A
link for that type is here: 1000mAh 2s (7.4V) LiPo
with XT-60 plug

5) LCD monitor (optional) ($15). You could also use


an AV-USB adapter and DVD copying software in
order to view directly on a laptop. This also gives the
option of recording video and photos, rather than just
viewing them realtime.

6) If you've bought batteries with different plugs from


the ones linked, you may need appropriate adapters.
Regardless, get an adaptor corresponding to the plug
for the battery that powers the monitor. Here is where
to get XT-60 adapters

* = only for more advanced project

** = only for more basic project

Costs:

Step 2: Assemble the Frame

This step is fairly straightforward, especially if using picture), so that the drone has a clear front and back.
the same pre-made frame we used. Simply use the Further, make sure that the long part of the bottom
included screws and put the frame together as plate sticks out in between opposite-colored arms.
shown, using an appropriate allen wrench or This becomes important later.
screwdriver for your frame. Make sure that arms of
the same color are adjacent to each other (as in this

Arduino Drone With GPS: Page 4


Arduino Drone With GPS: Page 5
Step 3: Mount Motors and Connect Escs

Now that the frame is assembled, take out the four You should also have four propeller cones with
motors and four mounting accessories. You can use female threads. Set these aside for now.
either screws included in the mounting sets, or
screws left over from the quadcopter frame to screw Now take out your ESCs. One side will have two
the motors and mounts in place. If you buy the wires coming out of it, one red and one black. For
mounts we've linked to, you will receive two extra each of the four ESCs, insert the red wire into the
components, pictured above. We have had good positive connector on the PDB and the black into the
motor performance without these parts, so we left negative. Note that if you use a different PDB, this
them off to reduce weight. step may require soldering. Now connect each of the
three wires coming out of each motor. At this point, it
Once the motors are screwed in place, epoxy the doesn't matter which ESC wire you connect with
power distribution board (PDB) in place on top of the which motor wire (as long as you are connecting all
top plate of the quadcopter frame. Make sure that you the wires of one ESC with the same motor!) You will
orient it such that the battery connector points out in correct any backwards polarity later on. It is not
between differently-colored arms (parallel with one of dangerous if wires are reversed; it only results in the
the long portions of the bottom plate), as in the picture motor spinning backwards.
above.

2
1

1. Motor mounted and ready to go!


2. Motor mounted and ready to go!

Arduino Drone With GPS: Page 6


1

1. Extra components 1. Power distribution boar mounted with the connector between different
colored bars so that it is easy to connect to the battery.

Arduino Drone With GPS: Page 7


Step 4: Prepare Arduino and Shield

A note before you begin pin row labeled 3V, CD, ... RX. Use a wire cutter to
clip off excess length on the pins sticking out the
First, you may choose to solder all the wires together bottom. Place male headers with bent tops in all of
directly. However, we found it invaluable to use pin these stackable headers. These are what you will
headers because they provide a lot of flexibility for solder wires to for the rest of the components.
troubleshooting and adapting the project. What
follows is a description of what we did (and Attach the GPS shield to the top, making sure that
recommend others do). the pins match up with those on the Arduino (Mega or
Uno). Note that if using the Mega, plenty of the
Prepare Arduino and shield Arduino will still be exposed after you put the shield in
place.
Take out your Arduino Mega (or an Uno if doing the
non-autonomous quad), GPS shield, and stackable Place electrical tape on the bottom of the Arduino,
headers. Solder the male end of the stackable covering all of the exposed pin solders, to prevent
headers in place on the GPS shield, in the rows of any short circuit as the Arduino rests on the PDB.
pins parallel to the pre-soldered pins, as shown in the
above image. Also solder in stackable headers on the

1
2

1. These female headers are the parts you will need to solder. Basically, 1. Long ends of the headers are cut
you want the GPS shield to have all of the same input options as an UNO 2. These are also cut.
does. This makes troubleshooting and prototyping so much easier.

Arduino Drone With GPS: Page 8


Step 5: Wire Together Components and Place Battery (Uno)

The schematic above is almost identical to that made using heat-shrink tubing around the solder. You may
by Joop Brooking as we heavily based our design off choose to do either for any of the components,
his. however soldering directly to the gyro is
recommended as it saves space which makes the
*Note that this schematic is assuming a properly small part easier to mount. Using headers is a small
mounted GPS shield, and thus the GPS does not amount more work up front, but provides more
appear in this schematic. flexibility. Soldering wires directly is a more secure
connection long-term, yet means that using that
The schematic above was prepared using Fritzing component on another project is harder. Note that if
software, which is highly recommended especially for you've used headers on the GPS shield, you still
schematics involving Arduino. We mostly made use have a decent amount of flexibility regardless of what
of generic parts which can be edited flexibly, as our you do. Crucially, make sure that the GPS data
parts generally weren't in Fritzing's included part wires in pins 0 and 1 on the GPS are easy to
library. remove and replace.

-Make sure that the switch on the GPS shield is At the end of our project, we were unable to design a
switched to "Direct Write." good method for attaching all of our components to
the frame. Due to the time pressure of our class, our
-Now wire up all the components according to the solutions generally revolved around double sided
above schematic (except for the battery!) (Important foam tape, duct tape, electrical tape, and zip ties. We
note on GPS data wires below). highly recommend that you spend more time
designing stable mounting structures if you plan this
-Note that you've already wired up the ESCs to the to be a longer-term project. With all that said, if you
motors and PDB, so this part of the schematic is just want to make a quick prototype, then feel free to
done. follow in our process. However, make sure that the
gyro is mounted securely. This is the only way the
-Further, note that GPS data (yellow wires) comes out Arduino knows what the quadcopter is doing, so if it
of pins 0 and 1 on the Arduino (not the separate Tx moves in flight you will have issues.
and Rx pins on the GPS). That is because configured
to "Direct Write" (see below), the GPS outputs With everything wired up and in place, take your LiPo
directly to the hardware serial ports on the uno (pins 0 battery and slide it in between the top and bottom
and 1). This is most clearly shown on the second plates of the frame. Make sure that its connector is
picture above of the complete wiring. pointing the same direction as the PDB's connector,
and that they can in fact connect. We used duct tape
-When wiring the RC receiver, refer to the picture to hold the battery in place (velcro tape also works,
above. Observe that the data wires go into the top but is more annoying than duct tape). Duct tape
row, while the Vin and Gnd are on the second and works well because one can easily replace the
third rows, respectively (and on the second-to-farthest battery or remove it for charging. However, you must
column of pins). be sure you tape the battery down TIGHTLY, as if the
battery moves around during flight this could seriously
-To do the wiring for the HC-12 transceiver, RC upset the balance of the drone. Do NOT connect the
receiver, and 5Vout from the PDB to Vin of the battery to the PDB yet.
Arduino we used stackable headers, whereas for the
gyro we soldered the wires directly to the board and

Arduino Drone With GPS: Page 9


1

1. In direct write mode, the GPS sends data


directly to these pins.

1
1

1. The HC12 Transceiver. 1. Data Pins


2. Power

Arduino Drone With GPS: Page 10


Step 6: Wire Together Components and Place Battery (Mega)

The schematic above was prepared using Fritzing do either for any of the components. Using headers is
software, which is highly recommended especially for a small amount more work up front, but provides
schematics involving arduino. We mostly made use of more flexibility. Soldering wires directly is a more
generic parts, as our parts generally weren't in secure connection long-term, yet means that using
Fritzing's included part library. that component on another project is harder. Note
that if you've used headers on the GPS shield, you
-Note that this schematic is assuming a properly still have a decent amount of flexibility regardless of
mounted GPS shield, and thus the GPS does not what you do.
appear in this schematic.
At the end of our project, we were unable to design a
-Flip the switch on your Mega 2560 to "Soft Serial." good method for attaching all of our components to
the frame. Due to the time pressure of our class, our
-Now wire up all the components according to the solutions generally revolved around double sided
above schematic (except for the battery!) foam tape, duct tape, electrical tape, and zip ties. We
highly recommend that you spend more time
-Note that you've already wired up the ESCs to the designing stable mounting structures if you plan this
motors and PDB, so this part of the schematic is to be a longer-term project. With all that said, if you
done. just want to make a quick prototype, the feel free to
follow in our process. However, make sure that the
-The jumper cables from Pin 8 to Rx and Pin 7 to Tx gyro is mounted securely. This is the only way the
are there because (unlike the Uno, for which this Arduino knows what the quadcopter is doing, so if it
shield was made), the mega lacks a universal moves in flight you will have issues.
asynchronous receiver-transmitter (UART) on pins 7
and 8, and thus we have to use hardware serial pins. With everything wired up and in place, take your LiPo
There are more reasons we need hardware serial battery and slide it in between the top and bottom
pins, discussed later on. plates of the frame. Make sure that its connector is
pointing the same direction as the PDB's connector,
-When wiring the RC receiver, refer to the picture and that they can in fact connect. We used duct tape
above. Observe that the data wires go into the top to hold the battery in place (velcro tape also works,
row, while the Vin and Gnd are on the second and but is more annoying than duct tape). Duct tape
third rows, respectively (and on the second-to-farthest works well because one can easily replace the
column of pins). battery or remove it for charging. However, you must
be sure you tape the battery down TIGHTLY, as if the
-To do the wiring for the HC-12 transceiver, RC battery moves around during flight this could seriously
receiver, and 5Vout from the PDB to Vin of the upset the balance of the drone. Do NOT connect the
Arduino we used stackable headers, whereas for the battery to the PDB yet.
gyro we soldered the wires directly and using heat-
shrink tubing around the solder. You may choose to

Arduino Drone With GPS: Page 11


2

1. These are the data pins


2. Power supply.

Arduino Drone With GPS: Page 12


Step 7: Bind Receiver

Take the RC receiver and temporarily connect it to a controller and press the button on the back while it is
5V power supply (either by powering up the Arduino off, as shown above. With the button pressed, turn on
with USB or 9V power, or with a separate power the controller. Now the blinking light on the receiver
supply. Do not connect the LiPo to the Arduino yet). should turn solid. The receiver is bound. Remove the
Take the binding pin that came with the RC receiver binding cable. If you were using a different power
and place it to the BIND pins on the receiver. supply, reconnect the receiver to the 5V out of the
Alternately, short the top and bottom pins in the BIND Arduino.
column as shown in the photo above. A red light
should blink rapidly on the receiver. Now take the

2
1

1. This olive colored wire is shorting the top and bottom pins of the BIND
column.
2. This olive colored wire is shorting the top and bottom pins of the BIND
column.

Arduino Drone With GPS: Page 13


Step 8: (Optional) Wire Together and Mount the FPV Camera System.

First, solder together the XT-60 adapter with the Finally, wire up your other 1000mAh battery with the
power and ground wires on the monitor. These may DC out wire that came with your receiver, and in turn
vary from monitor to monitor, but the power will plug that into the DC in port on your receiver. Finally,
almost always be red, the ground almost always connect the black end of the AVin cable that came
black. Now insert the adapter with soldered wires into with your receiver to the AVin port on your receiver,
your 1000mAh LiPo with the XT-60 plug. The monitor and the other (yellow, female) end to the yellow male
should turn on with (usually) blue background. That's end of the AVin cable of your monitor.
the hardest step!
At this point, you should be able to see a camera
Now screw on the antennas on your receiver and view on the monitor. If you cannot, make sure that the
transmitter. receiver and transmitter are both on (you should see
numbers on their small screens) and that they are on
Connect up your small 500mAh Lipo to the the same channel (we used channel 11 for both and
transmitter. The rightmost pin (right below the had good success). Further, you may need to change
antenna) is ground (V_) of the battery, the next pin to the channel on the monitor.
the left is V+. They come the three wires that go to
the camera. Your camera should come with a three-in Mount the components on the frame.
one plug that fits into the transmitter. Make sure you
have the yellow data wire in the middle. If you used Once you have the setup working, unplug the
the batteries we linked to with plugs meant for this, batteries until you are ready to fly.
this step shouldn't require any soldering.

Arduino Drone With GPS: Page 14


Step 9: Set Up GPS Data Reception

Wire up your second Arduino with your second HC- receiving GPS sentences if your GPS shield is
12 transceiver as show in the above schematic, powered and properly wired to the other HC-12
keeping in mind that the setup will only be powered transceiver (and if the switch on the shield is on
as displayed if plugged into a computer. Download "Direct Write").
the provided transceiver code, open your serial
monitor to 9600 baud. With the Mega, make sure the switch is on "Soft
Serial."
If using the more basic setup, you should begin

Arduino Drone With GPS: Page 15


Download
http://www.instructables.com/ORIG/FC0/G96F/JGGTGFHF/FC0G96FJGGTGFHF.ino

Step 10: Perform Setup Code (Uno)

This code is identical to that used by Joop Brokking in same hardware port that the device uses to
his Arduino quadcopter tutorial, and he deserves all communicate with the computer, so it must be free.
the credit for its writing.
If the code skips through a bunch of steps all at once,
With the battery disconnected, use the USB cord to check that your GPS switch is on "Direct Write."
connect your computer to the Arduino, and upload the
attached Setup Code. Turn on your RC transmitter. If no receiver is detected, make sure that there is a
Open your serial monitor to 57600 baud and follow solid (but dim) red light on your receiver when the
the prompts. transmitter is on. If so, check the wiring.

Common errors: If no gyro is detected, this could be because the gyro


is damaged or if you have a different type of gyro
If the code fails to upload, make sure that pins 0 and from that which the code is designed to write to.
1 are unplugged on the UNO/GPS shield. This is the
Download
http://www.instructables.com/ORIG/FQR/6TWE/JGGTGFQ7/FQR6TWEJGGTGFQ7.ino

Arduino Drone With GPS: Page 16


Step 11: Perform Setup Code (Mega)

This code is identical to that used by Joop Brokking in With the battery disconnected, use the USB cord to
his Arduino quadcopter tutorial, and he deserves all connect your computer to the Arduino, and upload the
the credit for its writing. We simply adapted the wiring attached Setup Code. Open your serial monitor to
for the Mega so that the receiver inputs corresponded 57600 baud and follow the prompts.
to the correct Pin Change Interrupt pins.

Download
http://www.instructables.com/ORIG/FCY/3FL1/JGGTGOJ5/FCY3FL1JGGTGOJ5.ino

Step 12: Calibrate the ESCs (Uno)

Once again, this code is identical to Joop Brokking's its firmware). Push the throttle all the way down. The
code. All the modifications were made in an effort to ESCs should emit lower beeps, then fall silent.
integrate the GPS and Arduino and can be found later Unplug the battery.
on, in the description of construction of the more
advanced quadcopter. Optionally, you can at this point use the cones that
came with your motor mounting accessory packs to
Upload the attached ESC calibration code. On the tightly screw on propellors. Then enter the numbers 1
serial monitor, write the letter 'r' and hit return. You - 4 on the serial monitor to power up motors 1 - 4
should begin to see realtime RC controller values respectively, at the lowest power. The program will
listed. Verify that they vary from 1000 to 2000 on the register the amount of shaking due to imbalance of
extremes of throttle, roll, pitch, and yaw. Then write 'a' the props. You can try to remedy this by adding small
and hit return. Let the gyro calibration go, and then amounts of scotch tape to one side or the other of the
verify that the gyro registers motion of the quad. Now props. We found we could get fine flight without this
uplug the arduino from the computer, push the throttle step, but perhaps slightly less efficiently and more
all the way up on the controller, and connect the loudly than had we balanced the props.
battery. The ESCs should cycle different beep tons
(but this may be different depending on the ESC and
Download
http://www.instructables.com/ORIG/FDC/ZXW3/JGCJ14EM/FDCZXW3JGCJ14EM.ino

Arduino Drone With GPS: Page 17


Step 13: Calibrate ESCs (Mega)

This code is very similar to Brokking's code, however The changes that we made to this code were to
we adapted it (and corresponding wiring) to work with switch from using PORTD for the ESC pins to using
the Mega. PORTA and then changing the bytes written to these
ports so that we activate the proper pins as shown in
Upload the attached ESC calibration code. On the the wiring schematic. This change is because the
serial monitor, write the letter 'r' and hit return. You PORTD register pins aren't in the same location on
should begin to see realtime RC controller values the Mega as they are in the Uno. We haven't been
listed. Verify that they vary from 1000 to 2000 on the able to fully test this code as we were working with an
extremes of throttle, roll, pitch, and yaw. old off-brand Mega that our school's shop had. This
meant that for some reason not all of the PORTA
Then write 'a' and hit return. Let the gyro calibration register pins were able to activate the ESCs properly.
go, and then verify that the gyro registers motion of We also had trouble with using the or equals operator
the quad. (|=) in some of our test code. We are unsure as to
why this was causing problems when writing the
Now uplug the arduino from the computer, push the bytes to set the ESC pin voltages, so we modified
throttle all the way up on the controller, and connect Brooking's code as little as possible. We think that
the battery. The ESCs should emit three low beeps this code is very close to functional, but your mileage
followed by a high beep (but this may be different may vary.
depending on the ESC and its firmware). Push the
throttle all the way down. Unplug the battery.
Download
http://www.instructables.com/ORIG/FZJ/V618/JGGTGPOH/FZJV618JGGTGPOH.ino

Step 14: Get Airborne!! (Uno)

And again, this third bit of genius code is the work of transceiver code onto your terrestrial Arduino, open
Joop Brokking. Alterations to all these three pieces of your serial monitor to 9600 baud and watch the GPS
code are present only in our attempted integration of data roll in.
the GPS data into the Arduino.
Now you are ready to fly. Push throttle down and yaw
With your propellors firmly mounted onto the frame left to arm the quadcopter, then gently bring up the
and all components strapped, taped, or otherwise throttle to hover. Begin by flying low to the ground
mounted on, load on the flight controller code to your and over soft surfaces like grass until you become
Arduino, then unplug the Arduino from your computer. comfortable.

Take your quadcopter outside, plug in the battery and See the imbedded video of us excitedly flying the
turn on your transmitter. Optionally, bring along a drone the first time we were able to get the drone and
laptop connected to your GPS receiving setup as well GPS working simultaneously.
as your video receiving setup and monitor. Load the

https://youtu.be/QvsWxHCsN3M

Arduino Drone With GPS: Page 18


http://www.instructables.com/ORIG/FH3/J20K/JGCJ5IRR/FH3J20KJGCJ5IRR.ino
… Download

Step 15: Get Airborne!! (Mega)

Due to our hangup with the ESC calibration code for this step. You will first need to go through and replace
the Mega, we were never able to create flight all instances of PORTD with PORTA. Also, don't
controller code for this board. If you have gotten to forget to change DDRD to DDRA. Then, you will
this point, then I imagine that you have at least fiddled need to change all of the bytes being written to the
with the ESC calibration code to make it work for the PORTA register so that they activate the proper pins.
Mega. Therefore, you will likely have to make similar To do this, use the byte B11000011 to set the pins to
modifications to the flight controller code as you made high and B00111100 to set the pins to low. Good
in the last step. If our ESC calibration code for the Luck, and please let us know if you successfully fly
Mega magically works without any other using a Mega!
modifications, then there are only a few things you
will have to do to the stock code to make it work for

Step 16: How We Got to Where We Currently Are With the Mega Design

Arduino Drone With GPS: Page 19


This project was an immense learning experience for different. Pins on the Uno which have interrupts are
us as Arduino and electronics hobby beginners. different on the Mega. Similarly, the SDA and SCL
Therefore, we though we would include the saga of pins were in different locations. After studying the pin
everything that we encountered while trying to GPS diagrams for each type of Arduino, and refrencing the
enable Joop Brokking's code. Because Brokking's registers called in the code, we were able to run the
code is so thorough and much more complicated than flight setup code with only minimal re-wiring and no
anything that we were writing, we decided to modify it software changes.
as little as possible. We tried to get the GPS shield to
send data to the Arduino and then have the Arduino The ESC calibration code is where we started to run
send that information to us via the HC12 transceiver into problems. We touched on this briefly before, but
without modifying the flight code or wiring in any way. basically the code uses pin registers to regulate the
After looking at the schematics and wiring of our pins used to control the ESCs. This makes the code
Arduino Uno to figure out what pins were available, harder to read than using the standard pinMode()
we changed the GPS transceiver code that we were function; however, it makes the code run faster and
using to work around the existing design. Then we activate pins simultaneously. This is important
tested it to make sure everything worked. At this because the flight code runs in a carefully timed loop.
point, things seemed promising. Because of the pin differences between the Arduinos,
we decided to use port register A on the Mega.
The next step was to integrate the code that we had However, in our testing, not all of the pins gave us the
just modified and tested with Brokking's flight same output voltage when told to run high. Some of
controller. This wasn't too difficult, but we quickly ran the pins had an output of around 4.90V and others
into an error. Brokking's flight controller relies on the gave us closer to 4.95V. Apparently the ESC's that
Arduino Wire and EEPROM libraries while our GPS we have are somewhat finicky, and so they would
code was using both the Software Serial library and only operate properly when we used the pins with the
Arduino GPS library. Because the Wire Library higher voltage. This then forced us to change the
references the Software Serial library, we ran into an bytes we wrote to register A so that we were talking
error where the code wouldn't compile because there to the correct pins. There is more info about this in the
were "multiple definitions for _vector 3_", whatever ESC calibration section.
that means. After looking on Google and digging
around in the libraries, we eventually realized that this
This is about as far as we got in this part of the
library conflict made it impossible to use these pieces project. When we went to test this modified ESC
of code together. So, we went searching for calibration code, something shorted and we lost
alternatives. communication with our Arduino. We were extremely
puzzled by this because we hadn't changed any of
What we figured out is that the only combination of the wiring. This forced us to step back and realize
libraries that didn't throw error at us were switching that we only had a couple of days to get a flying
the standard GPS library to neoGPS and then using drone after weeks of trying to fit our incompatible
AltSoftSerial instead of Software Serial. This pieces together. This is why we backtracked and
combination worked, however, AltSoftSerial can only created the simpler project with the Uno. However,
operate with specific pins, which were not available in we still think that our approach is close to working
our design. This is what lead us to using the Mega. with the Mega with little more time.
Arduino Megas have multiple hardware serial ports,
which meant that we could bypass this library conflict Our goal is that this explanation of the hurdles we
by not needing to open software serial ports at all. encountered is helpful to you if you are working on
modifying Brokking's code. We also never got the
However, when we started using the Mega, we chance to try coding any autonomous control features
quickly realized that the pin configuration was based on the GPS. This is something you will need to

figure out after creating a working drone with a Mega.


However, from some preliminary Google research it
Arduino Drone With GPS: Page 20
looks like implementing a Kalman filter may be the
most stable and accurate way to determine position in
flight. We suggest that you research a little about how
this algorithm optimizes state estimations. Other than
that, good luck and let us know if you get further than
we were able to!

That's a great looking drone! I'd love to see a video of it flying.

Thanks! I just added a video of us the first time we got the drone and GPS working simultaneously.
It is in the step "Get Airborne! (Uno)" if you care to view it.

Arduino Drone With GPS: Page 21

You might also like