Shop OBEX P1 Docs P2 Docs Learn Events
BS2 Drives 16 Servos! — Parallax Forums

BS2 Drives 16 Servos!

ercoerco Posts: 20,256
edited 2012-02-02 09:56 in BASIC Stamp
That BS2 is a champ! Here it's just oscillating the sixteen servos back & forth out of phase, but I was pleased to see the BS2 deliver smooth motion to all servos. There's another thread at http://forums.parallax.com/showthread.php?137368-servo-controller-help where main man Duane got 32 servos moving using a Prop, but I had to answer the call and I thought it deserved a new thread here in the Stamp Forum. Thanks to Beau for ideas to help crunch the code down. Now to make it do something USEFUL with those 16 servos! :)
' {$STAMP BS2}
' {$PBASIC 2.5}
'modified beau code!
'servo pulsout range 400-950
W0=0
a CON 34
x CON 0    'step
j CON 400  'minimum pulse width
k CON 550  'delta pulse width
DO
PULSOUT 0,W0+j
W0=((W0+a)//k)
PULSOUT 1,W0+j
W0=((W0+a)//k)
PULSOUT 2,W0+j
W0=((W0+a)//k)
PULSOUT 3,W0+j
W0=((W0+a)//k)
PULSOUT 4,W0+j
W0=((W0+a)//k)
PULSOUT 5,W0+j
W0=((W0+a)//k)
PULSOUT 6,W0+j
W0=((W0+a)//k)
PULSOUT 7,W0+j
W0=((W0+a)//k)
PULSOUT 8,W0+j
W0=((W0+a)//k)
PULSOUT 9,W0+j
W0=((W0+a)//k)
PULSOUT 10,W0+j
W0=((W0+a)//k)
PULSOUT 11,W0+j
W0=((W0+a)//k)
PULSOUT 12,W0+j
W0=((W0+a)//k)
PULSOUT 13,W0+j
W0=((W0+a)//k)
PULSOUT 14,W0+j
W0=((W0+a)//k)
PULSOUT 15,W0+j
W0=((W0+a)//k)
'W0=W0+x  '  optional delay
LOOP

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-02-02 01:15
    Very, very, cool erco.

    I like the way they switch from a slow oscillation to fast oscillation.

    The movement looks really smooth. Do know if you're refreshing the servos at 50Hz?

    I'm still trying to figure out what to do with all my servos. I know I want to make a walking robot. I haven't decided on the exact kind yet.

    Fun stuff!
  • ercoerco Posts: 20,256
    edited 2012-02-02 08:37
    Duane Degn wrote: »
    The movement looks really smooth. Do know if you're refreshing the servos at 50Hz?

    I was pleasantly surprised how smooth the motion was. I haven't measured the refresh rate yet, but it's gotta be under 50 hz. The cumulative pulsout duration alone is (16x ~1.350ms)=21.6ms, plus execution time. As I mentioned, I'm using bulk Chinese 9g servos, which may be more forgiving on low refresh rates than premium Futabas.

    And to answer your next question: Yes, I am only using one "cog"... :)
  • davejamesdavejames Posts: 4,047
    edited 2012-02-02 08:51
    erco wrote: »
    And to answer your next question: Yes, I am only using one "cog"... :)

    (BIG smiles!)

    I musta watched the clip 10 times - it was mesmerizing....
  • ercoerco Posts: 20,256
    edited 2012-02-02 09:08
    Duane Degn wrote: »
    I'm still trying to figure out what to do with all my servos. I know I want to make a walking robot. I haven't decided on the exact kind yet.

    Duane: I'm sold on making a sssssimple ssssssnake, but you and your Propeller have 32 servos on one cog (and 8 times that potential); you need a suitable challenge. THIS is the animal I want you to replicate in silicon & servos: http://www.youtube.com/watch?v=jfuOn3rxdy8

    See to it, Man!
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-02-02 09:12
    erco wrote: »
    Duane: I'm sold on making a sssssimple ssssssnake, but you, YOU have 32 servos on one cog (and 8 times that potential); you need a suitable challenge. THIS is the animal I want you to replicate in silicon & servos: http://www.youtube.com/watch?v=jfuOn3rxdy8

    See to it, Man!

    So how many degrees of freedom does that thing have?
  • ercoerco Posts: 20,256
    edited 2012-02-02 09:40
    Duane Degn wrote: »
    So how many degrees of freedom does that thing have?

    Since it escaped, it has infinite freedom! :)
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-02-02 09:45
    erco wrote: »
    Since it escaped, it has infinite freedom! :)

    Okay erco, I'm on it. A robot that can escape coming right up.

    Or maybe I'll settle for eight legs. It always bothers me when someone posts a robot "spider" with six legs.
  • ercoerco Posts: 20,256
    edited 2012-02-02 09:56
    davejames wrote: »
    I musta watched the clip 10 times - it was mesmerizing....

    @Dave & Duane: Agreed, just watching the elegant rhythmic flow of the servos is fun. The pity is, when you make a hexapod or octopod, you lose all that visible coolness since all the legs are (of necessity) doing their own thing. It would actually be visually cooler (and easier) to make a long centipede with dozens of legs, like this mecanno unit :
    http://www.youtube.com/watch?v=85RPXRUu_bo&feature=related

    A BS2 could handle that, maybe running 14 servos and 2 inputs.
Sign In or Register to comment.