Electronics Projects: How to Connect a Servo to a BASIC Stamp - dummies

Electronics Projects: How to Connect a Servo to a BASIC Stamp

By Doug Lowe

To create motion, you can add a very useful device, called a servo, to your electronics project. A servo is a special type of motor that is designed to rotate to a particular position and hold that position until told to rotate to a different position. Hobby servos are frequently used in radio-controlled vehicles, but there are many other uses for servos.

The BASIC Stamp Activity Kit comes with a servo that you can use to learn how to write programs that control servos. You can also purchase servos directly from Parallax or from most hobby stores.


Servos use a special three-conductor cable to provide power and a control signal that tells the servo what position it should move to and hold. The cable’s three wires are colored red, black, and white and have the following functions:

  • Red: Supplies the voltage required to operate the servo. For more servos, this voltage can be anywhere between +4 V and +9 V. On a BASIC Stamp HomeWork board, you should connect this to one of the Vdd pins.

  • Black: The ground connection. On the BASIC Stamp HomeWork board, you should connect it to a Vss pin.

  • White: The control wire; it connects to one of the BASIC Stamp’s I/O pins.

This shows how these wires should be connected in a BASIC Stamp circuit:


The control wire controls the position of the servo by sending the servo a series of pulses approximately 20 ms apart. The length of each one of these pulses determines the position that the servo rotates to and holds.

Most hobby servos have a range of motion of 180° — that is, one-half of a complete revolution. The complete range of pulse durations is 0.5 ms to 2.5 ms, where 0.5 ms pulses move the servo to its minimum position (0°), and 2.5ms pulses move the servo to its maximum position (180°). To hold the servo at the center point of this range (90°), the pulses should be 1.5 ms in duration.

To connect a servo to a BASIC Stamp HomeWork Board, you must use a 3-pin header, which comes with the BASIC Stamp Activity Kit. This header consists of three pins that you can plug in to the solderless breadboard. Then, you can plug the servo cable into the adapter.