Monday, August 4, 2008

Controlling angle of Servo Motor

Fig:standard time vs. angle is represented in this chart


The control wire is used to communicate the angle. The angle is determined by the duration of a pulse that is applied to the control wire. This is called Pulse Coded Modulation. The servo expects to see a pulse every 20 milliseconds (.02 seconds). The length of the pulse will determine how far the motor turns. A 1.5 millisecond pulse, for example, will make the motor turn to the 90 degree position (often called the neutral position). If the pulse is shorter than 1.5 ms, then the motor will turn the shaft to closer to 0 degrees. If the pulse is longer than 1.5ms, the shaft turns closer to 180 degrees.

As you can see in the picture, the duration of the pulse dictates the angle of the output shaft (shown as the green circle with the arrow).
The PWM input signal that a servo requires is simply a square wave (0-5V) with the high time being variable as shown in Figure 2. One of the important characteristics of the PWM signal is that the repeat rate must be between 20-30mSecs (i.e., 50 times a second), otherwise the on-board electronics will ignore the signal or in some cases cause the motor to exhibit poor performance such as chattering and unpredictable movements. The pulse width, w, determines the command position, which varies from manufacturer to manufacturer, but the neutral position (90 degrees or so) is usually characterized by a 1.5uS pulse width. Thus, any source capable of supplying this PWM signal can control a servo, which means that microcontrollers are the best candidates for controlling servos because they can easily generate PWM signals. In addition, the pulse width can be controlled via software, making servos the ideal actuator to use in robotics in terms of locomotion and mechanism control
.

No comments: