Servo

A common servo is an electrical motor which can hold its position through feedback. This feedback is compared with the input information and the position. If a difference is measured between the feedback and the input information the electronics within the servo will compensate the difference. For more in dept information and the use of different types of servos see:

http://en.wikipedia.org/wiki/Servo_motor

Wiring
Servo motors are widely used in robotics and there are different types from different manufacturers. The difference between those types is often the use of materials and is reflected in the price.

The servos have different connectors, but are basically always the same principle. 2 wires for power and one signal line. Black or brown for neutral and red for power. The signal line has different colors. (see picture below)

servoconnect

The servo will not work if it is connected the wrong way, but will not break.

Servo’s used in hobby robotics are controlled with a pulse train. This pulse train exist of a pulse duration with a length of 0.9 mSec until 1.9 mSec in case of a Hitec HSR-5995TG servo for the whole 180 degree. This may vary between different manufactures and models. Between those pulses there is a delay. The exact timing of this delay is not very important but is typical from 2.5 mSec till 20 mSec.

BlackBoxServo

The pulse length determents the actual position of the servo. In case of the Hitec HSR-5995TG servo the total angle is 180 degree with a pulse of 1.5 mSec in the center position. A pulse of 0.9 mSec will result in a -90 degree angle relative to the center position. A pulse of 1.9 mSec will result in a 90 degree turn. A change of 4.44 mSec will give a 1 degree turn.

Basic stamp example
To experiment with the Hitec HSR-5995TG servo I wrote a little Basic stamp program to show the movement of the servo.
The program below has two servos turn their 180 degree angle infinite. It has a 20 mSec pause between the pulses. The PULSOUT value is multiplied by 2 mSec. In this case the center position has a value of 750 (1500 Ö“mSc)

' {$STAMP BS2}
' {$PBASIC 2.5}
 
counter VAR Word
 
DO
FOR counter = 1 TO 30
PULSOUT 12, 560
PULSOUT 13, 560
PAUSE 20
NEXT
 
FOR counter = 1 TO 30
PULSOUT 12, 960
PULSOUT 13, 960
PAUSE 20
NEXT
LOOP

See the result of this program on YouTube: