Loading...
Pages: [1]   Go Down
Author Topic: Servos Malfunction during connection of 8th servo in 8th assigned pin of arduino  (Read 828 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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(smiley-cool; // 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 smiley
Logged

0
Online Online
Tesla Member
***
Karma: 50
Posts: 6531
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Make sure you are not powering the arduino from the same power source as the servos. What you describe is typically a power supply issue. Also, the servos will operate much better at 6v instead of 5v.
Logged

Why I like my 2005 rio yellow Honda S2000 with the top down, and more!
GOOGLE ADVANCED FORUM SEARCH BELOW!  
Go to:  http://www.google.com/advanced_search?hl=en
put in key search words,
use site or domain:  http://arduino.cc/forum
or in a google search box put key words site:http://arduino.cc/forum

Milton Keynes UK
Offline Offline
Tesla Member
***
Karma: 88
Posts: 6286
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I suggest you start with a single servo and connect it to each of your pins to make sure they're suitable to drive a servo.

Then define multiple servos but only connect one at a time to make sure your control logic works.

Then connect them all to confirm that your power supply is up to the job.
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 20
Posts: 1626
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Multi sweep - sweep upto 12 servos, this will tell you if its your code or something else.

http://rcarduino.blogspot.com/2012/01/can-i-control-more-than-x-servos-with.html

Duane B

rcarduino.blogspot.com
Logged


Pages: [1]   Go Up
Print
 
Jump to: