Controlling a Servo
Unlike a DC motor — which runs if you simply
attach a battery to it — a servo motor requires a
particular type of control signal to manage its
direction. All microcontrollers can be used to
control an R/C servo. The basic connection
scheme is shown in Figure 7.
• The microcontroller and servo can share the
same power source, assuming the controller
has an onboard regulator. However, it’s
much better to use a separate source for
the servo. Why? Servos draw a lot of
current when they’re first turned on or in
motion. By using separate sources — a nine
volt battery for the controller, for example,
and a set of four AA cells for the servo —
you avoid messy power line problems.
• When using separate power sources, be
sure to connect the grounds from these
sources together. Otherwise, your servo will
not work properly.
• Only one input/output (I/O) line from a
microcontroller is needed to operate the
servo. You may insert an optional resistor
in-line between the controller and the signal
input of the servo. This helps protect the
microcontroller in case the servo has an
(unlikely) internal electrical problem.
Even if your microcontroller isn’t a speed
demon and has no trouble creating pulses for up
to six or eight servos, you may not want to use it
for that task, freeing precious processing time for
other robot functions. When using many servos,
you can turn to a dedicated servo controller. These are
separate circuit boards that act as a pulse making
coprocessor. Making the electrical connection to your
servos is often as simple as plugging a set of three-pin
headers into a solderless breadboard. Figure 8 shows
attaching two servos to an Arduino Uno microcontroller
board. Note that the servos are powered by their own set
of batteries, and that the negative (ground) connection of
these batteries is shared with the Arduino ground
connection. This is important, or otherwise the servos are
likely to behave erratically — if they operate at all.
You can make servo plug adapters for a solderless
breadboard using the so-called “double long” male pin
headers available at Parallax, Pololu, and other online
sources. These are like standard male pin headers, except
the pins are equally long on both ends (see Figure 9). This
allows for plugging the pins into both a solderless
breadboard and the servo connector.
SERVO 07.2014 61
Figure 8. You can
use a solderless
servos to a
as the Arduino Uno.
Figure 9. Use double-length male headers with standard
.100" spacing between pins to connect R/C servos
to your circuits. Get the kind where you can break off
as many of the pins as you need.