Shop OBEX P1 Docs P2 Docs Learn Events
stamp stripping out servo gears, BS2 — Parallax Forums

stamp stripping out servo gears, BS2

nickm304nickm304 Posts: 4
edited 2008-12-02 23:50 in BASIC Stamp
Ok so I have successfully hooked up a larger JR servo and it does exactly what I would like it to do, when I swap it out with the mini servo i NEED to use (hitech HS-81) It spins furiously and strips out the gears. I am using a a 6v (4 AA in series) power supply, any ideas what is wrong? I have one set of gears left. I am running stamp BS2

servo CON 15
LOW servo

FOR i = 150 TO 1000 STEP 10
PULSOUT servo,i
PAUSE 20
NEXT


PAUSE 1000

FOR i = 1000 TO 150 STEP 10
PULSOUT servo,i
PAUSE 20
NEXT

END

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-12-02 22:41
    nickm -

    Just out of curiosity, how do you have "i" defined?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When all else fails, try inserting a new battery.
  • nickm304nickm304 Posts: 4
    edited 2008-12-02 22:49
    it appears i is defined as follows,

    i VAR Word


    perhaps it should be byte?

    Its just weird because it worked on a regular sized servo, then when hooked up to a mini servo, it went crazy.
  • MSDTechMSDTech Posts: 342
    edited 2008-12-02 22:52
    Many servos - the Hitech HS-81 included require a 1000 to 2000 ms pulse for positioning. Using a BS2, your code will be sending pulses from 300 to 2000 ms. You're stripping the gears by driving it too far in one direction. It won't be able to reach a position corresponding to the 300ms pulse.
    Change your range for i to 500 to 1000 and see how that works.
  • nickm304nickm304 Posts: 4
    edited 2008-12-02 22:58
    MSDTech said...
    Many servos - the Hitech HS-81 included require a 1000 to 2000 ms pulse for positioning. Using a BS2, your code will be sending pulses from 300 to 2000 ms. You're stripping the gears by driving it too far in one direction. It won't be able to reach a position corresponding to the 300ms pulse.
    Change your range for i to 500 to 1000 and see how that works.


    any idea what the range on the hs-81 is? it appears i can turn it almost 180 degrees by hand, but i saw someone online say it is only supposed to be 90? I will give 500 to 1000 a shot, thanks!
  • MSDTechMSDTech Posts: 342
    edited 2008-12-02 23:08
    The only detail on the Hitech web site was that the HS-81 has a 1500ms neutral position. So whatever range of pulses it accepts, test out slowly from the neutral.
    Neutral = 750 on bs2.
    First check do 700 to 800 and see how it moves then keep expanding the range to get the degree of movement you require.
  • nickm304nickm304 Posts: 4
    edited 2008-12-02 23:10
    UPDATE:::
    thanks MSDTech, this code appears to be working now, do you suggest any other changes?

    thanks for the help guys!!


    servo CON 15
    i VAR Word
    LOW servo

    FOR i = 500 TO 1000 STEP 10
    PULSOUT servo,i
    PAUSE 20
    NEXT

    PAUSE 2000

    FOR i = 1000 TO 500 STEP 10
    PULSOUT servo,i
    PAUSE 20
    NEXT

    END

    Post Edited (nickm304) : 12/2/2008 11:48:19 PM GMT
  • ZootZoot Posts: 2,227
    edited 2008-12-02 23:50
    Yes, the "greater" the step value, the faster the servo will reach the final postion.

    That said, I strongly encourage you to read up on the PULSOUT command in the Pbasic Manual. 500-1000 = 1ms-2ms but *only on a BS2* -- all Stamps are different. Why? Because the actual "unit" used in a PULSOUT command varies from Stamp to Stamp. On a BS2 the "unit" is 2us, which is why 500 "units" = 1000us = 1ms. But on a Stamp BS2p, the "unit" is .8us.

    The "easy" way to deal with this is define a scaling constant in your program -- this constant can be changed depending on the Stamp. This lets you write your PULSOUT statements so you are always working (and thinking) in microseconds for servos, e.g.

    i VAR Word
    ServoLeft PIN 14
    ServoRight PIN 15
    SvoPulseAdj CON $080  ' convert us to pulsout "units" THIS IS FOR A BS2
    
    
    FOR i = 1 TO 100
    PULSOUT ServoLeft, 1500 */ SvoPulseAdj ' write it in microseconds, convert to units -- i.e., 1500us = 1.5ms (center)
    PULSOUT ServoRight, 1000 */ SvoPulseAdj ' 1000us = 1ms
    NEXT
    
    FOR i = 1000 TO 2000 STEP 10
    PULSOUT ServoLeft, i */ SvoPulseAdj
    PULSOUT ServoRight, i */ SvoPulseAdj
    PAUSE 20
    NEXT
    
    FOR i = 2000 TO 1000 STEP 2
    PULSOUT ServoLeft, i */ SvoPulseAdj
    PULSOUT ServoRight, i */ SvoPulseAdj
    PAUSE 20
    NEXT
    
    
    
    



    Better yet, wrap it all in a sub so you only have to set it up once...

    i VAR Byte
    svoPulse VAR Word
    svo VAR Bit
    ServoLeft PIN 14
    ServoRight PIN 15
    SvoPulseAdj CON $080  ' convert us to pulsout "units" THIS IS FOR A BS2
    left CON 0
    right CON 1
    
    Main:
    
    FOR i = 1 TO 100
       svoPulse = 1500
       svo = left
       GOSUB send_svo
       svo = right
       GOSUB send_svo
    NEXT
    
    FOR svoPulse = 1000 TO 2000 STEP 10
       svo = left
       GOSUB send_svo
       svo = right
       GOSUB send_svo
    NEXT
    
    GOTO Main
    
    send_svo:
       PULSOUT ServoLeft+svo, svoPulse */ SvoPulseAdj
       PAUSE 10
       RETURN
       
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php


    Post Edited (Zoot) : 12/3/2008 12:00:25 AM GMT
Sign In or Register to comment.