hi,
I am making a hexapod robot using the arduino mega. For this I need to drive a lot of servo motors. When I place the hexapod on its legs, the motors have no problem keeping up.
The problem I have is when I force one of the servos in a position it wasn't programmed for, the arduino stops driving the other servos. All servos lose their power and the robot trips.
I am driving the motors with an external power supply with plenty of power. My guess is that the problem lays in the library.
The code I am using is built up like this:
rutger13:
The problem I have is when I force one of the servos in a position it wasn't programmed for, the arduino stops driving the other servos. All servos lose their power and the robot trips.
The Arduino cannot know when you force a servo so the problem must be with your power supply.
How many servos are there and how many amps can the power supply provide?
I assume that this
I am driving the motors with an external power supply
means that the power for the servos is NOT coming through the Arduino.
Please read the post at the start of any forum , entitled "How to use this Forum".
OR http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Thanks for the quick respond,
The arduino mega is connected via usb to my computer. The power supply is connected to all of the vcc pins of the servo and the vin pin on the board. I connected the ground from the power supply with the ground of the board.
The power supply can provide 6V 7A. The power usage never passed 5A. The problem occurs even with only two servos.
The power comes not through the arduino. The signal is.
Hi,
You code sets the servos to 140Degrees.
If you mechanically force the servo shaft away from 140Degrees, you will make the servo try and turn back to 140, this means a large amount of current will flow through the servo to provide the opposing torque.
Have you got a DMM to measure your power supply voltage when you "force" the servo shaft?
Can you post a picture of your project so we can see your component layout.
Sorry for posting code the wrong way. The servos I am using are the mg996r. It is true that the amount of current doubles when you push on it, but it still never reaches the limit of the power supply.
When I push on the motors the voltage drops by 0.1.
While the Mega is powered from the USB cable the Vin connection is unnecessary.
If you are only powering the Arduino from the Vin pin (i.e. with no USB cable connected) then the current draw from the servos may pull the voltage too low for the Arduino.
To start with try giving the Arduino a separate power supply - perhaps a pack of 3 x AA cells (4.5v) connected to the 5v pin.
You have not said how you have measured the 5 amp power usage. A multimeter won't be fast enough to catch transients - for example the start-up load when a servo begins to move.
That explains why the motors where acting even weirder when I disconnected the usb cable.
I measured the amperage by placing a DMM in series with the arduino. What you are saying is that the peek power draw (not measurable) is probably too much for my power supply right?
The thing is that it also happens with only two servo motors in which case the amperage never exceeds 2 amps.
I made a custom PCB so you won't see anything on the picture. I have wired it as shown in the scematic. I have checked for short circuit, but did not find any.
Is it possible that that the signal power is too weak to drive the motors when I apply force on one of them?
No the signal to the servos is not the problem except that, as you are trying to run the Arduino with 6V into Vin, you're causing it to fail. Vin needs 7V minimum.
But if your system relies on you forcing the servos against the position the signal is sending them to then a) you're stalling the servos making them draw maximum current and b) it won't be long before you need new servos.
Hi,
A picture of your custom board would be good, how wide have you made the conductors that supply power to the servos?
How have you got your gnd conductors configured on your board?
I made the power tracks as wide as possible(2.5mm). When all tracks where routed I made a mask covering all empty places on both sides of the board and connected it to all grounds. I hope the images are clear enough.
project link: scorpion mega - EasyEDA open source hardware lab
Hi,
I have done some testing with an arduino uno without the pcb and found out it does not have the same problem. I used the same motors, same power supply, supposedly the same setup. This time the motors where way stronger and when I mechanically rotate the shaft, the other still holds its power. This means there is probably something wrong with my pcb.
Hi,
Where on your PCB is the gnd connection to the Mega.
Can you check for continuity between the negative/gnd of the 7V servo supply and the Mega gnd?
HOW did you measure current draw.
Should be done with a scope, so you see peak current, not only average current.
The MG996R draws 2.5Amp EACH at stall (or starting to move).
So how many servos?...
A 6volt/7A supply would be ok for three servos.
Leo..
hi,
I am sorry for the late response. It is indeed a power problem. I connected my DMM to one of the servo plugs. When I push on one of the servos the voltage drops from 5.5v to 3.7v .
The ground of the arduino is connected to the ground of the power supply.
unfortunately, I don't owna scope to measure peek current draw.
I don't understand why the voltage drops so much. My DMM measurement never exceeded 2 amp. The voltage only raised when I released the servo after 2 seconds. That is long enough for the DMM to measure the amperage right?