27220 Parallax Inc, 27220 Datasheet - Page 158

BOOK STAMPWORKS

27220

Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet

Specifications of 27220

Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
Behind the Scenes
Hobby servos are specialized electromechanical devices used most frequently to
position the control surfaces of model aircraft. The position of the servo output shaft
is determined by the width of an incoming control pulse. The control pulse is typically
between one and two milliseconds wide. The servo will center when the control
signal is 1.5 milliseconds. In order to maintain its position, the servo must be
periodically updated. The typical update frequency is about 50 times per second, or
every 20 milliseconds as shown in the illustration below
The BASIC Stamp’s PULSOUT command is ideal command for controlling hobby
servos. In this experiment, two RCTIME circuits are constructed around a single 10K
potentiometer. This configuration allows the code to split the potentiometer (at the
wiper), measuring each side independently. By doing this we are able to determine
the relative position of the potentiometer. The readings from each side are scaled to
between 0 and 500 with the */ and MAX operators. By subtracting one side from the
other, a servo position value between –500 and +500 is returned.
RCTIME PotCCW, 1, rcLf
rcRt = (rcRt */ Scale) MAX 500
rcLf = (rcLf */ Scale) MAX 500
sPos = rcLf - rcRt
pWidth = (Center + sPos)
PULSOUT Servo, (pWidth */ PwAdj)
PAUSE 20
GOTO Main
' scale RCTIME to 0-500
' position (-500 to 500)
' finalize pulse width
' move the servo
' servo refresh delay

Related parts for 27220