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

Servo qusetion

SN96SN96 Posts: 318
edited 2005-08-28 20:59 in Learn with BlocklyProp
Hello all,

I bought the "What's a microcontroller" Basic Stamp 2 homework board from Radioshack. When I brought it home, opend the contents, my wife grabed the servo and began to grab the servo horn, and while moving it back and forth saying "whats this?" I proceeded with "Nnnnnoooooooo!"

Well I'm at the point in the book where you begin to program the servo and it is suposed to move 10 o'clock, 2 o'clock and then 12 o'clock (center). The servo seems to almost do this but I had to remove the servo horn, and reclock it so it repersents the example picture in the book while moving. When I change the pause duration from the books program example of 20 to 1, the servo tends to have a slight bounce at the end of each travel.

My question is: Does it mater if the servo gets moved manually? Do I need to re-calibrate center?

Thanks!

Mikey

·

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-28 18:40
    Mike,

    ·· Actually the position of the servo horn is relational to the shaft.· IOW, it doesn't matter how is placed on the spline, it should move to the same relative positions regardless.· You should find that if you "center" the servo via code, then disconnect power, you should be able to turn it an almost equal distance in either direction from that position before it hits the stop.

    ·· This should also answer your other question, which is it's okay to turn the servo manually, but slowly.· And when it hits it's stop, don't force it.· They're pretty tough, nonethless you don't want to keep cranking on them.· It's possible for a servo to generate voltage while it's being turned by hand too, so keep that in mind if it's plugged into the board.




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • SN96SN96 Posts: 318
    edited 2005-08-28 20:59
    Thanks very much.

    I seem to have it figured out. I was able to program the servo to start at 720 (center) and then move to the location I define. If I follow the books example, staying within 500 to 1000, I only can achieve 45 Deg. angle movements; however, if I program it to move to 90 Deg., it does that also. The problem I have encountered when moving it to 90 Deg. is the return back to center, it over shoots the center position. I had to enter in a pause of 40 to correct this over shoot problem.

    I want to learn to program the servo to move exactly where I want it to and at the desired speed of rotation for future walking bot projects. I have noticed that when trying to make a servo move back and forth with little delay, the servo tends to loose its reference unless there is enough delay to allow things to settle. I don't know how I am going to get my biped to walk if there is a lot of jerking and bouncing going on.

    I'm sure I must be doing something wrong since the servo seems to be moving where I tell it to, but my code must be lacking some key ingredient.

    Here is the code:

    '{$STAMP BS2}
    '{$PBASIC 2.5}

    counter VAR Word
    walk VAR Word
    'pulses VAR Word
    'duration VAR Word


    'CENTER SERVO MOTOR TO 12 O'CLOCK

    FOR COUNTER = 1 TO 10

    PULSOUT 14, 709 '709 IS THE CENTER LOCATION FOR THIS SERVO
    PAUSE 20

    NEXT

    FOR walk = 1 TO 5

    'MOVE SERVO TO LOCATION 1150 ' 90 Deg.

    FOR COUNTER = 709 TO 1150 STEP 8 'START AT POSISTION 709 AND MOVE SLOWLY TO POSITION 1150

    PULSOUT 14, COUNTER
    PAUSE 20

    NEXT

    'CENTER SERVO MOTOR TO 12 O'CLOCK

    COUNTER = 0

    FOR COUNTER = 1150 TO 750 STEP 40

    PULSOUT 14, 709 '709 IS THE CENTER LOCATION FOR THIS SERVO
    PAUSE 40 ' 40 gives the best home position, < 40 causes over shooting.

    NEXT

    NEXT


    END
Sign In or Register to comment.