6 servo motors with arduino uno r3 with external power supply

I am working with 6 ds3218 digital servos which have rating of 4.8-6.8V and stall current at 5V is 1.5A and at 6V is 2.5A.

I am using external supply of 5V to power my servos, it is made sure that the supply provides enough current to make all the servo move together. The ground of the external power supply and Arduino Uno is made common.

I am using Servo.h library to write an angle to all the six motors, the issue I am facing is I am not getting the movement of all the six servos together, there is a time lag between the movement of the servos. The time lag is also inconsistent, it may happen to any servo or servos, following things are observed:

5 servos move together then the 6th servo move
3 together then three together
4 together 2 together
sometimes all 6 together

I am not able to find out why are not all my six servos moving together.

Your suggestions would be appreacited.
Regards.

Do You think posting the code, formatted and i code tags, would help us? I think it would.
Have You measured the voltage near each motor when the problem is present?

1 Like

Likely caused by the delays and serial.Print() in your program.

My code is like the following:

#include <Servo.h>

Servo s[6];

void setup() {
s[0].attach(3);
s[1].attach(5);
s[2].attach(6);
s[3].attach(9);
s[4].attach(10);
s[5].attach(11);

Serial.begin(9600);
}

void loop() {

for(int i=0;i<6;i++)
s[i].writeMicroseconds(2500);

}

and the connection schematic is attached.

I am not specifying any delay

@Railroader please see the code and the schematic

Perhaps you should consider it as you are commanding the servos to move they seldom have a chance to actually move.

2500 us corresponds to 180 degrees, I am manually adjusting the servo arms to 90 degrees before running the code and then as the code runs the servo arms move as commanded.

the problem is that all the six don't move simultaneously

Nothing is done simultaneously with computers. Sometime it may appear that way, but that is because human time scale is relatively slow.

as the servos are connected in parallel to the external power supply of 5V then the voltage across all the servos is 5V only, the connections have been done accurately

I get that but in computer the delay would be in terms of microseconds, but the delay i am observing is like 1 second

Just as a temporary test add a delay(5000) as last statement in loop.
That code is signalling the servos way more often then motivated.

CODE TAGS, use em.

Could the OP post the code and not the like code?

Also, servos need time between torques to be allowed to go to the position, I typically allow for 8mS or so with small increments.

Did you run a program to set the servos to 500uS to see where 0 is? then set the servos to 1500uS to see where the 'middle' is then 2500uS to see where the end is?

Manually turning the servos does not work out well for alignments.

#include <Servo.h>

Servo s[6];

void setup() {
s[0].attach(3);
s[1].attach(5);
s[2].attach(6);
s[3].attach(9);
s[4].attach(10);
s[5].attach(11);

for(int i=0;i<6;i++){
s[i].writeMicroseconds(500);
delay(12);
}

}
void loop() {

for(int i=0;i<6;i++)
{
s[i].writeMicroseconds(2500);
}
}

How serious are about the simultaneous movement? If that is the basis of your whole project, then you need to select servo devices that have the exact same response to your signal. And the selection must be with a whole bunch of servos, you cannot assume.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.