BS2 Drives 16 Servos!
erco
Posts: 20,257
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
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!
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"...
(BIG smiles!)
I musta watched the clip 10 times - it was mesmerizing....
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!
So how many degrees of freedom does that thing have?
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.
@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.