The Brick Bakery: Analysis of Motor Speeds for Geared Motors.
I was having a boring evening - so I decided to test some theories
about Lego motors - and at the risk of seeming pedantic - here are
Myths and Legends?
Several times, people on the Lego Robotics mailing list
have asked why their robots don't
drive in a straight line - the three most frequently given explanations
All three explanations sound quite plausible but I was interested
to see the magnitude of each effect.
- Mismatched motors - some motors spin at different speeds
than others because of age, manufacturing tolerances, etc.
- That all electric motors are somehow 'tuned' to run
forwards - and hence run slower in reverse. In most simple
robots, one motor is running 'forwards' and the other in
'reverse' - this may be done in the RCX software or by plugging
the cable on backwards on one of the motors - the effect is the
- Build technique - it's easy to have Lego wheels, gears or
'collars' more or less tightly held against a stationary
part of the robot structure. If one gear train is 'tight'
and the other is 'loose' then the robot won't drive straight.
The Experimental Setup:
I hooked up a rotation sensor directly to the output shaft of a motor and
wrote a little RCX program to run the motor forwards and backwards
for 10 seconds each - many times, displaying the rotation sensor
count on the LCD each time. My
accompanying document shows that the sensor is quite accurate
for 'normal' motor speeds - so this is a good test. Attaching the
sensor directly to the motor output gives an almost completely
'unloaded' test - you could probably do better with an interrupter
wheel and a light sensor which would add no load at all - but this
is quite good enough for our purposes.
I tested all nine of my motors (they are all the modern 'geared' motors
such as come with the Mindstorms sets). These motors vary in
age between 3 months and a year - and although it's impossible to say
which ones have had the most usage over that time, it's probably reasonable
to say that these represent a 'typical' set of motors such as most people
I tested the motors first in the order 1,2,3,4,5,6,7,8,9, then
again in the order 9,8,7,6,5,4,3,2,1 just to ensure that the
batteries on my RCX weren't gradually going flat over the duration
of the test and thereby favoring the first motor over the last.
The results varied a little from the first run of a motor to the
second run of the same motor - and if I keep running the test with
the same motor, I can see that the experimental error is in the
region of 2% - even between consecutive runs in the same direction
with the same motor and with new batteries in the RCX for each run.
All of the motors seem to rotate at about 800 rotation sensor 'clicks'
per 10 seconds which is 5 revs per second - or 300 RPM.
How well matched are the motors?
The worst motor out of the nine managed only 788 clicks in 10 seconds
and the best did 891. That's an 11% difference. (295 RPM versus
334 RPM) - presumably with a larger set of motors to test, including
some really old worn out/corroded ones and some really new ones - we'd
find greater variation even than that - so 11% is really the best
you can expect and your motors may show still larger variation.
Forward versus Reverse?
"Forwards" is defined here as the result of an "OnFwd" command
with the cable connected with it's "tail" pointing away from
the IR window on the RCX and running along the slot in the top of the
motor at the other end. Reversing the cable drives the motor in
The theory that motors are optimised for the forward direction does
appear to be true - most motors ran slightly slower in reverse
than forwards - but generally only by 1 or 2% - which is less
than the experimental error...but I didn't find any motor that
ever ran faster 'backwards' than 'forwards' when averaged over
5 runs. We may also deduce that the wiring arrangement that I
used is indeed the one that was intended to make the motor run
in the 'preferred' direction when you tell the RCX to make it
Strange 'memory' Effects.
On a series of five
10 second runs, nearly every motor ran slightly faster on the first
of the five runs than on the last. You might say that was due to the
batteries being flatter after that time - but I checked that - and
motors had the same average speed on the second series of tests
with the same set of batteries as on the first - providing I
left everything switched off for a couple of minutes between
each series of tests.
There are two possibilities that I could think of - the most likely
being that the motor had time to cool off between runs and that the
friction is somehow higher in a warm motor than in a cool one.
The other possibility (remote - I think) is that there is a
known effect in some kinds of battery where the available current
drops a few seconds after you start draining it and recovers
if you leave it turned off for a while. You can see this with
a flashlight that has nearly flat batteries - you turn it on
and the bulb glows for a few seconds and then slowly goes out -
if you turn off the flashlight, wait 30 seconds and then turn
it on again, the bulb glows again for a few seconds before
dying. I think that's a long-shot.
Running under Load?
I did some other tests with the motors connected to a long, complex
gear chain to provide some loading. This reduced their speed to
about a quarter of the unloaded speed - but all the variations I saw
in the unloaded case seemed to hold true when the motors were loaded.
The motors that were fastest when not loaded were still fastest
while driving the gear train - motors that had noticable forward/reverse
bias retained that same bias, etc.
I dismantled the chain of a dozen or so gearwheels that I used in
the load experiment - then reassembled it with exactly the same
parts in the same order. I wanted to see if differences in how
tightly I clamped the axles and how accurately the gears were
aligned would make much difference. I tried not to vary the
tightness of fit from one build to another and to build 'nicely'
with none of the axles pinching the beams or anything like that.
I was very suprised to see about an 8% variation between
the two builds even though I'd taken as much care as I could to
build them identically.
This means that even if you carefully measure the performance of
your motors to ensure that you pick two very similar ones - then
ensure that the robot is designed to make them both run forwards -
the mere fact that the two geartrains were assembled differently
means that you could see an 8% variation in performance!
Voltage drop along a Lego Cable?
I also tried connecting up all the Lego cables I own (a length of about
10 feet with about 20 connections along the way) to see if the voltage
drop would be noticable - and I saw about a 1% drop in speed with a couple
of quick tests...nothing terribly significant.
So - the conclusion is that almost certainly, the reason robots
don't go straight is PRIMARILY that Lego motors don't all go at
the same speed - and you can expect at least an 11% variation in speed
because of that. The forwards versus reverse thing is also
a true statement - but it's *FAR* less significant because it
only affects the speed by about 1% in most motors.
Most suprising though is that
even if you are quite careful, differences in your build technique
(how tightly you clamp the axles, etc) can easily make up for an 8%
difference in performance between the left and right drive chains
of your robot. That huge variation alone is enough to doom efforts
to make something go in a straight line without some kind of measurement
device. Keeping the drive train simple is probably your best
defence against this problem. The fewer gearing stages you have, the
fewer sources of variation there are.
We can also say that the speed of motors varies by maybe 1 or 2%
over time for who knows what reasons ... temperature, phase-of-
the-moon, colour of robot? Cable length doesn't matter much.
However, one myth we can debunk is that the direction the motors
run in is super-critical. The 1% to 2% variation due to this
effect is really irrelevent compared to build variations and
Someone should probably test a bunch of 9volt ungeared Lego motors
and some micro-motors to see if the principles outlined here hold
for them also. I don't own any of the ungeared motors so I can't
test them. Micro-motors are pretty unsuitable to driving robots
anyway - so I don't personally think it's really worth the effort
to test them.
It would also be interesting to know the force required to stall
various motors in the forward and reverse directions and to graph
the speed versus torque curve for a collection of motors.
RETURN TO TOP
Steve Baker <firstname.lastname@example.org>