Motors run when power supplied to Arduino but not shield

I am currently using the 2DW Robot Chassis supplied by this site. 2 geared DC motors are used. I am controlling the motors with an Arduino Leonardo and a motor driver that is essentially identical to Adafruit’s Motor Driver v2.0. The issue is that when I supply power to the Arduino via either the USB cable (attached to my laptop) or via the power jack (with a 12V DC supply), the motors do what my code tells them to do. However, when I supply power to the motor shield via the power terminals using either 5, 6, or 8 AA batteries, the motors seem to just do whatever they want. They start by jerking around a little, then run continuously until I disconnect a battery. I have the VIN jumper attached to the shield, and the Arduino power LED says that it is on; it just doesn’t seem to be transferring the proper instructions, but it does when I power the Arduino and not the shield. In all cases, the power LED on the shield is on.

Hi

It sounds like the same thing I described a few threads down robotshop.com/forum/my-sketch-runs-in-two-different-ways-t14578#p124642. I can’t tell from your picture but if you are trying to power both from the same power source that could be the problem. once I separated the power supplies everything worked fine.

The amount of power the arduino gobbles up was shocking to me.

Thanks for the reply. I thought so, but then how do you add an external DC power source to the Arduino when the robot is supposed to be mobile? What if it needs to go somewhere that isn’t near an outlet? How did you add your separate power supply? Or do you mean that you added a separate battery pack for the arduino?

I added a 9V battery for the arduino for my first small project but found that it did not last near as long as I thought it would so I am planning on a separate 6XAA rechargeable pack for my next one. It will be much larger though and able to handle the weight. Glad I could help.

After I posted yesterday I did some more research and it turns out that most of these “brownouts” are caused by back EMF generated through motor brush noise. If you don’t want to go through the hassle of separate power supplies, it seems that the easiest solution would be to obtain a motor shield with diodes to protect from back EMF (SparkFun’s Ardumoto for example), or to solder three 0.1 uF caps to each motor. Either solution will prevent current spikes from spontaneously resetting the arduino

Hi,

Your frequent Arduino resets come most probably from a brownout indeed.
The common cause of these brownouts is when using additional devices like motors or electromagnetic relays connected to the same power supply as the Arduino.
The best way to avoid the brownout is to supply power to the motors independently of the Arduino (with a common ground).
You can use for example this DFRobot 7.4V Lipo 2200mAh Battery (Arduino Power Jack) to power your Arduino separately from the motors.

Best Regards,