Our resident expert on all things
robotic is merely an email away.
Tap into the sum of allhumanknowledge and get your questions answered here!
From software algorithms to material selection, Mr. Roboto strives to meet you
where you are — and what more would you expect from a complex service droid?
It’s August already! Big robot competitions are coming
up and darn, I’m behind schedule again, sigh. Does anyone
have any truly useful time-saving suggestions to help us all
be more robotically productive? If you do, send me some
and I’ll publish them! This month I have questions and
some user help for a reader whose letter we published
back in May. Let’s start with that ...
Sam Browman asked if I could help him figure out
how to use some surplus servos that he’d found. I told
him he had some work to do to find out how to interpret
the servo’s shaft encoder. Mark Lewus sent me some
information that could help Sam, as it seems Mark has
some experience in this area.
Q. First, let me say “great job!” I am a professional engineer and I play with robots on the side. I really enjoy your column and I learn something useful
every month. I am writing about the question that Sam
Browman submitted and which you answered in the May
2009 issue, about a mystery motor/encoder. I have some
professional experience with this sort of device and I have
some information that you may wish to forward to him.
What Sam has — as you noted — is not a servo but only
a servo motor. Surplus units usually consist of a brushed DC
motor and a quadrature encoder (most new servomotors
are electronically commutated, a.k.a., “brushless”).
Sometimes the encoder also has a home (0 degree position) sensor, sometimes not, for use in absolute positioning
applications. These motors are designed for use with a
dedicated servo controller that contains an H-bridge to drive
the motor, and logic (microcontroller or FPGA/ASIC) to
receive position and speed commands, and carry them out
by reading the motor’s encoder and applying a PWM signal
to the H-bridge. This drives the motor in the correct
direction at the correct rate. If Sam Googles “servomotor
controller,” “quadrature encoder,” “H-bridge,” and “PID
loop” he will come up with a lot of information on this type
of device. The
Microchip.com site also has a lot of useful
info about building a servo controller from scratch, since
some of the 24 and 33 series micros are designed
specifically for motor control. A five wire device is going to
be a digital quadrature encoder rather than a tachometer.
The encoders are usually wired as follows:
•Red: V+, usually + 5 but sometimes up to + 24. Most
will run at 5V.
•Black: Logic Ground.
•Green: Motor Frame Ground (usually).
•Yellow/White: Digital outputs for phase A and phase
B (no way to tell which is which without testing). Phase A
and B are identical except they are 90 degrees out of phase
with each other.
Quadrature encoders usually include all necessary
debouncing and provide a clean square wave logic level
output. When phase A leads phase B, the motor is (usually)
turning clockwise as viewed from the front. When phase A
lags (follows) phase B, the motor is turning the opposite
direction. So, the phase is used to determine motor
direction. Motor speed is determined by integrating one
phase output (counting pulses over time). Relative (change
in) position is determined by counting phase pulses —
adding when A leads B and subtracting when B leads A.
In some cases, absolute motor position can be determined
if there is a “home,” or 0 degree sensor. When the home
sensor is activated, the position is reset to zero and you
count from there. More often the home sensor is not on
the motor but on the driven wheel or pulley.
Sam will have to determine the resolution of the
encoder, that is, pulses per revolution. This can vary from
very low, say 16 pulses per revolution, to very high, say
2,048 or more. There is no standard, though the number
(if any) marked on the encoder may give it away. He can
disassemble the encoder and count the slits (optical) or
protrusions (magnetic) on the encoder disc if it is low
resolution. High resolution slit discs cannot be counted
by eye. In that case, he is probably better off using a
microcontroller to do the counting as he manually rotates
the motor shaft through approx. 100 revolutions and then
divides the total count by 100. This evens out any errors in
SERVO 08.2009 13