L293NE and 12v DC Motor

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.

Thanks in advance.

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.

Fantastic, thank you very much OldSteve :slight_smile:

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.

PossiblyHeroin:
Fantastic, thank you very much OldSteve :slight_smile:

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.

Do not attempt to power the motor from the Arduino 5V output pin, as it can damage the Arduino or interfere with its function.

Use a separate motor power supply and connect the grounds together.

I powered the Arduino from the 5V on the L293Ne

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.

It is safe to use the Arduino 5V output as the 5V logic power input on the L293.

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 :slight_smile:

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?

Thanks

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.

I see. And would a capacitor compensate for this?

I'm using this as part of a permanent installation, and I'm hoping to use only just one socket.

Thanks

A capacitor can help for startup, but not make up for inadequate component selection.

Just make sure that the power supply can handle at least 2X the current that you believe will EVER be required.

Using this set up is a diode required?

I read elsewhere that a diode is need when using the L293 vs using the L293D.

This diode was recommended.

1N5819

If so, how would that be wired, i.e where does the diode go?

Don't read "elsewhere", read the official datasheet.
See §8.1 & §8.2.

Pieter