I am attempting to power a 12v DC motor attached to an L293Ne, connected to an Arduino Uno.
I'm hoping to power both the Arduino and the motor from the same wall-connected power supply. This is the configuration I've concluded would work. At this point I'm not dealing with PWM - I'd just like to flip its direction.
Am I missing something obvious, or do you reckon I'm good to go? This is my first attempt with the Arduino, and any advice would be greatly appreciated.
Misread the photo initially. Connect as per the schematic and you're good to go. (Connect 12V to the chip's pin 8.)
Edit: Correction - you need to connect pins 4 and 5 to ground as well, not just to each other.
And, just to confirm, presumably the motor will only draw as much current as it needs - and so if it's a 300mA motor and the power supply is 1A, then nothing should blow up?
PossiblyHeroin:
Fantastic, thank you very much OldSteve
No problem.
And, just to confirm, presumably the motor will only draw as much current as it needs - and so if it's a 300mA motor and the power supply is 1A, then nothing should blow up?
Thanks again.
That actually depends on how heavily the motor is loaded. Startup current will be several times running current, but a capacitor across the motor supply will alleviate that. Under heavy load, though, the motor could easily draw 1A. If you're not loading it too heavily, you shouldn't have problems. Just keep an eye on the temperature of the chip. The L293NE can handle 1A continuous, or 2A peak, but they're notorious for getting hot, due to the saturation voltage of the output transistors.
Normally the ground pins can be connected to a large area of copper on a PCB, to act as a heatsink, but that's not possible on a breadboard.
That can't possibly work. The L293NE does not have a 5V output. It requires 5V input for the internal logic. Perhaps you misunderstand the wiring.
Indeed I did - thank you for the clarification
So, if I'm understanding correctly, the 12V 1A power supply (via the power port) is powering the Arduino directly, the H bridge, as well as the motor via the VIn.
Do not attempt to power the motor from the Arduino 5V output pin, as it can damage the Arduino or interfere with its function.
Would you recommend I power the Arduino independently of the motor (not via the VIn)? Does this cause harm to the Arduino or lead to interference?
Would you recommend I power the Arduino independently of the motor (not via the VIn)?
That is usually best.
Your present setup seems to work, but if the motor draws more current than the power supply can provide, the Arduino will reset.
Motors draw what is called the "stall current" every time they start up, as well as when very heavily loaded or stalled. As already pointed out by OldSteve, this can be 5 - 10x the running current.