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?

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

2 Answers 2


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!

  • \$\begingroup\$ Ok i'll try that. Btw servos are MG995 both. \$\endgroup\$ Sep 30, 2015 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.

Referring to your added schematic:

  • Large capacitors are definitely needed and the most important step. There should be a large one in front and rear of the voltage regulator, which is connected to your servos. Note that your paralleld capacitors sum their capacitance together and also reduce the total equivalent series resistance (ESR).
  • 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.

If the breaks between each configuration change of the arm are large enough, you could get away with large capacitors only (but likely more than 200 µF). Note that USB devices should not have large capacitances between the supply pins, even if current is usually limited by the USB host.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.