Shop OBEX P1 Docs P2 Docs Learn Events
Another robot servo question — Parallax Forums

Another robot servo question

ArchiverArchiver Posts: 46,084
edited 2004-03-16 16:29 in General Discussion
I am working on a homebrew Boe-bot. I am using the BASIC Stamp 1
Project Board (#27112). I have the servo (just one so far) connected
via the breadboard to a header with power from an external 4x1.5v
pack (6v total) and the control line jumpered over from P0. The
Project Board is powered by 9v transistor--compiles and downloads
fine. I have modified a Hitec HS-311 for continuous rotation. And
just to check if I have a servo problem I also tested with a Futaba
S3003. Test code below was taken from the Parallax Continuous
Rotation Servo data sheet.

'{$STAMP BS1}
'{$PBASIC 1.0}

SYMBOL temp = W0

FOR temp = 0 TO 200
PULSOUT 0,150
PAUSE 20
NEXT

FOR temp = 0 TO 200
PULSOUT 0,180
PAUSE 20
NEXT

FOR temp = 0 TO 200
PULSOUT 0,120
PAUSE 20
NEXT

END

As I understand it, the above code is supposed to first center the
servo, then turn it one direction, then the other (by adjusting
offsets from nominal and centered 1.5mS pulses). The problem is that
with either the Hitec or Futaba servo I only get rotation in one
direction. I have played with the cycle times (PAUSE 20) and pulse
width. When the cycle times are way out I get lurching of the servo.
Short cycle times don't seem to matter much. Long pulse durations
give me a "grinding" slow turning motion and again, very short
pulses don't seem to matter much. Again though, ALL ROTATION IS IN
THE SAME DIRECTION.

Thoughts? What am I doing wrong?

-Tim

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-03-16 15:17
    The BS1 PULSOUT resolution is 10 microseconds, so "standard" servo
    values should be between 100 (full CW) to 200 (full CCW). Be sure to
    initialize your servo control output low first, and use a rig a 6v power
    supply for your board so that you don't kill the servo (it will work at
    9v ... but not for very long).

    Here's code right out of my editor that ran and did what you want yours
    to do:

    ' {$STAMP BS1}
    ' {$PBASIC 1.0}

    SYMBOL Servo = 0
    SYMBOL temp = B2

    Setup:
    LOW Servo

    Main:
    ' center (stop)
    FOR temp = 0 TO 200
    PULSOUT Servo, 150
    PAUSE 20
    NEXT

    ' cw
    FOR temp = 0 TO 200
    PULSOUT Servo, 100
    PAUSE 20
    NEXT

    ' ccw
    FOR temp = 0 TO 200
    PULSOUT Servo, 200
    PAUSE 20
    NEXT

    GOTO Main


    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: dixontj93060 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=tSw7iFrvqHm9VHrQXHrp0tiFrq1cIFD5ABwNDJxS2Sd6ZKQgZVd_glx_2iI2ESjf6UminYAdb30]t_n_t@v...[/url
    Sent: Tuesday, March 16, 2004 8:44 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Another robot servo question


    I am working on a homebrew Boe-bot. I am using the BASIC Stamp 1
    Project Board (#27112). I have the servo (just one so far) connected
    via the breadboard to a header with power from an external 4x1.5v
    pack (6v total) and the control line jumpered over from P0. The
    Project Board is powered by 9v transistor--compiles and downloads
    fine. I have modified a Hitec HS-311 for continuous rotation. And
    just to check if I have a servo problem I also tested with a Futaba
    S3003. Test code below was taken from the Parallax Continuous
    Rotation Servo data sheet.

    '{$STAMP BS1}
    '{$PBASIC 1.0}

    SYMBOL temp = W0

    FOR temp = 0 TO 200
    PULSOUT 0,150
    PAUSE 20
    NEXT

    FOR temp = 0 TO 200
    PULSOUT 0,180
    PAUSE 20
    NEXT

    FOR temp = 0 TO 200
    PULSOUT 0,120
    PAUSE 20
    NEXT

    END

    As I understand it, the above code is supposed to first center the
    servo, then turn it one direction, then the other (by adjusting
    offsets from nominal and centered 1.5mS pulses). The problem is that
    with either the Hitec or Futaba servo I only get rotation in one
    direction. I have played with the cycle times (PAUSE 20) and pulse
    width. When the cycle times are way out I get lurching of the servo.
    Short cycle times don't seem to matter much. Long pulse durations
    give me a "grinding" slow turning motion and again, very short
    pulses don't seem to matter much. Again though, ALL ROTATION IS IN
    THE SAME DIRECTION.

    Thoughts? What am I doing wrong?

    -Tim
  • ArchiverArchiver Posts: 46,084
    edited 2004-03-16 15:20
    For one thing, you never did a 'LOW 0',
    to set the default state of pin 0 to
    output, low. PULSOUT only toggles the
    pin once and toggles again at the end
    of the pulse period -- you need to
    set the default state before you
    issue PULSOUT.

    The goal is to have a 1 mS pulse to go
    one way, and a 2 mS pulse to go the other.
    1.5 mS pulse is supposed to halt.

    Not having used the BS1, I don't know
    if your values are correct. Also, the
    variable resistor in the Servo MUST
    be set to the center position (1.5 mSec
    pulse width) for this to work.

    --- In basicstamps@yahoogroups.com, "dixontj93060" <t_n_t@v...> wrote:
    > I am working on a homebrew Boe-bot. I am using the BASIC Stamp 1
    > Project Board (#27112). I have the servo (just one so far)
    connected
    > via the breadboard to a header with power from an external 4x1.5v
    > pack (6v total) and the control line jumpered over from P0. The
    > Project Board is powered by 9v transistor--compiles and downloads
    > fine. I have modified a Hitec HS-311 for continuous rotation. And
    > just to check if I have a servo problem I also tested with a Futaba
    > S3003. Test code below was taken from the Parallax Continuous
    > Rotation Servo data sheet.
    >
    > '{$STAMP BS1}
    > '{$PBASIC 1.0}
    >
    > SYMBOL temp = W0
    >
    > FOR temp = 0 TO 200
    > PULSOUT 0,150
    > PAUSE 20
    > NEXT
    >
    > FOR temp = 0 TO 200
    > PULSOUT 0,180
    > PAUSE 20
    > NEXT
    >
    > FOR temp = 0 TO 200
    > PULSOUT 0,120
    > PAUSE 20
    > NEXT
    >
    > END
    >
    > As I understand it, the above code is supposed to first center the
    > servo, then turn it one direction, then the other (by adjusting
    > offsets from nominal and centered 1.5mS pulses). The problem is
    that
    > with either the Hitec or Futaba servo I only get rotation in one
    > direction. I have played with the cycle times (PAUSE 20) and pulse
    > width. When the cycle times are way out I get lurching of the
    servo.
    > Short cycle times don't seem to matter much. Long pulse durations
    > give me a "grinding" slow turning motion and again, very short
    > pulses don't seem to matter much. Again though, ALL ROTATION IS IN
    > THE SAME DIRECTION.
    >
    > Thoughts? What am I doing wrong?
    >
    > -Tim
  • ArchiverArchiver Posts: 46,084
    edited 2004-03-16 16:29
    O.K., I feel stupid. It works now. (I forgot to tie the two grounds
    together--VSS and the 6v for the servo).

    Thanks for the help!

    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    wrote:
    > The BS1 PULSOUT resolution is 10 microseconds, so "standard" servo
    > values should be between 100 (full CW) to 200 (full CCW). Be sure
    to
    > initialize your servo control output low first, and use a rig a 6v
    power
    > supply for your board so that you don't kill the servo (it will
    work at
    > 9v ... but not for very long).
    >
    > Here's code right out of my editor that ran and did what you want
    yours
    > to do:
    >
    > ' {$STAMP BS1}
    > ' {$PBASIC 1.0}
    >
    > SYMBOL Servo = 0
    > SYMBOL temp = B2
    >
    > Setup:
    > LOW Servo
    >
    > Main:
    > ' center (stop)
    > FOR temp = 0 TO 200
    > PULSOUT Servo, 150
    > PAUSE 20
    > NEXT
    >
    > ' cw
    > FOR temp = 0 TO 200
    > PULSOUT Servo, 100
    > PAUSE 20
    > NEXT
    >
    > ' ccw
    > FOR temp = 0 TO 200
    > PULSOUT Servo, 200
    > PAUSE 20
    > NEXT
    >
    > GOTO Main
    >
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    Original Message
    > From: dixontj93060 [noparse][[/noparse]mailto:t_n_t@v...]
    > Sent: Tuesday, March 16, 2004 8:44 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Another robot servo question
    >
    >
    > I am working on a homebrew Boe-bot. I am using the BASIC Stamp 1
    > Project Board (#27112). I have the servo (just one so far)
    connected
    > via the breadboard to a header with power from an external 4x1.5v
    > pack (6v total) and the control line jumpered over from P0. The
    > Project Board is powered by 9v transistor--compiles and downloads
    > fine. I have modified a Hitec HS-311 for continuous rotation. And
    > just to check if I have a servo problem I also tested with a
    Futaba
    > S3003. Test code below was taken from the Parallax Continuous
    > Rotation Servo data sheet.
    >
    > '{$STAMP BS1}
    > '{$PBASIC 1.0}
    >
    > SYMBOL temp = W0
    >
    > FOR temp = 0 TO 200
    > PULSOUT 0,150
    > PAUSE 20
    > NEXT
    >
    > FOR temp = 0 TO 200
    > PULSOUT 0,180
    > PAUSE 20
    > NEXT
    >
    > FOR temp = 0 TO 200
    > PULSOUT 0,120
    > PAUSE 20
    > NEXT
    >
    > END
    >
    > As I understand it, the above code is supposed to first center the
    > servo, then turn it one direction, then the other (by adjusting
    > offsets from nominal and centered 1.5mS pulses). The problem is
    that
    > with either the Hitec or Futaba servo I only get rotation in one
    > direction. I have played with the cycle times (PAUSE 20) and pulse
    > width. When the cycle times are way out I get lurching of the
    servo.
    > Short cycle times don't seem to matter much. Long pulse durations
    > give me a "grinding" slow turning motion and again, very short
    > pulses don't seem to matter much. Again though, ALL ROTATION IS IN
    > THE SAME DIRECTION.
    >
    > Thoughts? What am I doing wrong?
    >
    > -Tim
Sign In or Register to comment.