Dec 19, 2017

Avoid arduino resets caused by servo current spike

Dealing with relatively high torque servo motors powered by the USB port or a power bank through the arduino board may cause a current spike that lowers the voltage and makes the arduino reset... keep reading for a solution for this problem.

When using a weak/limited power supply to feed a servo that carries a load, the initial movement can cause the voltage to drop due to the current demand. If the voltage drops below the microcontoller limits, it will reset, start and try to move it again causing and endless loop that will seem quite odd.
In order to atenuate the effects of the sudden current sinked by a servo motor when it starts a movement, specially if it is moving a load, you can use the combination of a current limiting resistor and a high value capacitor. The resistor should be a low value so that doesn't drop the voltage too much.
In this example schematic I use a 2.2 Ohm resistor and a 1500uF capacitor rated 6.3v (or even better 10v).


4 comments:

  1. Thanks for this tutorial, this helped me a lot five days before a robotic contest :)

    ReplyDelete
  2. I am having the same problem. If I use servo.write(180) I can see the indicator light on my 5V 8A power supply extinguishes momentarily and of course the Arduino resets. If I move the servo to 180 via a loop that has a delay of 15 within it all is good; it just moves slower.If I use the loop with a delay of 5 in it, the power supply is pulled down and the Arduino resets. It is a high torque servo but stiil the stall current is 1A. I also have led indicators. They function correctly under any of the aformentioned software configurations with the servo disconnected. Is there any back EMF with a servo? - Scotty

    ReplyDelete
    Replies
    1. According to this thread: https://forum.arduino.cc/index.php?topic=549262.msg3753564#msg3753564

      "You do not get any back EMF from a servo, the servo motor electronics suppress it and it never appears anywhere."

      Delete