Shop OBEX P1 Docs P2 Docs Learn Events
Servo control — Parallax Forums

Servo control

JimGJimG Posts: 84
edited 2009-03-15 18:51 in BASIC Stamp
I am working my way through the What's a Micro Controller with a BOE and BS2.· I am on Activity 3 that involves controlling a servo motor.· I have no trouble making the program and motor operate but I can't "get it" about how it works, and the how it works is the whole point behind learning this stuff.· I have included a code snippet below.

counter var word

for counter = 1 to 150
· pulsout 14, 1000
· pause 20
next

for counter = 1 to 150
· pulsout 14, 500
· pause 20
next

for counter = 1 to 150
· pulsout 14, 750
· pause 20
next

Thje servo is on I/O pin 14, no problem.· As I said, this works fine.· What I don't understnad is the duration argument.· It one value moves the horn one direction some amount and another value moves it the other direction.· I just don't get the control command at all.· It would seem move logical that a positive number would move it one direction and a negative number would move it the other direction; don't work that way!· shocked.gif·· Can some one help?

Thanks,

Jim

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-20 03:04
    Read my answer in this thread, it should help you understand the mechanics inside the servo and how the control pulse provides position information. Ask if your still unclear on anything.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • JimGJimG Posts: 84
    edited 2006-01-20 03:17
    Paul,



    Thanks fo rthe reply.· I have your stuff from the other forum and will "ponder" on it later when my brain starts working again.· I'll let you know if I am still confused.



    Jim
  • JimGJimG Posts: 84
    edited 2006-01-21 17:00
    Paul,

    Thanks to your writings I better understand how servos work, now, of course, I have mroe questions.

    Given the folowing command
    PULSOUT <pin>, <duration>
    I understand that the <duration> is effectively 2 microsecs so a value of 750 will actually send a 1500 microsec pulse?· Am I right so far?
    I coded a loop that sent a stream with appx 20ms spacing from 250 to 1000 which should be sending 500 to 2000 microsec pulses to the servo.· This seems to be the limit of movement for the servo that comes in the BASIC Stamp Discovery Kit.· Since this range is different than the range you spoke of in your message (1000 to 2000 microsecs) I am assuming different servos have different ranges?·

    Do they also have different voltage ratings for the opertaing voltage (not the control voltage)?
    Do they also have different pussh/pull strengths?

    attachment.php?attachmentid=73778

    This is a spec typical of what I see when I start searching around for servos, can you help me understand what is is telling me.

    Thanks,

    Jim

    Post Edited (JimG) : 1/21/2006 5:18:02 PM GMT
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-21 17:27
    Im heading out the door to an awards banquet, If no one has answered by the time I return, I will.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • JimGJimG Posts: 84
    edited 2006-01-22 16:27
    Paul,



    I can't believe that you would rather go out to an awards banquet and be with your family and have a nice day than stay home and answer my questions...some people just have no sense of priority!· smilewinkgrin.gif

    I have found some more information so am better understanding the parameters that describe any given servo.· I also got the spec sheet on the one I have (attached) so things are getting better.·

    At the moment, the only thing I am still not sure about is the pulse width.· Are all servos set up on a 1 millisec width?· In other words, are they all set to spread across 1000 to 2000 microsecs?· From the docs I got I can't find where that is specified.



    Thanks,



    Jim
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-22 19:37
    To my knowledge all servo control pulses vary from 1 to 2 ms in width, servos were first used in R/C systems, so the variation in pulse width has become an industry standard so you could purchase an R/C receiver and match any company's servo with it.

    Sorry I didnt return to the forums yesterday, at the banquet we recieved word that my gf's gpa is in the hospital and went there immeadiately afterwards, hes not doing very well and we are going back in about an hour.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • JimGJimG Posts: 84
    edited 2006-01-22 20:02
    Paul,

    I'm sorry to hear about the illness. I hope all goes well.

    You hav given me enough to work with for th time being. Now I need to experiement a little more.

    Jim
  • Mark DietrichMark Dietrich Posts: 7
    edited 2009-03-15 18:51
    Paul:
    And after more than three years, this thread you refer to is still helping people. I just wanted to thank you for taking the time.
    Mark Dietrich
Sign In or Register to comment.