Unmanned aerial vehicles are a fun way to
explore three-dimensional robotics.
2 inputs, and an ATtiny microprocessor (the little
brother of the ATmega chip at the heart of Arduino),
which reads the output from one R/C channel that
serves as the autopilot control channel and controls
the multiplexer. When you toggle up one of the
switches on your R/C transmitter, the circuit transfers the servos plugged into ArduPilot from R/C to
computer control, and back again when you flick the
switch down. This circuit can also read intermediate
positions if you have a dial on your R/C transmitter,
and ArduPilot can assign those positions to other
modes like computer-assisted flight, which stabilizes the plane under manual control.
There are two main functions to an autopilot: stabilization (keep the plane flying level) and navigation
(fly to designated waypoints or “loiter” by circling
Stabilization is a classic control systems task,
involving PID (proportional, integral, and derivative)
loops, which have to be tuned for each aircraft, and
sensors (gyros, accelerometers, or infrared horizon
sensors) that are each imperfect in their own way.
Although the board is normally powered by the
R/C system at the standard 5V, we also added a
standalone power regulator for people who want
to power it independently with its own battery.
Navigation is a bit easier, since you have absolute
GPS data to steer by rather than sometimes uncertain orientation data, but to go efficiently from point
A to B when the plane is being pushed sideways by
the wind requires clever algorithms, too.
That’s pretty much it for the new hardware elements. Jordi laid out the board to be super small
(about the size of a 9V battery) and routed the wires
to minimize their length to avoid noise. With the help
of Nathan Seidle at SparkFun Electronics, we turned
unused parts of the board into “ground planes,”
extending the copper traces into large areas that
help reduce RF noise.
Initially, ArduPilot began as a GPS navigation-only
autopilot, requiring a standalone commercial stabilization system such as the FMA Direct Co-Pilot to
handle wing leveling. It also worked for 2D projects
such as cars or boats that don’t need stabilization;
indeed, it was used by several of the autonomous
rovers that competed in this year’s SparkFun
Autonomous Vehicle Competition.
Now it was time to make the boards. For prototypes, the usual way is to send the PCB design files
(we used the free CadSoft EAGLE program) to a fab.
We used BatchPCB, SparkFun’s own service. When
we got the boards back, we hand-soldered the chips
(they’re surface mount, so it was a fiddly process
and we messed up one or two boards) and went
through revisions until it worked the way we wanted.
We then upgraded ArduPilot with version 2.0
to handle the stabilization function itself, using
special arrays of IR sensors called “thermopiles” that
detect the differential in heat signature between
the earth and the sky. Infrared stabilization is easier
and cheaper than using a full array of at least 3
gyroscopes and 3 accelerometers, as are used in
the inertial measurement unit (IMU) in higher-end
autopilots (we’ll move to that with a future version
Then we gave the green light for SparkFun to
manufacture them, which in practice means that
their pick-and-place robot puts the chips precisely
on the boards and they’re soldered in a reflow oven.
Modern GPS modules give pretty good altitude
data (plus or minus a few meters, if you average
the data to remove outlier glitches), but to properly
control a UAV in the wind you need more than
the speed-over-ground velocity data that a GPS
What’s far more important is airspeed, and the
only good way to calculate that is with a differential
pressure sensor, which is really a pair of sensors:
one is attached to a pitot tube in the nose or wing of
the aircraft where air is forced into it by the forward
motion of the plane, while the other measures
ambient pressure in the cockpit.
In testing ArduPilot with a powered glider (the
Multiplex EasyStar) we realized that without an
Photography by Jon Snyder
Writing the Software
One of the deceptive things about autopilots is that
they look like a hardware project. After all, what
more do you need to do than read some sensors
and a GPS module and move servos to keep the
plane flying level and on target? But as anyone who
has tried it quickly discovers, the hardware is the
easiest part of an autopilot. The software is where
the real challenge lies.
48 Make: Volume 19