Hacking a Servo by Kevin Ross



Whets a Servo?

A Servo is a small device that has an output shaft. This shaft can be positioned to specific angular positions by sending the servo a coded signal. As long as the coded signal exists on the input line, the servo will maintain the angular position of the shaft. As the coded signal changes, the angular position of the shaft changes. In practice, servos are used in radio controlled airplanes to position control surfaces like the elevators and rudders. They are also used in radio controlled cars, puppets, and of course, robots.


A Futaba S-148 Servo


Servos are extremely useful in robotics. The motors are small, as you can see by the picture above, have built in control circuitry, and are extremely powerful for their size. A standard servo such as the Futaba S-148 has 42 oz/inches of torque, which is pretty strong for its size. It also draws power proportional to the mechanical load. A lightly loaded servo, therefore, doesn't consume much energy. The guts of a servo motor are shown in the picture below. You can see the control circuitry, the motor, a set of gears, and the case. You can also see the 3 wires that connect to the outside world. One is for power (+5volts), ground, and the white wire is the control wire.


So, how does a servo work? The servo motor has some control circuits and a potentiometer (a variable resistor, aka pot) that is connected to the output shaft. In the picture above, the pot can be seen on the right side of the circuit board. This pot allows the control circuitry to monitor the current angle of the servo motor. If the shaft is at the correct angle, then the motor shuts off. If the circuit finds that the angle is not correct, it will turn the motor the correct direction until the angle is correct. The output shaft of the servo is capable of traveling somewhere around 180 degrees. Usually, its somewhere in the 210 degree range, but it varies by manufacturer. A normal servo is used to control an angular motion of between 0 and 180 degrees. A normal servo is mechanically not capable of turning any farther due to a mechanical stop built on to the main output gear.


The amount of power applied to the motor is proportional to the distance it needs to travel. So, if the shaft needs to turn a large distance, the motor will run at full speed. If it needs to turn only a small amount, the motor will run at a slower speed. This is called proportional control. How do you communicate the angle at which the servo should turn? 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). Note that the times here are illustrative, and the actual timings depend on the motor manufacturer. The principle, however, is the same.

Now that you understand how a servo works, the first thing that a eager engineering type will want to do is take it apart! Don't worry, this is completely acceptable behavior in robotics. This section is going to describe how to take a R/C servo and make it into an excellent gearhead motor. The changes are quite easy to do, once you have seen the insides. This modification is known to work quite well on Futaba S-148 servos, which are commonly available.

The theory behind this hack is to make the servo think that the output shaft is always at the 90 degree mark. This is done by removing the feedback sensor, and replacing it with an equivalent circuit that creates the same readings as the sensor being at 90 degrees. Thus, giving it the signal for 0 degrees will cause the motor to turn on full speed in one direction. The signal for 180 degrees will cause the motor to go the other direction. Since the feedback from the output shaft is disconnected, the servo will continue in the appropriate direction as long as the signal remains.

The result of this is a really nice compact gearhead motor with built in electronics. The interface to this motor unit is a 1 wire control line, +5 volts for power, and a ground. All of this for around $15, which is an outstanding deal.

As for the details, there are actually only two modifications to make to the servo.

  1. Replace the position sensing potentiometer with an equivalent resistor network
  2. Remove the mechanical stop from the output shaft

Here are the steps. You will need a few supplies

The following steps will help you make the modifications.

Picture of servo gears

Picture of servo parts

Servo with top and gears removed

Disassembled servo motor

Disassembled servo motor.

Picture of modified circuit boards

An unmodified (left) and modified circuit board.

Picture of modified output shaft

An unmodified (left) and modified output shaft gear

The motor should now be able to turn all the way around. Connect a control horn, and carefully apply enough pressure to make the horn turn around. Feel for any mechanical problems, such as a gear catching on the cut off section of the tab. You should not feel any catching or resistance. It would be best not to play with turning the servo by hand too much. This device is not intended to be driven from the output shaft, and it may cause undo wear and tear on the servo motor.