Shop OBEX P1 Docs P2 Docs Learn Events
when does a servo reach its position? — Parallax Forums

when does a servo reach its position?

julia_nosewaterjulia_nosewater Posts: 4
edited 2005-03-08 06:19 in BASIC Stamp
Hi,

Just a general question about servos using the basic stamp.· All the examples I've seen on the parallax site only use serout... don't you somehow need to know how to get the current position of the servo?· Otherwise, once you send a serout, how do you know when the proper position has been reached?· Also, maybe it didn't quite get where you wanted (ie small error) shouldn't you be able to track this?

Thanks!
julia

Comments

  • NewzedNewzed Posts: 2,503
    edited 2005-03-05 21:58
    A continuous rotation servo - one that rotates 360 degrees - can· be posisitoned only applying a pulse for a certain amount of time, and it a cut-and-try hit-or-miss type of operation.

    A standard servo - one that rotates only 180 degrees, can be positioned by the width of its driving pulse.· For instance, a pulse 800·us wide will always take the servo to the same position.· If you want a reference for the servo position, set a variable pos = to 750, then pulse your servo
    pos + 100, pos - 75, etc.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    NEW! 4 MB EEPROM

    http://hometown.aol.com/newzed/page4.html
    ·
  • julia_nosewaterjulia_nosewater Posts: 4
    edited 2005-03-06 00:09
    Ok then let me rephrase my question:

    How does one acurately position a servo that needs continuous rotation?

    For example, let's say I know I need the servo to make x rotations.· If x is large, then it will take a while.· How can I know when it's reached its destination?· I have to time it?· Thats seems very unaccurate.· There must be more accurate ways of doing this?· Stepper motors might be better perhaps?

    After some reasearch, I think what I'm looking for is an "encoder" for the motor (stepper or servo?).· Does anyone know where to find hobby versions of these?· Basically, I want to be able to read the position of my motor so I know exactly how far it's moved.

    Thanks for your time!
    julia
  • NewzedNewzed Posts: 2,503
    edited 2005-03-06 00:22
    Sounds like you need a stepper.· You would never be able to track a servo over a large amount of revolutions.

    You can precisely position a stepper.· If it takes 200 pulses to make a complete revolution and you wanted 10 revolutions then you would pulse it it 2000 times.· One additional pulse would give you 360/200 = 1.8 degrees per pulse.· Micro-step steppers can be set for 800 pulses per revolution and that would make 1 pulse = 360/800 = .45 degrees per pulse.· I think some stepper controller can go to 1600 pulses per revolution, but as you have probably figured out, higher resolution results in less rotational speed.

    Check the Parallax site for stepper motors and also Jon's N&V columns for more info.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    NEW! 4 MB EEPROM

    http://hometown.aol.com/newzed/page4.html
    ·
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-06 00:26
    wierd, I thought i posted a message, yeah a stepper motor would work, or you could use a shaft encoder and a servo.
  • NewzedNewzed Posts: 2,503
    edited 2005-03-06 00:29
    Paul, you must have forgotten to click on Submit [noparse]:)[/noparse])

    Sid
  • steve_bsteve_b Posts: 1,563
    edited 2005-03-06 00:31
    you can use a pot or encoder of one type or another.

    If you're working a gearbox, you could put the encoder on the final gear to be able to determine your 'turntable' position rather than just the stepper/servo.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://ca.geocities.com/steve.brady@rogers.com/index.html
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-06 04:22
    Newzed said...

    Paul, you must have forgotten to click on Submit [noparse]:)[/noparse])

    Sid

    Ah I found the partially finished post on the computer in my room, thats where it went :P
  • kelvin jameskelvin james Posts: 531
    edited 2005-03-06 06:58
    Talk about encoders, check this out, up to 32k per rev resolution.
    www.netzerprecision.com/prodrot.asp
    Good idea, good price, but needs additional sotware. Anyone know how to go about making something like this, if possible?

    kelvin
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-06 07:19
    kelvin james said...
    Talk about encoders, check this out, up to 32k per rev resolution.
    www.netzerprecision.com/prodrot.asp
    Good idea, good price, but needs additional sotware. Anyone know how to go about making something like this, if possible?

    kelvin
    Holy [noparse][[/noparse]insert your favorite interjection or expletive·here], those are unbelievable. I'm not quite sure if $75 is a bargain, but the price is definitely·reasonable given its function. The nice thing about absolute encoders (as opposed to incremental encoders) is you won't "get lost," as long as you sample the·position at least once per revolution you'll never loose you ability to determine exactly where you are. So the lower bound of your reading speed is governed by your RPM, not the encoder's bits changing (incremental encoders require you to detect every bit change, if you miss one your reading will be off). The gist of this is, you·could use a couple·8 bit PISOs (parallel in serial out) shift registers for minimal·I/O interfacing. This will introduce some delay from the reading to the controller's receipt of the data, but if your motor has a near constant RPM you could add an offset to correct for this delay. This offset could be determined via software by taking two successive readings and subtracting the values.

    Post Edited (Paul Baker) : 3/6/2005 7:28:12 AM GMT
  • Steve JoblinSteve Joblin Posts: 784
    edited 2005-03-06 16:43
    To accurately measure a servo's position you need encoders.

    Wheel encoders can be self made with this great article... http://www.seattlerobotics.org/encoder/200010/dead_reckoning_article.html

    Or you can purchase one from http://www.nubotics.com/
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-06 18:23
    those "sun-ray" encoders are fine if your servo operates in only one direction, or you can determine direction via some other means (ussually possible if the same controller is operating the servo, which is normally the case) but if you do not have access to that information a "sun-ray" encoder is insufficient, you need at least two bits of info:

    Channel A: 0 1 1 0
    Channel B: 0 0 1 1

    rotation in one direction produces a sequence of A leading B, the reverse direction produces B leading A. Like I mentioned in the previous post, your stamp must detect absolutely every transistion, if you have computationally intensive operations that you don't split up into smaller chunks, you run the risk of missing a transition and ending up with an incorrectly computed position.
  • NewzedNewzed Posts: 2,503
    edited 2005-03-07 23:34
    Julia, I fired up my stepper motor just to check the precision - haven't used it it quite a while.

    It takes 11,167 20us pulses for one revolution.· That translates to .0322
    degrees of rotation per pulse, or 31 pulses for one degree.· I have the stepper programmed to rotate right X number of degrees, X being entered by the user.· Same thing to rotate left.· The program remembers its last position, and rotates X or -X number of degrees from that position.· The debug screen displays its current position, expressed as X or -X degrees,
    using 0 degrees - 12 o'clock - as a reference point.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    NEW! 4 MB EEPROM

    http://hometown.aol.com/newzed/page4.html
    ·
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-03-07 23:51
    Don't the newer 'digital' servos provide a means of position tracking directly?
  • musictechmusictech Posts: 54
    edited 2005-03-08 06:19
    tear apart an old mouse and steal the ir diodes and recievers and the encoder wheels.
Sign In or Register to comment.