Image of my setupI am making a simple bipedal robot. I have four 9g servos connected to my uno. Whenever I try to even do the simplest command, like move right foot 45 degrees it does not work properly. I have tried on my second Uno and i have the same result.
My program for testing the servos:
#include <Servo.h>
Servo myservo;
void setup(){
myservo.attach(6);
}
void loop(){
myservo.write(45);
}
Each servo wire is attached to a breadboard where they all share power and ground from the arduino. Each servo wire then has another wire going to pins 3,5,6 and 9.
Does anyone know what the problem is and what I can do? Thanks
-
2Maybe it's your wiring. Maybe it's the servos. Maybe four servos are too many for a single Uno to power. Please show your schematic.Majenko– Majenko2016年07月12日 10:05:13 +00:00Commented Jul 12, 2016 at 10:05
-
2Powering one micro-servo through the +5V pin of the Uno should be OK, and I would expect the program you posted to work. Powering four of them may be too much, especially if they are somewhat loaded.Edgar Bonet– Edgar Bonet2016年07月12日 11:24:39 +00:00Commented Jul 12, 2016 at 11:24
-
1Please let us know how the +V and 0V connections to the servos are made. Ideally they should be connected to an external battery or something similar.Andy– Andy2016年07月12日 12:02:29 +00:00Commented Jul 12, 2016 at 12:02
2 Answers 2
An Arduino is not capable of powering four servos. Power them externally, but make sure the ground of the Arduino and servos is connected.
-
This has done nothing. Also I believe an arduino can power four servos but I tested it anyway.Stratmoss– Stratmoss2016年07月12日 10:22:31 +00:00Commented Jul 12, 2016 at 10:22
-
Could you share your current setup of the servos and the Arduino?Len– Len2016年07月12日 11:17:51 +00:00Commented Jul 12, 2016 at 11:17
-
Have you even tried powering the servos externally?Len– Len2016年07月12日 11:59:30 +00:00Commented Jul 12, 2016 at 11:59
-
1I don't think this answer should have been marked down - the arduino's regulator really isn't suitable for directly supplying power to that many servos as Len has said, partly due to electrical noise etc.Andy– Andy2016年07月12日 12:00:54 +00:00Commented Jul 12, 2016 at 12:00
-
2I strongly advise against using the Arduino Uno to power your servos. The maximum current of the VCC and GND pins is 200 mA according to their official documentation. You can go over a bit, but 500 mA? That's just asking for a failure in your Arduino device. Power the servos from an external power source, connect the grounds of the servos and the Arduino and you're good to go.Len– Len2016年07月12日 12:57:18 +00:00Commented Jul 12, 2016 at 12:57
As others have said, the Arduino cannot drive 4 servos - my experience is that it can have problems powering one if you try to move it too often due to the voltage drop caused by the high current consumption. When you move a servo the power consumption rises considerably. A large (220uF or more) capacitor near he servo can help, but even so, by far the best option is to supply the servos from a separate supply.
If the Uno resets when you try to move the servos (especially multiple times per second) then the power supply is most likely your culprit.