Shop OBEX P1 Docs P2 Docs Learn Events
Understanding Servo Control.... — Parallax Forums

Understanding Servo Control....

jeremyajeremya Posts: 26
edited 2006-04-21 15:29 in BASIC Stamp
I have been working with the homework board and I am trying to wrap my mind around how the servo knows which direction to move? I haven't messed with it too much, but after reading through the first activity with the servo several times and it's still unclear to me how the pulses control the Servo.

Thanks,

Jeremy

Comments

  • dandreaedandreae Posts: 1,375
    edited 2006-04-20 19:23
    We have two great books called "Robotics' with the Boe-Bot" (continuous servos) and "What's a Microcontroller"·(standard servos) that go into great detail on how the the servos operate.· Here is a link for the downloads:· http://www.parallax.com/html_pages/edu/curriculum/sic_curriculum.asp·.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com

    ·
  • jeremyajeremya Posts: 26
    edited 2006-04-20 19:27
    Yeah I have the "Whats a MicroController" book and I read the chapter it's still unclear to my why one set of pulses makes the servo run in one direction and then another very similar set of pulses makes the servo run another direction. I read the explination in the "Whats a Microcontroller" several times during lunch and I am lost.

    -- Jeremy
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-04-20 19:42
    It is all about the pulse-width.·

    The center pulse is 1.25ms wide, a pulse-width less than that is "interpreted" (by the servo electronics) as a position in one direction from center/home and a pulse-width more than that is "interpreted" as a position in the other direction from center.
  • jeremyajeremya Posts: 26
    edited 2006-04-20 19:46
    Ok that makes sense... I kind of figured it was something like that, but the text didn't specifically state that.
    What the benefit of making the pulses larger or smaller? If 1.26 makes it go one way then whats the benfit of making the pulse 2.0? Anything?

    Thanks!

    -- Jeremy
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-04-20 19:52
    A picture says a 1,000 more words (see attached)
    303 x 356 - 11K
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-20 19:55
    The servo has inside it a little IC, which is a pulse-width comparator.

    The center value is around 1.5 mSec, actually. With a 'non-modified' servo, the output gears are connected to a variable resistor. When you send the servo a 1.8 mSec pulse (repeated every 20 mSecs), the pulse-width comparator drives the motor inside the servo in the proper direction to get the variable resistor to create a pulse width that matches the pulse-width you are inputting.

    Now, with a 'modified' servo, the variable resistor is disconnected, and set to its center position, which SHOULD match a 1.5 mSec pulse. And the output gears are modified slighly so they can turn continuously.

    Thus, when you send the servo a 2.0 mSec pulse, it turns the gears so that the (once attached) variable resistor would turn to the 2.0 msec position. Since the variable resistor is no longer attached, the gears just keep turning, and turning, and turning -- making a very nice, small robot wheel motor.

    Now, to turn the other way, you send it a 1.0 mSec pulse. Now the servo does the same thing, but in the other direction, since 1.0 mSec is LESS than the 1.5 mSec the resistor is set to.

    And if you send a 1.5 mSec pulse, then the variable resistor already matches that, and the servo stops turning.

    Now, it would be nice if the amount your pulse differed from 1.5 mSec actually affected the SPEED at which the wheel turns. And it does, but only over a pretty narrow range. There's a modification you can make inside the servo (with a soldering iron, a capacitor, and a resistor) which can widen this range -- but most people don't go that far.
  • jeremyajeremya Posts: 26
    edited 2006-04-20 20:01
    Ok the so the pulse tells the servo to go to a certain point in it's turning radius? So what is the point of sending the pulse 150 times as in the example in the book. To make sure the servo travels all the way to its destination?

    I am sorry for all the questions. I am new to microcontrollers, electronics, and servos.

    Thanks,

    Jeremy
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-04-20 20:03
    The servo needs to be refreshed regularly.
  • jeremyajeremya Posts: 26
    edited 2006-04-20 20:09
    Great thanks!! I will play with the servo more tonight.

    -- Jeremy
  • Tom WalkerTom Walker Posts: 509
    edited 2006-04-20 20:27
    Once you stop sending pulses, the servo no longer has any goal...so it essentially does nothing to affect its output. In short, you can then easily turn the output shaft (i.e. it has no holding power). While the pulses are coming, the servo is constantly trying to get its internal "pulser" to match the incoming pulse...and thusly holding the motor in position (in the case of a "standard", unmodified servo) or rotating at a constant speed (in the case of a "continuous rotation" modified servo).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-20 20:40
    Yup, what Tom said. That little IC has no 'memory' -- so it only acts for a little while, 20 to 50 mSec, then stops driving the motor. If it gets another pulse in that 20 to 50 mSec time period, it keeps going.

    Note all of this came from the model airplane industry -- where there's a hand-held RC control sending these pulses to a radio reciever in the plane, which uses these pulses to control the position of an aileron, or elevator, or rudder on the plane. So sending a repeating signal to the plane was the simplist way of providing immediate response to control inputs.
  • Robert@HCCRobert@HCC Posts: 80
    edited 2006-04-21 01:57
    PJ Allen said...
    A picture says a 1,000 more words (see attached)

    Thanks for that pic PJ - that really helped me understand how this works! Just what I needed to visualize it myself.

    Most Refreshing smilewinkgrin.gif
  • jeremyajeremya Posts: 26
    edited 2006-04-21 13:42
    Ok well I played the servo for a bit last night. After messing with it for 10-15 mins and not getting the result shown in the book. I realized that the horn must of been misaligned. So I unscrewed the horn, sent the signal to set it to the 12 o'clock position and replaced the horn. After that it worked as expected. No mention of the possibility of that happening in the manual.

    I really like the basic stamp. I think the section on servos could be rewritten to explain things better.

    Can anyone suggest a good book that might explain basic electronics as it pertains to robots? Something more thorough than "Whats a Microcontroller?". Maybe I am denser than most and need things spelled out a little more than average guy.

    -- Jeremy
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-04-21 14:21
    Jeremy,

    ·· The horn's position is not an indication of the center position.· The two are not related as the horn could be in any position in relation to the shaft of the servo.· There are many different types of servo horns, including round ones.· How would you center the servo with that?· The servo center position is roughly in the center of its range of motion, but as there are component variances/tolerances, no two servos are really identical.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • jeremyajeremya Posts: 26
    edited 2006-04-21 15:03
    Ok well I guess that is confusing because book refers to moving the to the 10 o'clock, 2 o'clock, and 12 0'clock positions. The diagram clearly shows the horns in those positions.

    Thanks for the help!

    -- Jeremy
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-04-21 15:09
    The very fact that the servo horn can be removed and applied in any number of positions implies that there is the potential need to make an adjustment to the horn if you're using it for reference.· The same logic applies to many mechanical devices that connect.· You must often adjust them.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com


    Post Edited (Chris Savage (Parallax)) : 4/21/2006 3:22:33 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-21 15:23
    It turns out that it can be very difficult to anticipate all the ways that people can interpret tutorial materials. That's why we have this forum. So yes, it can be necessary to do what you did -- center the servo, remove the horn, and put it back on in the position you want.

    There's really no "more detailed" or simpler tutorial than what Parallax already puts out. There are more 'general' books, but you'll have the same problem there. But it sounds like you "get it" now. Any further questions, come on back and we'll see what we can do.
  • jeremyajeremya Posts: 26
    edited 2006-04-21 15:29
    Thanks...

    -- jeremy
Sign In or Register to comment.