What is a Lego Motor?

From ROBOTC API Guide
Jump to: navigation, search

What is a Lego Motor?

A Lego motor is a continuous rotation servo that is packaged with an encoder and pre-wired to a NXT Lego jack. Under normal circumstances, the motor would connect to an NXT brick through an NXT connector wire.

The LEGO motor
The motor's back

At the most basic level, a servo is just a controllable motor. There are various types of servos: The Standard Servo is a geared down motor that has a limited range of rotation. These servos use internal electronics to identify the current angle of the motor, and using an input signal, are told what position is desired. The electronics then do some calculations and will make the motor spin one way or the other, to get to the desired position. This is not the kind of servo a Lego motor is. The Lego motor is a Continuous Rotation Servo, which translates the same signals as a standard servo into a speed instead of a position.

Most servos use a form of PWM to receive the desired position from some controller. This is accomplished by having a PWM signal with a period of 20ms. The receiving servo interprets the signal's duty-cycle (i.e. the percentage of the time the power is on during each 20ms repetition of the signal) and converts it into data. There are some variations for maximum and minimum pulse durations (the length of the burst of power in each repetition of the signal) among the servos. However, all servos will position the servo output at the mid-point of its range of motion, when the pulse received is 1.5ms. Most servos have a maximum input of 2.0ms, and a minimum input of 1.0ms. So if you were to send a pulse for 1.0ms, the servo would go to one end of travel, and it would go to the other end if you sent a pulse for 2.0ms.

PWM signal samples for controlling a servo

What is a Continuous Rotation Servo?

A continuous rotation servo is a servo that does not have a limit on its range of motion. Instead of having the input signal determine where in its range of motion to go, the continuous rotation servo relates the input to the speed of the output. So if the input pulse is 1.5ms long, that would be the middle value of the possible outputs, so the servo would remain stationary. Now if you were to send a 1.0ms pulse, the output of the servo would turn full speed in one direction, and if you sent a 2.0ms pulse, the servo would turn full speed in the other direction. If the signal is somewhere in between, the servo will turn with a speed and direction determined by how much greater or less the signal is than 1.5ms. For reference, here is a table of sample inputs, rotation speeds, and directions for a Continuous rotation servo with an input range of 1.0ms to 2.0ms.

Input Pulse (ms) Rotation Speed (%) Direction of rotation
1.0 100 Clockwise
1.1 80 Clockwise
1.2 60 Clockwise
1.3 40 Clockwise
1.4 20 Clockwise
1.5 0 N/A
1.6 20 Counter-Clockwise
1.7 40 Counter-Clockwise
1.8 60 Counter-Clockwise
1.9 80 Counter-Clockwise
2.0 100 Counter-Clockwise