# Problem Running Multiple Servos - AVR

I am making a simple robotic arm with atmega8 using two servos(two joints), I am using Software PWM of AVR and it is working damn perfectly for one servo. Then i attach another servo and both does random movements (sometimes don't move, sometimes out-of-bound), then while power on if i detach one then the other attached one starts to work correctly.. I think this is some voltage or current problem? Btw i am powering my board with computer usb port 5v. No need to ask for code because it is ok because one servo does well until other joins. A little bit same question is asked by someone here but no one answered there so i wrote my own..

EDIT(1): Upon getting answers that i have to connect external power supply for servos, i think making a small external circuit would work like this here, would this work?

• The servos are probably tanking you rail. Try powering the servos from a different source and see what happens. – vini_i Sep 29 '15 at 16:27
• 95% of these types of issues are power related. – Matt Young Sep 29 '15 at 16:50
• I am powering from usb 2.0 means 500mA i.e. 0.5A.Is there any appropriate current rating for servo? – Mohammad Sheriyar Sid Sep 29 '15 at 16:51
• Ok @vini_i , trying that – Mohammad Sheriyar Sid Sep 29 '15 at 16:52
• @MohammadSheriyarSid Normally when a servo operates continuously it's not a problem. It's the startup current that tends to be the problem. – vini_i Sep 29 '15 at 16:55

You do not mention which servos you are using, but it sounds like your 2 combined servos are drawing more current than the computer's USB connection can supply.

Computer USB ports are notorious for not being able to supply a lot of current.

First you might try plugging into a self-powered USB hub rather than directly into the computer. These can sometimes supply more current than a computer USB port.

If that doesn't work, next I'd try powering the servos directly from a 5V DC power supply that can provide a couple of amps.

Report back if any of these fix the problem!

• Ok i'll try that. Btw servos are MG995 both. – Mohammad Sheriyar Sid Sep 30 '15 at 7:07

As bigjosh states those servos will draw a lot of current. Especially so while they are far away from the desired position.
If your supply cant provide the needed current the voltage in your system will drop. Your AVR is likely to run into a brownout or even a blackout then. I have seen similar concepts and they resulted either in erratic movements of the joints or in a reset of the microcontroller.

• The 7805 is a linear regulator, therefore the voltage drop $\Delta V= 12 V - 5 V$ leads to a power of $p(t) = \Delta V \cdot i_{Servos}$, which it will dissipate as heat. Thus it is inefficient and could require an additional heatsink. Consider using a switching regulator instead. The Tracopower TSRN 1-2450 is Pin Compatible to the 7805 and delivers up to 1 A.