i have a personal challenge that is to make a arduino avoidance robot it has a"hc-sr04 ultrasonic sensor, a servo, bread board(for the sharing of vcc and gnd), l9110s motor driver, and two dc motors, and also the arduino uno itself" but when i assembled it and upload the code it works if it's plugged in my laptop but if i plugged it in to a battery it keeps on restarting and doesn't run <code>enter image description here</code>

  • 1
    please provide more info. Do you mean a 9V alkaline cell to power the whole system? If so this is a common beginners problem where the battery does not provide enough power.
    – MichaelT
    Oct 28 '18 at 10:32
  • PP3 batteries are, to put it mildly, complete and utter rubbish. Only suitable for powering smoke alarms. Not suitable for use with Arduino under any circumstances.
    – Majenko
    Oct 28 '18 at 10:54
  • a 9V battery contains six AAAA cells ..... those would barely work in a tv remote control, let alone powering a motor
    – jsotola
    Oct 28 '18 at 16:01

Let me guess: the Arduino resets just as one of the motors starts (or should start) right?

The 9v battery is incapable of supplying enough current for much of anything but a few LEDs. When the Arduino first turns on a motor, it needs, and tries to draw, more current than the battery can supply, resulting in the battery voltage dropping below the Arduino's voltage-regulator's minimum input voltage, and the Arduino is shut off. That stops the current draw, the battery voltage recovers, power up the Arduino, which resets (as they always do on power-up), and the cycle keeps repeating.

Try powering it from a more capable battery of greater than 7 volts. 5 AA cells in series, for example would provide 7.5 volts. This won't last terribly long but should work for a while. A second (third, ...) string of 5 in parallel with the first should double the life. Using C or D cells instead will increase the life a lot more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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