Shop OBEX P1 Docs P2 Docs Learn Events
servo motion — Parallax Forums

servo motion

ArchiverArchiver Posts: 46,084
edited 2000-10-27 18:40 in General Discussion
I have a STD PARALLAX servo that was part of a kit I received from
college. My question is, is there any way I can program the servo to
move in one direction and then reverse directions without going to
the max in each direction before changing? I am using the BASIC 2 to
do the programming with.

Thanks

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-10-26 06:04
    On Tue, 24 Oct 2000 mister@t... wrote:

    > Date: Tue, 24 Oct 2000 17:47:47 -0000
    > From: mister@t...
    > Reply-To: basicstamps@egroups.com
    > To: basicstamps@egroups.com
    > Subject: [noparse][[/noparse]basicstamps] servo motion
    >
    > I have a STD PARALLAX servo that was part of a kit I received from
    > college. My question is, is there any way I can program the servo to
    > move in one direction and then reverse directions without going to
    > the max in each direction before changing? I am using the BASIC 2 to
    > do the programming with.
    >
    > Thanks
    >
    >
    The way it works is you send a timed pulse of a specific length to specify
    the desired position. This must be done about every 20 msecs or so.
    Generally speaking, center position is set by sending a pulse of 1/2 the
    maximum. Many servos use a 1 msec wide pulse, with 1 msec being full ccw,
    2 msec being full cw, and 1.5 msec being center. So you experiment with
    different pulse widths to find the ones that give the throw and direction
    you want. Note that different servos use different timeing, so find out
    what yours uses and have fun!

    Further note: There is an application note for the BS1 on controlling and
    testing servos, page 85 of the version 1.8 BASIC Stamp Manual.
    [noparse];)[/noparse]

    Jerry

    --
    Jerry A. Covington
    jerry@p...
  • ArchiverArchiver Posts: 46,084
    edited 2000-10-27 18:40
    You can make the servo "swing" from side to side with a very simple
    routine. The timimg depends on the version of stamo you are using,
    but it is easy to do the conversion with just some data about each
    stamp. Below is a routine for this:

    '{$stamp bs2sx}
    start:
    for w1=900 to 2750 step 25
    pulsout 4,w1
    pause 20
    next
    for w1=2750 to 900 step 25
    pulsout 20,w1
    pause 20
    next
    goto start

    In this example, the w1 value 900 to 2750 gives an approximate 180deg
    swing, close to a second per swing. The step value determines the
    rate of the swing.

    A setting of about 1800 is close to the center of the servo's
    physical swing.

    Hope this helps!

    Doug

    > To: basicstamps@egroups.com
    > From: "Jerry A. Covington" <jerry@p...>
    > Date: Thu, 26 Oct 2000 01:04:42 -0400 (EDT)
    > Reply-to: basicstamps@egroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] servo motion

    > On Tue, 24 Oct 2000 mister@t... wrote:
    >
    > > Date: Tue, 24 Oct 2000 17:47:47 -0000
    > > From: mister@t...
    > > Reply-To: basicstamps@egroups.com
    > > To: basicstamps@egroups.com
    > > Subject: [noparse][[/noparse]basicstamps] servo motion
    > >
    > > I have a STD PARALLAX servo that was part of a kit I received from
    > > college. My question is, is there any way I can program the servo to
    > > move in one direction and then reverse directions without going to
    > > the max in each direction before changing? I am using the BASIC 2 to
    > > do the programming with.
    > >
    > > Thanks
    > >
    > >
    > The way it works is you send a timed pulse of a specific length to specify
    > the desired position. This must be done about every 20 msecs or so.
    > Generally speaking, center position is set by sending a pulse of 1/2 the
    > maximum. Many servos use a 1 msec wide pulse, with 1 msec being full ccw,
    > 2 msec being full cw, and 1.5 msec being center. So you experiment with
    > different pulse widths to find the ones that give the throw and direction
    > you want. Note that different servos use different timeing, so find out
    > what yours uses and have fun!
    >
    > Further note: There is an application note for the BS1 on controlling and
    > testing servos, page 85 of the version 1.8 BASIC Stamp Manual.
    > [noparse];)[/noparse]
    >
    > Jerry
    >
    > --
    > Jerry A. Covington
    > jerry@p...
    >
    >
    >
    >
    >
Sign In or Register to comment.