of Timer1 is never set when counting
off 20 ms).
Of what’s left over, 600 µs
requires 10 bits and 2,400 µs requires
12 bits, with a range between them
of 1,800 bits. This gives us 10 values
for each “degree” instead of the 40
which was possible using the
processor.
I’ve done this analysis because
the 16-bit counter in Timer1 does
allow for (more than) adequate
control of the servos, but what about
the eight-bit counters of Timer0 and
Timer2?
Going through the same analysis,
we will discover that the PWM ranges
are from six to 24, or 10 degrees per
value — a 100 times loss of
resolution. This makes it sound like an
eight-bit timer with PWMs is
impractical for creating servo control
pulses.
I would say maybe, maybe not. If
your application was to control a
robot arm precisely for assembling a product, I would say
this isn’t the right way to generate the signals. An eight-bit
timer and PWM would be fine for controlling continuous
rotation servos, though. I would think that an eight-bit
timer and PWM would be adequate for controlling the leg
of a spider bot; 18 positions for the leg servos seems very
reasonable for just such an application.
Don’t dismiss anything until you’ve thought it through.
On that note, I want to go back to the two transistor
non-inverting buffers that are used to isolate and voltage-shift the control signals from the Arduino to the servos. I
originally used that circuit because I was using the
SoftwareServo library, and the servo control signals
produced by it are what I would call “positive” — the pulse
produced by this software is in the same orientation as
what’s required by the servo. So, what about the pulses
produced by the TimerOne library code?
What happens if I invert the signals (as I did in
“Application_ 10_-_Two_Servos_Inverted_Timer_Interrupt”
and “Application_ 11_-_Two_Servos_Inverted_PWM
_Output”) and then pass them through a single transistor
inverting buffer like the one in Figure 10, wired as in
Figure 11, and shown in Figure 12?
We get a slightly cheaper version of the circuit that
works just as well. If you were to probe the signals going
into the inverting buffers, however, you’d see the negative
waveform of what was expected.
That’s just about everything there is to know about
powering radio control servos and generating their control
signals.
Just to recap ... electrically, I have given you some
suggestions about powering servos in your application, as
well as buffering the signals from the MCU to the servos to
ensure there are no voltage difference issues. From the
signal generation perspective, there are four different
methods of generating servo control signals, ranging from
ones that are quite intrusive in terms of the processor’s
cycles, to one that is completely invisible to it. Hopefully,
this has been an informative and useful rant.
Now that we’ve mastered how 50 year old technology
works, in my next article I want to look at modern digital
servos and how to interface with them.
If you have any questions or comments, please drop
me a line at myke.predko@mimetics.ca. SV
Figure 12. Servo control circuitry with separate power.
SERVO 05.2015 75
Mimetics' Chief
Roboticist, Myke Predko is the
designer of the Jade Robot,
co-designer of the McGraw-Hill "Sumo-Bot," as well as the
author of 15 books on robotics
and technology. Read his
technology blog on Tumblr
(http://mimeticscanada.
tumblr.com/) and follow him on
Twitter ( https://twitter.com/
mykepredko). Myke lives in
Toronto, Canada with his wife,
daughters, and their geriatric
huskies.