Beginner puzzled by Standard Servo
George99
Posts: 16
I'm new to microcontrollers though I've been programming business applications for 40 years and have some electronics background, too.
So, I bought the Basic Stamp Activity Kit at Radio Shack and I'm working my way through the What's a Microcontroller? book.
I just did some of the exercises for the servo and have come away not really understanding what signals do what. It seems that pulse width tells it where to go, but I can't find anything that relates widths to positions. Also, what does the number of pulses affect?
Finally the book runs the servo through a range of about 90 degrees, but gently turning it I find the stops are 180 degrees apart.
Thank you!
So, I bought the Basic Stamp Activity Kit at Radio Shack and I'm working my way through the What's a Microcontroller? book.
I just did some of the exercises for the servo and have come away not really understanding what signals do what. It seems that pulse width tells it where to go, but I can't find anything that relates widths to positions. Also, what does the number of pulses affect?
Finally the book runs the servo through a range of about 90 degrees, but gently turning it I find the stops are 180 degrees apart.
Thank you!
Comments
Some servos only cover 90 degrees, so the exercises are based on that. The servos that Parallax sells have a wider range.
The maximum range for pulse width is maybe 0.5ms to 2.5ms, but some servos only recognize 1.0ms to 2.0ms. The short end of the range corresponds to one end of the mechanical rotation while the long end of the range corresponds to the other end of the rotation.
Typically, it takes a little while for the servo to move. This time may be 100ms or so which corresponds to 5 or so pulses at 20ms intervals. More rotation takes more time. You may have to allow 1 to 2 seconds for a servo to go from one end of its rotation to the other (at 50 pulses per second). Try getting a servo to move through its whole range using only 20 pulses. You'll find that it starts off, then the motor coasts a little bit (from inertia), and it stops maybe 1/2 way. Then try again with 40 pulses and see how far it gets.
So the pulse width tells it where it's going, but it needs continuing pulses until it gets there. Then, when in position if it gets more pulses it does nothing until another position is indicated. (also uses continuing pulses to hold its place against evil outside forces)
As far as width vs position, it sounds like individual servo of the same model may vary. So, it would be good to put some sort of calibration constants in the program to accomodate variations.
Thanks for the information! (but did I understand it?)
There's a lot of uniformity between servos, even of different models. Generally, the center is 1.5ms. There may be slight variation. Typically, you take the "arms" off the shaft and reposition it after setting the servo to center position. The shaft is splined, but the teeth are only so fine, so you may need calibration constants for the center and +/- 90 degree points.
Also, mounting brackets may vary and it's all sloppy anyway. RC-servos were designed for mechanical control of model aircraft originally and these didn't need precise positioning.
If you download the Boe-Bot manual you can read about it.