Parallax Standard Servo

Item code: 900-00005


What It Can Do

  • Moves to any position between 0 and 180 degrees
  • Keeps its position as long as power is applied
  • Motorizes most anything, such as a robot or mechanical puppet

Servo motors are made for hobby radio-control tasks, like model airplanes and model racing cars. They’re also very popular in such things as robotics and animatronics.

R/C servos are made to spin in a limited circle, no more than about 180°. You set the precise position of the output shaft of the servo motor by using a timing signal; this signal is provided by a microcontroller. Once the signal is applied, the motor moves to that position, and stays there.

The control signal for a servo is a stream of pulses. The exact duration of these pulses, in fractions of a second, is what determines the position of the servo. Each pulse is nominally from 1000 to 2000 microseconds (μs) in duration — one microsecond is one millionth of a second. The pulses repeat about 50 times each second.

Note: To enable the servo to move a full 180° use pulse durations of approximately 750 to 2250 μs. Excercise care to not exceed these lower and upper limits.


Parts List

  • Parallax Standard Servo
  • BASIC Stamp HomeWork Board, Propeller QuickStart, or Arduino Uno microcontroller
  • 22 gauge solid conductor hookup wire
  • 4 x AA battery holder, 4 AA alkaline or 4 AA NiMH batteries (Propeller QuickStart)

Basic Wiring

  • Power requirements: 4 to 6 VDC
  • Power consumption: 15 mA @ 6V (when idle)
  • Torque: 38 oz-in (2.8 kg-cm) @ 6V
  • Dimensions: 2.2 x 0.8 x 1.6 in (55.8x 19 x 406 mm) excluding servo horn

Program KickStarts

Each of the example programs turns the servo counter clockwise, then clockwise, and finally to the center position. This movement is repeated indefinitely.

Important! Servo motors draw only minimal current when they’re not attached to a mechanical load, such as the leg of a robot. The example connection diagrams shown here provide only modest current to the servo, so they are not intended to move heavy loads. They’re useful for demonstration only.

To operate bigger loads the servo motor should be connected to its own 4.8 V to 6 V battery supply. See the links below for information on how to use separate power to operate one or more R/C servo motors.

BASIC Stamp 2 HomeWork Board

Download BASIC Stamp 2 code for the Parallax Standard Servo

’{$STAMP BS2}
’{$PBASIC 2.5}

counter VAR Word

Main:
  FOR counter = 1 TO 100 ’ Loop for 2 seconds
    PULSOUT 0, 1000      ’ Servo counterclockwise
    PAUSE 20
  NEXT

  FOR counter = 1 TO 100 ’ Loop for 2 seconds
    PULSOUT 0, 500       ’ Servo clockwise
    PAUSE 20
  NEXT

  FOR counter = 1 TO 100 ’ Loop for 2 seconds
    PULSOUT 0, 750       ’ Servo center
    PAUSE 20
  NEXT

  GOTO Main

Note: A servo can drain a fresh 9 V battery in less than 20 minutes. For tips on using a separate power supply for a servo on the HomeWork Board, see the Parallax servos product pages (linked below).

Propeller QuickStart

Download Propeller Spin code for the Parallax Standard Servo

OBJ
  SERVO : "Servo32v7.spin"

CON
    _clkmode = xtal1 + pll16x                           
    _xinfreq = 5_000_000 

    ServoCh1 = 0                ’ Servo to pin 0

PUB Servo32_DEMO

    SERVO.Start                 ’ Start servo handler
    
  repeat
    ’ Syntax: SERVO.Set(Pin, Width)
    SERVO.Set(ServoCh1,2000)    ’ 2000 usec 
    repeat 800000               ’ Wait a short bit
    SERVO.Set(ServoCh1,1000)	  ’ 1000 usec
    repeat 800000                           
    SERVO.Set(ServoCh1,1500)    ’ 1500 usec (centered)
    repeat 800000

Important! Use a separate AA-size battery pack to power the servo. Connect as shown, being sure not to mix up any of the wires. You can use alkaline or nickel metal hydride (NiMH) cells.

Note: To use this program you must include the Servo32v7 object in the same folder as the program file. The Servo32v7 object is included in the download archive file. See Using Propeller Objects for more information on using Propeller object files.

Arduino Uno

Download Arduino Code for the Parallax Standard Servo

#include <Servo.h>    // Use Servo library, included with IDE

Servo myServo;        // Create Servo object to control the servo 

void setup() { 
  myServo.attach(9);  // Servo is connected to digital pin 9 
} 

void loop() { 
  myServo.write(180);   // Rotate servo counter clockwise
  delay(2000);          // Wait 2 seconds
  myServo.write(0);     // Rotate servo clockwise
  delay(2000);
  myServo.write(90);    // Rotate servo to center
  delay(2000); 
}

Note: This sketch uses the Servo library, which is included with the Arduino IDE software. 


For More Information

Useful links: