Servo control
Servo control is a method of controlling many types of RC/hobbyist servos by sending the servo a PWM signal, a series of repeating pulses of variable width where either the width of the pulse or the duty cycle of a pulse train determines the position to be achieved by the servo. The PWM signal might come from a radio control receiver to the servo or from common microcontrollers such as the Arduino.
Small hobby servos are connected through a standard three-wire connection: two wires for a DC power supply and one for control, carrying the control pulses.
The parameters for the pulses are the minimal pulse width, the maximal pulse width, and the repetition rate. Given the rotation constraints of the servo, neutral is defined to be the center of rotation. Different servos will have different constraints on their rotation, but the neutral position is always around 1.5 milliseconds pulse width.
Pulse duration
In modern RC servos the angle of mechanical rotation is determined by the width of an electrical pulse that is applied to the control wire. This is a form of pulse-width modulation. The typical RC servo expects to see a pulse every 20 ms, however this can vary within a wide range that differs from servo to servo. The width of the pulse will determine how far the motor turns. For example, in many RC servos a 1.5 ms pulse will make the motor turn to the 90° position. The low time can vary over a wide range, and vary from one pulse to the next, without any effect on the position of the servo motor.Modern RC servo position is not defined by the PWM duty cycle but only by the width of the pulse.. Most RC servos move to the same position when they receive a 1.5 ms pulse every 6 ms as when they receive a 1.5 ms pulse every 25 ms – in both cases, they turn to the central position. With many RC servos, as long as the refresh rate is in a range of 40 Hz to 200 Hz, the exact value of the refresh rate is irrelevant.
The period of 20 ms comes from the days where the signal was encoded in PPM format to be sent over the air. The PPM period was around 22.5 ms, and the conversion to PWM was trivial: the time of the PWM high state was the time position of the PPM pulse for that servo.
Most RC receivers send pulses to the RC servo at some constant frame rate, changing only the high time. However, it is possible to command an RC servo to move over its entire range with a function generator set to a constant 10% duty cycle by changing only the frequency.