I have Arduino Leonardo with motor shield of 2 L293Ds on my small 4 motors rover.
When powered from USB all works fine, although seems to lack a power a bit.
But when I connect a battery pack of brand new 5 batteries (8V in total) to external power connector on the motor shield, the code proccessing seems to be interputed after a few secs (if connected into Arduino, lights are on but nothing happens).
When 2 batteries are replaced for ones of lower voltage (5.6 V in total) nothing happens at all.
What I am doing wrong?
The short answer is "separately, with grounds commoned at one point"
You should never power motors or servos directly from a USB supply - this risks
damaging something much more expensive than the Arduino or motorshield.
In general if you use the same power rail for motors and logic circuitry, you are
asking for trouble. Drop-outs, spikes and noise will plague you, you may even
fry something.
Thank you for your replies!
I use this shield: Arduino Playground - AdafruitMotorShield
it has EXT_Power connector from L293Ds pins and if connected to battery pack, Arduino is powered as well.
How should I use separete power circuits to powering both Arduino and motors (do I in this case)?
Isaac96:
Well, remove the 'Vin connect' jumper. Then connect the motor battery pack to the EXT_PWR terminal block and the arduino battery to the barrel jack.
I did it, but the same problem. Everytime when turned on it acts unpredictably.
jarvirta: Your are experiencing excatly the same problem as I am, while I have even the same platform!
I've even build my own controll board a couple of years before and was still experiencing the same problem. Having that said, I am deeply convinced at the moment (with new electronics and code), that the problem originates from motors noise.
Altought I had been of the opinion that flyback diodes in L293Ds may handle major spikes and noise, I have entirely neglect brush contacts as Grumpy_Mike mentioned.
Thank you very much for sharing the issue!