Familien Schøler’s blog

Lidt af hvert fra hverdagen hos Michael, Kamilla, Marie og Katrine Schøler

LEGO NXT motor precision measurements

LEGO NXT
LEGO NXT servo motor...

I have done some very simple experiments with the LEGO Mindstorms NXT motors with regards to testing their movement precision. As the NXT-G programming interface lets you control the motors to one degree’s angular accuracy, you might expect the NXT motors to be very precise. Actually they are, depending on what you do with them.

Start by just feeling how the motor works by rotating it freely with your fingers. There is a clear noticable gap where the motor gears offer no resistance. This backlash is roughly a ±2° error contribution. The motor backlash is an important error factor, as it will contribute to the test accuracy for each direction change, start, and stop of the motor.

You can read more about the internal NXT motor structure here.

Test description
I’ve setup a small NXT-G program, capable of logging data to a file with measurements of the motors angular position. The test program (motor-tst.rbt) is setup to perform the following steps:

Rotate the motor 360 degrees, at 75% speed.
Stop the motor.
Sleep 1 second.
Ten degrees loop test begins:
    Rotate the motor 10 degrees, at 75% speed.
    Stop the motor.
    Log the angular position to file.
Repeat the loop 36 times in total.
Sleep 1 second.
five degrees loop test begins:
    Rotate the motor 5 degrees, at 75% speed.
    Stop the motor.
    Log the angular position to file.
Repeat the loop 72 times in total.

So, we would like to see a full rotation, starting and stopping at the exact same spot. Then there should be a small pause, followed by 36 consecutive steps in which the motor moves forwards ten degrees and stops, thus ending at 36 x 10 = 360 degrees, bringing us right back to where we started. Finally, after another small pause, we should see 72 consecutive steps in which the motor moves forwards five degrees and stops, ending at 72 x 5 = 360 degrees, once again taking us full circle back to the origin of the test.

Test results
Here’s the visual result of the entire test:
YouTube-forhåndsvisningsbillede

And here is the collected data from the five degrees loop test:

LEGO NXT motor precision measurements chart...

Test result analysis
Notice in chart A that the visual motor movement is “jacky”. That is, the motor spins forward, then backwards, forwards again, and finally finding rest at the desired position. This zigzag behaviour becomes more apparent when you spin the motor fast for short durations. Notice in the video clip that the full rotation at the start of the test is done flawlessly. In the ten degree loop test the jackyness is quite apparent, and more subtle but still clearly visible in the five degree test. I would presume this behaviour is due to a microstepping algorithm implemented in the NXT brick’s motor controller.

Chart B shows an error bar plot for three runs of collected data from the five degrees loop in or other words the standard deviation of uncertainty for each step in the loop. We can see that the expected error rate increases for each step taken in the test, ending off at rougly ±20°. As can be seen in the video, the motor stops about 10° off target in both the ten and the five degree loop test (ending about 20 degrees off target overall), within the likely/statistical error rate.

Chart C holds the absolute values for the collected error rate increments. That is, as the motor was supposed to be at 5 degrees at loop iteration 1 but actually was at 6 degrees, a 1 degree error rate is observed, and as the motor was supposed to be at 10 degrees at loop iteration 2 but actually only was at 8 degrees, we would also observe a 2 degree error rate and so forth. Note that about ±2° is contributed per loop iteration.

Test conclusion

Further testing needs to be done ofcourse to state anything scientifically valid but for now I am satisfied enough, for my own building projects to come, to conclude that the NXT motors are very precise with regards to long duration runs and increasingly unprecise with regards to short duration runs.

This logically and also intuitively means that you have to sacrifice motor speed (eg. by gearing down) in order to gain motor precision.