Shop OBEX P1 Docs P2 Docs Learn Events
Beginner puzzled by Standard Servo — Parallax Forums

Beginner puzzled by Standard Servo

George99George99 Posts: 16
edited 2006-07-21 18:50 in BASIC Stamp
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! smile.gif

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-07-21 15:09
    Servos have a little controller in them that "knows" the current position and measures the width of pulses coming in, compares them and moves the motor until the position matches the pulse width it's receiving. If the little controller doesn't see a pulse every 20ms or so, it won't do anything and the servo can be gently turned (the gears and motor make it stiff).

    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.
  • George99George99 Posts: 16
    edited 2006-07-21 15:24
    Let's see...

    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?)
  • Mike GreenMike Green Posts: 23,101
    edited 2006-07-21 16:03
    You got it! I like the "evil outside forces" - from a servo-centric position, it makes sense.

    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.
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-07-21 18:50
    I think the continuous rotation servos have a calibration adjustment to correct for centering.

    If you download the Boe-Bot manual you can read about it.
Sign In or Register to comment.