A servo is a small motor that you can position at any angle very accurately. It contains internal circuits that will automatically maintain that particular angle. However, you cannot do full revolutions with a servo. You are restricted to a certain range, usually from 180-270 degrees. Servos are very powerful for their sizes. There exist servos that provide a torque of 4kg-cm from a 50 gram servo!
Servos are often used in small sized humanoid robots (not Asimo). Space is a constraint, but you need a lot of power to move without increasing the weight.
Positioning a servo
A servo has three wires. Two are for power (usually coloured black or brown for ground and red for the positive terminal). The third wire is for signals to position the servo.
The signal wire expects input from a pulse width modulator. The period should be 20 milliseconds long and the duty cycle "encodes" the position of the motor.
If the duty cycle is 1 millisecond, the servo is positioned at 0 degrees. If the duty cycle is 2 milliseconds, the servo is positioned at the maximum possible angle (180 degrees, 270 degrees, or whatever is the maximum limit).
Internals of a servo
A servo contains a normal DC motor. This motor is connected to a potentiometer (or a variable resistance) through gears. As the motor rotates, the potentiometer's resistance changes. So the circuit can measure exactly what direction the motor's shaft is pointing.
When the shaft of the motor is at the desired position, power supply to the motor is stopped. If not, the motor is turned in the appropriate direction.
The desired position is sent in through the signal wire. As long as the signal wire has a position, the servo will ensure that the motor's shaft remains at the correct position.
Also, the speed with which the motor turns is proportional to the difference between its actual position and desired position. So if the motor is near the desired position, it will turn slow. Otherwise it will turn fast. This is called proportional control.
Now for the electronics part. The circuit contains a chip, M51660L (or another proprietary chip of the manufacturer). This chip compares the error in positioning the motor.
The chip contains a timer that produces pulse signals from the potentiometer. These signals are similar to the ones you supply. These two pulse signals (the ones you are sending and the ones generated by the potentiometer) are fed into a pulse width comparator. This comparator produces the signals indicating which direction the motor should turn in. These are fed into an H-bridge (a big H Bridge - L293D) to drive the motor.
All of this is contained within the chip. Only a few extra components like resistors and capacitors are required.
You learned about how to control a servo motor and how its internal circuit works. You even got to know how to start building your own controller if you ever wanted to.
Utkarsh Sinha created AI Shack in 2010 and has since been working on computer vision and related fields. He is currently at Microsoft working on computer vision.
About AI Shack
Learn about the latest in AI technology with in-depth tutorials on vision and learning!