distance to the target using the distanceBetween method in
TinyGPS++. If we are within the specified drop_tolerance,
we’ll toggle the gripper and shut down.
Our work is done. If there isn’t a complete GPS
message yet or we weren’t within range of the target, we’ll
check on the button to see if the user is requesting the
gripper state be toggled to load/unload the payload. In this
case, I used a very simple and naïve debounce; if the
button is pressed, we wait a bit. If it’s still pressed, we wait
until it’s not and then toggle the gripper. Again, it’s not the
best practice, but a decent handling for a
My initial cut at the firmware used the
software serial library to get debug and GPS
serial ports at the same time. Sadly, while
software serial is receiving GPS data, the
PWM to the servo drops and the gripper
quivers. Using a processor with two
hardware UARTs like the ATmega1284p on
the Wildfire would easily get around this,
but after a quick test of the GPS distance
calculation, I didn’t think simultaneous
debug was necessary on such a simple
You’ll find a GPS test application
(Figure 9), distance display (Figure 10),
and the flight firmware in the project
/drone_gripper) and article downloads.
That’s about all there is to the
firmware. It’s really a pretty straightforward application with
lots of helpers from other libraries!
Once everything was set up, I pulled up Google Earth
and found the coordinates of a corner in my neighborhood
(Figure 11). I plugged it into the sketch, uploaded, and
went for a stroll. I loaded a simple debug sketch that shows
the distance to the target (note that it requires
programming, then connecting the GPS to a software serial
receive pin). I hooked my laptop up to the circuit and
moved to the car.
After verifying reasonable distance estimates, I loaded
the flight sketch, reconnected the GPS to the primary serial
receive pin, and drove around the block. Right at the
corner, the gripper activated! I found a tolerance of 10
meters worked well and was an area I thought I could
estimate while flying around as well.
Next, mount the gripper and circuit on your quad and
see how good your estimation skills are. With some
practice, you can get close to the drop area and fly around
a bit, letting the GPS trigger do the precise targeting for
Now that you have an auto-triggered gripper, it’s finally
time to start that automated hot wing delivery service
you’ve always dreamed of. Okay, maybe we’re not quite
there yet, but I’m planning on continuing to explore how to
automate drone actions based on position, or maybe even
ground based cues like visual markers.
Until next month, fly safely. SV
Figure 11: Google Earth provides an easy way to get coordinates for a point. Make
sure you change the display to decimal degrees in the application preferences.
SERVO 01.2018 15
The Multi-Rotor Hobbyist
Figure 10: The final test sketch lets us make sure that we are
using the distance calculation method properly, and makes sure
we didn’t make a mistake when typing in the coordinates.