Shop OBEX P1 Docs P2 Docs Learn Events
Standard Servo Oscillates when sweeping — Parallax Forums

Standard Servo Oscillates when sweeping

DrDDrD Posts: 8
edited 2005-11-24 02:50 in General Discussion
My standard servo oscillates about the position rather than sweeping smoothly thru the range when gradually increasing the pulsout length from 1000uS to 2000uS.
· I have tried different servos and different power sources. I· have varied the pause period from 1-200mS

How can I fix this?

Post Edited (DrD) : 11/24/2005 2:22:09 AM GMT

Comments

  • NewzedNewzed Posts: 2,503
    edited 2005-11-24 01:07
    Which Stamp are you using?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • DrDDrD Posts: 8
    edited 2005-11-24 01:09
    BS 2
  • NewzedNewzed Posts: 2,503
    edited 2005-11-24 01:11
    For the BS2, the servo range is about 750 to 1300 in one direction, and 750 to 250 in the other direction.· The pause should be set at 20ms.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • NewzedNewzed Posts: 2,503
    edited 2005-11-24 01:17
    Closing down for tonite.· More questions, I'll be here about 8 am tomorrow EST.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • DrDDrD Posts: 8
    edited 2005-11-24 01:17
    I ran the pulsout from 500 - 1000 which at 2uS per unit for the BS 2 should be 1-2ms. I have used the pause of 20ms most commonly
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-24 02:05
    You're really not providing ay details or even enough information to help you.· Are you sweeping through the positions?· If so, it's possible to go too fast for the servo to keep up depending on how you're ramping.· Why not post your code and save a lot of guesswork.· Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • DrDDrD Posts: 8
    edited 2005-11-24 02:09
    FOR vert = 500 TO 1000 STEP 5
    PULSOUT vertout,vert
    PAUSE 20
    FOR horiz = 500 TO 1000 STEP 5
    PULSOUT horizout,horiz
    PAUSE 20
    GOSUB Read_GP2D12 ' Read Sensor Value
    GOSUB Calculate_Distance ' Convert Value To cm
    SEROUT TX, LcdBaud, [noparse][[/noparse]LcdLine1,"Distance: ",DEC2 cm]
    SEROUT TX, LcdBaud, [noparse][[/noparse]LcdLine2,"vert",DEC4 vert,"horz",DEC4 horiz]
    NEXT
    NEXT

    END
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-24 02:11
    DrD,

    ·· Well, I give you an e for effort...But that is not the complete code.· Pasting that into my editor to try it won't even compile.· I think if more people attached their code too, instead of pasting into the message, more people, including myself would be more inclined to open it in our Stamp Editor and actually try it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • DrDDrD Posts: 8
    edited 2005-11-24 02:23
    Chris

    I have attached the code file to my original posting
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-24 02:38
    Okay,

    ·· See, now this gives a much clearer picture of what's going on...First of all you won't be needing 20 mS pauses in the loop because you're doing too much other stuff in between.· I question whether or not the servos will even be refreshed enough as it is.· Another thing is that if you're going to call these two routines in·a·row each time, you may as well make it one subroutine and save jumping around in the program so much.· I will have to check more, since without the full hardware setup this will be a little more involved to check out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-24 02:40
    Found another issue...You outer servo is only being refreshed once every 500 iterations through the inner loop.· You will need to re-structure that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • DrDDrD Posts: 8
    edited 2005-11-24 02:50
    Chris

    thank you. putting the vertical sweep in the fast loop and eliminating the Gosubs and lcd outputs makes a very smooth sweep now I just need to get the fast loop timing right
Sign In or Register to comment.