- Thu Jun 28, 2012 4:11 am
#146719
Hey guys, I've searched google for this, and poked around these boards but haven't found a solution. Most of the googled solutions I found were blamed on bad R/C equipment, which doesn't really apply to me.
tl;dr - 24 servos are twitching in a repeating pattern when they should be stationary. Hooked up to an Arduino Mega 2560
I'm building my own copy of the Chopsticks bot that I saw on Make's website, using a bunch of Polymorph, some chopsticks, and 24 mini-servos. I've got it all built and have done some of the basic programing to tweak the leg positions, but for some reason even though all the servos should be stationary, they all twitch in the same repeating pattern. Given the spindly nature of the robot, this eventually builds up a resonance and the thing flings itself about.
Video of the problem, you can see the twitchy pattern repeates every two seconds or so: http://youtu.be/BTn4Uj-rhs0
Can anyone give me some guidance on where the problem might be? I should clarify that the servos are being powered via an external 5v wall-wart, not from the Arduino's 5v line.
Code:
tl;dr - 24 servos are twitching in a repeating pattern when they should be stationary. Hooked up to an Arduino Mega 2560
I'm building my own copy of the Chopsticks bot that I saw on Make's website, using a bunch of Polymorph, some chopsticks, and 24 mini-servos. I've got it all built and have done some of the basic programing to tweak the leg positions, but for some reason even though all the servos should be stationary, they all twitch in the same repeating pattern. Given the spindly nature of the robot, this eventually builds up a resonance and the thing flings itself about.
Video of the problem, you can see the twitchy pattern repeates every two seconds or so: http://youtu.be/BTn4Uj-rhs0
Can anyone give me some guidance on where the problem might be? I should clarify that the servos are being powered via an external 5v wall-wart, not from the Arduino's 5v line.
Code:
Code: Select all
#include <Servo.h>
int svt[24]; // used for calculations for servo positions
int svp[24]; // actual servo positions
int svc[72]={ //storing servo settings for different positions
90,90,90,90,
110,110,110,100,
130,130,130,130,
55,50,50,50,
70,75,75,70,
80,100,100,90,
90,90,90,90,
90,90,90,90,
90,90,90,90,
90,90,90,90,
90,90,90,90,
90,90,90,90,
90,90,90,90,
90,90,90,90,
90,90,90,90,
90,90,90,90,
90,90,90,90,
90,90,90,90,
};
Servo sv[24]; //create servo array
/*
All lables are front to back
26 27 28 29 - righ hip
0 1 2 3
30 31 32 33 - right thigh
4 5 6 7
34 35 36 37 - right knees
8 9 10 11
53 52 51 50 - left knee
12 13 14 15
49 48 47 46 - left thigh
16 17 18 19
45 44 43 42 - left hip
20 21 22 23
*/
void setup()
{
for(int i=0;i<24;i++) //Loading center positions
{
svp[i]=svc[i];
}
for(int i=0; i<13; i++) //attaching right side servos
{
sv[i].attach(26+i);
}
for(int i=12; i<24; i++) //attaching left side servos
{
sv[i].attach(30+i);
}
Serial.begin(9600);
}
void loop()
{
for(int i=0;i<24;i++) //writing positions to servos
{
sv[i].write(svp[i]);
}
}