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

Servo control

ArchiverArchiver Posts: 46,084
edited 2003-11-11 06:14 in General Discussion
[font=+]Can anybody suggest some code for controling a futaba FP-S14B[/font]

presently I use this code:

x··· var··· word

for x=1 to 30 step 1

··· pulsout 0, 625· 'returns servo to ~90deg
··· pause 20

next

Is there a simpler way to do it?

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-09-20 00:28
    Hi, I'm Chris Luomanen. I was wondering if any of you could answer
    my
    question. I did a project with a BS-II, got interested in this stuff
    and purchased a BSII-SX for a project I am doing (a squirming worm
    robot with servo controlled tendons). I have 3 Hitec HS-725BB winch
    servos that are supposed to turn 4 times stop to stop. 1mS is
    supposed to be one extreme of travel, 1.5 is middle and 2mS is the
    other extreme. The pulse refreshes every 21mS. I hooked them up to
    my stamp (Pin0 to the signal wire) with a 4xAA battery pack to the
    power inputs. Just to find the extremes of travel I wrote:

    puls var word
    tick var byte
    loop:
    puls = 500
    gosub hit
    debug "reverse", cr
    puls = 1000
    gosub hit
    goto loop

    hit:
    for tick = 1 to tick
    pulsout 0, puls
    pause 15
    next

    All this does is go-stop-go-stop in one direction. The reverse debug
    never appears. Does the BSII-SX have a different pulsout (meaning
    not
    2 microseconds*puls in my program)? Why are these servos misbehaving?

    Thanks for your help!
    chris

    I have played with the pause (problem with refresh time?)
  • ArchiverArchiver Posts: 46,084
    edited 2000-09-20 01:04
    Chris,

    Put a return after your routine "hit". You're never returning from the gosub.

    hit:
    for tick = 1 to tick
    pulsout 0, puls
    pause 15
    next
    return

    Regards,

    Bruce
    webmaster@r...
    http://www.rentron.com
    BASIC Stamp RF remote control modules.


    Original Message
    From: "Chris Luomanen" <luomanen@e...>
    To: <basicstamps@egroups.com>
    Sent: Tuesday, September 19, 2000 5:28 PM
    Subject: [noparse][[/noparse]basicstamps] Servo Control


    | Hi, I'm Chris Luomanen. I was wondering if any of you could answer
    | my
    | question. I did a project with a BS-II, got interested in this stuff
    | and purchased a BSII-SX for a project I am doing (a squirming worm
    | robot with servo controlled tendons). I have 3 Hitec HS-725BB winch
    | servos that are supposed to turn 4 times stop to stop. 1mS is
    | supposed to be one extreme of travel, 1.5 is middle and 2mS is the
    | other extreme. The pulse refreshes every 21mS. I hooked them up to
    | my stamp (Pin0 to the signal wire) with a 4xAA battery pack to the
    | power inputs. Just to find the extremes of travel I wrote:
    |
    | puls var word
    | tick var byte
    | loop:
    | puls = 500
    | gosub hit
    | debug "reverse", cr
    | puls = 1000
    | gosub hit
    | goto loop
    |
    | hit:
    | for tick = 1 to tick
    | pulsout 0, puls
    | pause 15
    | next
    |
    | All this does is go-stop-go-stop in one direction. The reverse debug
    | never appears. Does the BSII-SX have a different pulsout (meaning
    | not
    | 2 microseconds*puls in my program)? Why are these servos misbehaving?
    |
    | Thanks for your help!
    | chris
    |
    | I have played with the pause (problem with refresh time?)
    |
    |
    |
    |
    |
    |
  • ArchiverArchiver Posts: 46,084
    edited 2000-09-20 01:09
    P.S. You'll need to assign some value to the variable tick as well.
    IE,, tick = 100..?

    Bruce



    Original Message
    From: "Chris Luomanen" <luomanen@e...>
    To: <basicstamps@egroups.com>
    Sent: Tuesday, September 19, 2000 5:28 PM
    Subject: [noparse][[/noparse]basicstamps] Servo Control


    | Hi, I'm Chris Luomanen. I was wondering if any of you could answer
    | my
    | question. I did a project with a BS-II, got interested in this stuff
    | and purchased a BSII-SX for a project I am doing (a squirming worm
    | robot with servo controlled tendons). I have 3 Hitec HS-725BB winch
    | servos that are supposed to turn 4 times stop to stop. 1mS is
    | supposed to be one extreme of travel, 1.5 is middle and 2mS is the
    | other extreme. The pulse refreshes every 21mS. I hooked them up to
    | my stamp (Pin0 to the signal wire) with a 4xAA battery pack to the
    | power inputs. Just to find the extremes of travel I wrote:
    |
    | puls var word
    | tick var byte
    | loop:
    | puls = 500
    | gosub hit
    | debug "reverse", cr
    | puls = 1000
    | gosub hit
    | goto loop
    |
    | hit:
    | for tick = 1 to tick
    | pulsout 0, puls
    | pause 15
    | next
    |
    | All this does is go-stop-go-stop in one direction. The reverse debug
    | never appears. Does the BSII-SX have a different pulsout (meaning
    | not
    | 2 microseconds*puls in my program)? Why are these servos misbehaving?
    |
    | Thanks for your help!
    | chris
    |
    | I have played with the pause (problem with refresh time?)
    |
    |
    |
    |
    |
    |
  • ArchiverArchiver Posts: 46,084
    edited 2000-09-20 01:29
    YOY! Thanks for the fresh pair of eyes!

    Also, I figured that there was no significant difference in the
    pulsout command--because Parallax didn't send me any update with my
    kit. As it turns out the BSII-SX increments pulses in .8 microsecond
    chunks,not 2 microsecond chunks as in the manual.

    Thanks again,
    chris

    --- In basicstamps@egroups.com, "Bruce" <breyno2@r...> wrote:
    > P.S. You'll need to assign some value to the variable tick as well.
    > IE,, tick = 100..?
    >
    > Bruce
    >
    >
    >
    >
    Original Message
    > From: "Chris Luomanen" <luomanen@e...>
    > To: <basicstamps@egroups.com>
    > Sent: Tuesday, September 19, 2000 5:28 PM
    > Subject: [noparse][[/noparse]basicstamps] Servo Control
    >
    >
    > | Hi, I'm Chris Luomanen. I was wondering if any of you could
    answer
    > | my
    > | question. I did a project with a BS-II, got interested in this
    stuff
    > | and purchased a BSII-SX for a project I am doing (a squirming
    worm
    > | robot with servo controlled tendons). I have 3 Hitec HS-725BB
    winch
    > | servos that are supposed to turn 4 times stop to stop. 1mS is
    > | supposed to be one extreme of travel, 1.5 is middle and 2mS is
    the
    > | other extreme. The pulse refreshes every 21mS. I hooked them up
    to
    > | my stamp (Pin0 to the signal wire) with a 4xAA battery pack to
    the
    > | power inputs. Just to find the extremes of travel I wrote:
    > |
    > | puls var word
    > | tick var byte
    > | loop:
    > | puls = 500
    > | gosub hit
    > | debug "reverse", cr
    > | puls = 1000
    > | gosub hit
    > | goto loop
    > |
    > | hit:
    > | for tick = 1 to tick
    > | pulsout 0, puls
    > | pause 15
    > | next
    > |
    > | All this does is go-stop-go-stop in one direction. The reverse
    debug
    > | never appears. Does the BSII-SX have a different pulsout (meaning
    > | not
    > | 2 microseconds*puls in my program)? Why are these servos
    misbehaving?
    > |
    > | Thanks for your help!
    > | chris
    > |
    > | I have played with the pause (problem with refresh time?)
    > |
    > |
    > |
    > |
    > |
    > |
  • ArchiverArchiver Posts: 46,084
    edited 2000-12-28 20:52
    Hi,
    Does anyone know how to reverse a servo with the "pulsout"
    command? I'm using a Basic Stamp I and a Futaba servo hacked
    for 360 rotation.

    Thx a lot
  • ArchiverArchiver Posts: 46,084
    edited 2000-12-29 01:08
    Hi,
    Does anyone know how to reverse a servo with the "pulsout"
    command? I'm using a Basic Stamp I and a Futaba servo hacked
    for 360 rotation.

    Thx a lot
  • ArchiverArchiver Posts: 46,084
    edited 2000-12-29 19:20
    Hello,
    Thanks for everyone who helped me. My servo works now!!

    -Yu-Jia

    On 30 Dec 2000, at 9:14, William Cox wrote:

    > http://www.gorobotics.net/servohack.shtml
    > -William
    >
    >
    >
    Original Message
    > From: Yu-Jia Zhu <admin@G...>
    > To: <basicstamps@egroups.com>
    > Sent: Thursday, December 28, 2000 3:52 PM
    > Subject: [noparse][[/noparse]basicstamps] Servo Control
    >
    >
    > > Hi,
    > > Does anyone know how to reverse a servo with the "pulsout"
    > > command? I'm using a Basic Stamp I and a Futaba servo hacked
    > > for 360 rotation.
    > >
    > > Thx a lot
    > >
    > >
    > >
    > >
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-12-30 02:28

    Original Message
    From: Yu-Jia Zhu <admin@G...>
    To: <basicstamps@egroups.com>
    Sent: Thursday, December 28, 2000 8:08 PM
    Subject: [noparse][[/noparse]basicstamps] Servo Control


    > Hi,
    > Does anyone know how to reverse a servo with the "pulsout"
    > command? I'm using a Basic Stamp I and a Futaba servo hacked
    > for 360 rotation.

    If your servo is properly hacked, it should not move for 1.5 ms pulses, go
    in one direction for pulses greater than 1.5 ms, and the reverse direction
    for pulses shorter than 1.5 ms. As you approach the minimum pulse of 1 ms
    and the maximum pulse of 2 ms, the speed should increase.

    Ray McArthur
  • ArchiverArchiver Posts: 46,084
    edited 2000-12-30 14:14
    http://www.gorobotics.net/servohack.shtml
    -William


    Original Message
    From: Yu-Jia Zhu <admin@G...>
    To: <basicstamps@egroups.com>
    Sent: Thursday, December 28, 2000 3:52 PM
    Subject: [noparse][[/noparse]basicstamps] Servo Control


    > Hi,
    > Does anyone know how to reverse a servo with the "pulsout"
    > command? I'm using a Basic Stamp I and a Futaba servo hacked
    > for 360 rotation.
    >
    > Thx a lot
    >
    >
    >
    >
Sign In or Register to comment.