Monday, April 14, 2008

Servo Motors

The beginners section generally talked about what servos are and what they can do. This section is going to look more closely at how servos work and how we can program them.

How Servos Work:

To help us to understand how to control servos it may be helpful to take a closer look at how they work. Inside the servo is a control board, a set of gears, a potentiometer (a variable resistor) and a motor. The potentiometer is connected to the motor via the gear set. A control signal gives the motor a position to rotate to and the motor starts to turn. The potentiometer rotates with the motor, and as it does so its resistance changes. The control circuit monitors its resistance, as soon as it reaches the appropriate value the motor stops and the servo is in the correct position.

Controlling Servos:

Servos are positioned using a technique called pulse width modulation. This is a continuous stream of pulses sent to the servo. The pulse normally lasts for between 1ms and 2ms, depending on the positioning of the servo. The pulse has to be continually repeated for the servo to hold its position, usually around 50 to 60 times a second. It is the actual pulse that controls the position of the servo, not the number of times it's repeated every second.

A 1ms pulse will position the servo at 0 degrees, where as a 2ms pulse will position the servo at the maximum position that it can rotate to. A pulse of 1.5ms will position the servo half way round its rotation. The diagram below shows 3 typical pulses.

The diagram is not to scale but hopefully demonstrates that each pulse must be the same length. That is the combined time that the pulse is on and off.

No comments: