Shop OBEX P1 Docs P2 Docs Learn Events
servo smoothness — Parallax Forums

servo smoothness

jcfergusonjcferguson Posts: 86
edited 2007-02-12 02:08 in BASIC Stamp
Hi all,

Would the bs2sx make for a smoother servo pan than the bs2 due to the difference in pulsout values? Do I want as fine an adjustment as possible with the pulsout?

What about the pwmpal - how would this make for smoother/rougher panning than a stamp alone? The parallax servo controller?

I am looking for the smoothest pan possible as I am using servo to pan a camera - the servo is geared up so that I can get a full 360 degrees - and so the jerkyness is geared up too!

Thanks!

Carlos Ferguson

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-02-11 21:34
    If you really NEED smoothness I would look at stepper motors rather than servos.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • jcfergusonjcferguson Posts: 86
    edited 2007-02-11 21:37
    Hmm... I thought the steps of the stepper would make it even jerkier - chunk chunk from step to step... no?

    within the servo world (which will cost less since I won't have to get the stepper drivers for 5 steppers!) what's the best combination in your view?

    Thanks,

    Carlos
  • LarryLarry Posts: 212
    edited 2007-02-11 21:45
    Servos have a deadband in them so they won't move with small change in pulse width.
    check the specs on your servo. Some newer digital (and more expensive) servos have a smaller deadband and on some (even MORE expensive) the deadband is programmable.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (Larry) : 2/11/2007 9:49:35 PM GMT
  • jcfergusonjcferguson Posts: 86
    edited 2007-02-11 21:56
    Does this mean that if I am increasing a servo by very small increments it waits until the increment is larger than the deadband to move?

    I am using this code to test for smoothest way to pan servo - am I missing anything?:

    ' {$STAMP BS2sx}
    ' {$PBASIC 2.5}

    SERVOVAR VAR WORD
    INTERNAL VAR WORD
    MOTION VAR WORD

    DO
    FOR MOTION = 16 TO 30 STEP 2 'try a range of pause times on this outer loop

    DEBUG DEC (MOTION), CR 'print the pause time

    FOR SERVOVAR = 1675 TO 2075 STEP 10
    FOR INTERNAL = 1 TO 6 'pulse servo for 'internal' times at this value
    GOSUB PULSE
    NEXT
    NEXT

    FOR SERVOVAR = 2075 TO 1675 'back the other way
    GOSUB PULSE
    NEXT
    NEXT
    LOOP




    PULSE: 'pulse servo, pause

    PULSOUT 0, SERVOVAR
    PAUSE MOTION

    RETURN
  • ZootZoot Posts: 2,227
    edited 2007-02-11 22:03
    Try removing the internal loop (which amounts to a "stop at this position for a while") and decreasing your step value to test for smoothness and deadband:

    FOR SERVOVAR = 1675 TO 2075 STEP 1
    GOSUB PULSE
    NEXT
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • jcfergusonjcferguson Posts: 86
    edited 2007-02-11 22:13
    I've been trying all sorts of values - I added that step in there to see if it might make it smoother if, as is posted above, the deadband might make it so the servo only moves in chunks when the value of my pulsout exceeds the deadband.


    It looks to me like the servo runs smoothly for a bit then chunks up for a few pulsouts then runs smooth... I wonder if this is caused by my pulsouts being at some other interval than 20us? So that it runs smoothly for a while until it skips a round due to incremental increase or decrease above or below 20us? Does the servo have some kind of internal clock for this 20us?

    If so, I wonder if the pwmpal would be smoother due to better regulation of the pause time between pulses?

    Carlos
  • jcfergusonjcferguson Posts: 86
    edited 2007-02-11 22:28
    Also it looks like the pwmpal has a higher resolution than the bs2sx? pwmpal .025 micro seconds, bs2sx pulsout .8 microseconds?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-02-11 23:00
    Clearly, the only way to go is with gear-motors·(possibly linked to·position encoders.)· Camera jibs use motors (not steppers or servos.)
  • ZootZoot Posts: 2,227
    edited 2007-02-11 23:05
    Most servos "like" a 20ms (twenty millisecond) pulse interval (~50Hz). Depending on the servo, you can get away with more or less (less is usually a bigger problem -- this "overdrives" the servo -- forcing it to update it's position more often than it can handle).

    Since your test code is simple and short, I would try a straight 20ms pause between servo pulses as a baseline. In the real world, this will probably give you a pulse every 21-23ms or so, taking into account the actual length of the pulse itself plus overhead on the Stamp for executing instructions. See what kind of results you get. For real programs, if you are generating the servo pulses from the Stamp, you will need to adjust the pause (and possibly have it be variable on each loop) depending on the overhead for other operations in the loop. See "Go to and Find Closest Object" in the Stamps in Class forum for a good example of the latter (that program calculcates the time for an echo on a Sonar, and adjusts the pause value after the servo pulse accordingly).

    FYI -- I think you meant 20 milliseconds above; many readers would read "20us" as microseconds (millionths of a second).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • ZootZoot Posts: 2,227
    edited 2007-02-11 23:11
    Wait -- I'm a post or two behind smile.gif and I just caught what PJ Allen was referring to -- you geared the servo *faster* to get 360 degrees (i.e. larger gear on the servo horn, smaller gear on the pan platform)? That will definitely amplify any jitter in your servo. www.servocity.com carries some pretty cool geared *down* servos specifically for camera pans, modified for greater rotation. That essentially makes them gear motors with an internal position feedback loop and the ease of servo control. If that doesn't do it though, gearmotors with positional encoders would certainly do the trick.
    You might still want to baseline your servo though and see if you can improve your results... the knowledge will always come in useful and you might be able to live with the results and come out ahead.....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • FranklinFranklin Posts: 4,747
    edited 2007-02-11 23:39
    As for the steppers, you would gear them down by a factor of 10 or so and drive them faster. Since they have no limit to the degrees of rotation that won't be a factor in your gearing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • jcfergusonjcferguson Posts: 86
    edited 2007-02-12 00:02
    Ok, the last two posts make sense Zoot and PJAllen and Franklin, gearing down would be better than gearing up in terms of jitter...

    One other consideration though, is size. I have about 3.5 inches width to work with, 3 inches height. I need to fit my pan/tilt, and camera in there. See picture of slot car track in parking garage like structure below.

    My mechanism is attached too - I think it will make sense, one is the top view, that entire platform rotates and the tilt camera will be carried on the platform. As long as I can keep the platform less than 1.75" radius I should be ok! The shaft is attached rigidly to the plexiglass base (this is all a mock-up) and as the servo turns it swings the top wood around the shaft.


    What about this idea (taken from some robotics site...). I put the small gear on the servo, large gear on the base, use an external 10 turn pot also running off the gear on the servo - this way I would get several turns of the servo in order to pan the platform? Better?

    Thanks for the help!

    Carlos
    640 x 480 - 48K
    640 x 480 - 52K
    640 x 480 - 59K
  • LSBLSB Posts: 175
    edited 2007-02-12 01:15
    Is the servo 'clunky' between endpoints, or only because you command it one degree (or so) at a time? That is, does it move soothly if commanded between endpoints (full right turn to full left)? have you tried adding a short pause between pulses? Maybe raising/ lowering your supply voltage will help? I'm just wondering if you're not compounding issues like positional accuracy, gear slop, and such... I'm somewhat 'ham handed' in the shop--usually nothing works better than when I bought it, I break a lot of stuff... man, its tough being me.
  • jcfergusonjcferguson Posts: 86
    edited 2007-02-12 01:27
    I know what you mean about adding error with gears and such... but just plain, the servo is just a bit to jerky... I have tried lots of different ways of sending the info and haven't hit on a magic solution.

    Gearing down? Might this help? I would think it would, but who knows, for these tiny little variations it might always be jerky?

    Carlos
  • LSBLSB Posts: 175
    edited 2007-02-12 02:08
    I bow to the experts on this one Carlos, I haven't a clue. It seems to me that all the gears inside the servo would be enough if gearing was the issue, and doesn't 180 degrees of rotation become 18 degrees if its geared 10:1? In my project I tried replacing the internal standard position pot with an external one, even bought a $15, 10 turn model in hopes... ended up going with a stepper motor ($2), driver chip ($2) and a worm gear (salvaged)--of course it was 10X bigger than I intended... I think I mentioned before hardware "ain't my thang".
Sign In or Register to comment.