Good day sir/ma'am. We are currently working on a hexapod with 3 DOF(18 servos),we are using Arduino ADK MEGA and Tower Pro SG-5010. we are using a power supply of a personal computer for our servos,5V 45A. Our goal is to use atleast 10 pins of arduino mega adk for our servo motors, upon trying it, we were able to use 7 pins only. whenever we connect the 8th servo to our 8th pin in arduino, all servos connected on the board malfunctions (for example, some of the servos go to 0 or 180 degrees position, which is wrong because our loaded position of servos is 90 degrees to 120 degrees).
this is our loaded program:
#include <Servo.h>
Servo servoa; // Define a servo
Servo servob;
Servo servoc;
Servo servod;
Servo servoe;
Servo servof;
Servo servog;
Servo servoh;
int i,j,k;
int a=90;
int b=90;
int c=90;
int d=90;
int e=90;
int f=90;
int g=90;
int h=90;
void setup() {
servoa.attach(10); // RightA(4,6)
servob.attach(9); // LeftA(2)
servoc.attach(8); // RightB(4,6)
servod.attach(7); // LeftB(2)
servoe.attach(6); // LeftA(1,3)
servof.attach(5); // RightA(5)
servog.attach(4); // LeftB(1,3)
servoh.attach(3); // RightB(5)
servoa.write(a);
servob.write(b);
servoc.write(c);
servod.write(d);
servoe.write(e);
servof.write(f);
servog.write(g);
servoh.write(h);
}
void loop() { // Loop through motion tests
delay(5000);
for(i=1;i<=30;i++){
a++;
b--;
c++;
d--;
servoa.write(a);
servob.write(b);
servoc.write(c);
servod.write(d);
delay(15);
}
for(i=1;i<=30;i++){
c--;
d++;
servoc.write(c);
servod.write(d);
delay(9);
}
for(i=1;i<=30;i++){
a--;
b++;
e++;
f--;
g++;
h--;
servoa.write(a);
servob.write(b);
servoe.write(e);
servof.write(f);
servog.write(g);
servoh.write(h);
delay(20);
}
for(i=1;i<=30;i++){
g--;
h++;
servog.write(g);
servoh.write(h);
delay(9);
}
for(i=1;i<=30;i++){
e--;
f++;
servoe.write(e);
servof.write(f);
delay(9);
}
}
thank you for reading