Connect 2 L293D inputs to same arduino pin

Hi All,

This is my first post :slight_smile:

I am using the L293D chip to control 2 dc motors. I was wondering if it is possible to connect input 1&3 together to same ardiuno pin and also input 2&4 to another pin. I will still connect the 2 enables to 2 different arduino pins and control them via PWM. But since only one motor will be controlled at a time wouldn't it be ok to control direction using the same arduino pins as described above to save pins?



Hi and welcome, serenity81.

Please be patient while waiting for answers to your questions, this forum relies on other members like you and me to ask questions, but also on answering these.
No one is obliged to answer questions, no matter if they actually know the answer to it.
Some of us aren't always able to visit on a daily basis.
And lots of us are only able to visit when you are sleeping, or at work or at any other moment you're doing more important stuff than being mesmerised by Arduino stuff.

Your question is a valid one, and the answer can be found in the datasheets of the L293d (click !) and Arduino or its controller.
On page 5 of the L293d datasheet, you can find the electrical characteristics, which also tells about what currents to expect.
The currents specified for those inputs are in the micro Ampere range.
That makes it safe to connect more than a single pin to an Arduino output (which can handle about 20 mA, to be on the safe side)

In case this would not be possible or you don't know for sure, you could use a transistor (and it's base resistor) per port for this.
Remember that when you use a transistor, the output of that might be inverted.

I haven't really looked into other reasons not to do this, but can't think of any.

Thanks for the response. I am new to the forum so I am sorry if i was a bit of a nag :slight_smile:

Thanks for bringing the current thing up; I should have thought of that as well, but what I wanted to know is regardless of current will the L293D short circuit in any way if I connect two of the inputs (One from each side of the chip) to one pin? can the fast switching in anyway short circuit those pins and cause issues to the arduino? I.e in total 4 pins will be connected to arduino input pins 2 for enable/PWM and 2 for direction (for both motors). Maybe you answered my question but I did not get it.


On page 2 of that datasheet, you can see what the direction pins do, and also how to use them.
The example on the left seems to be what you want to do.
See the waveform near pins 2 and 7 ?
See that they are inverted in relation to each other ?
There will be no short internally if you connect them to the same Arduino pin.
You will short the outputs if both inputs are at the same level AND you make enable HIGH.
That will essentially brake your motor, but have no other consequences (as long as you wire the motor correctly).

This means that you can do what you have in mind.

Thanks a lot for your explanation and time helping me out. i will go with you advise.

TC and have a nice day

You can connect several inputs to one output, upto a limit (called the fan-out) which
depends on the currents the inputs take (and for fast signals the capacitance of the input
pins). In general you shouldn't have a problem connecting upto 10 inputs to a single Arduino
output. But checking the datasheet is always a good idea to see the input currents.

Connecting two outputs together is a different matter - they can fight each other and
cause damage, so avoid this unless you know when and how this rule can be broken.

So in my case its the first scenario i.e multi input to 1 output not the second scenario. So it should work, am I correct?

MarkT was the first one to mention connecting outputs in this thread.
Connecting outputs and shorting outputs isn't necessarily the same.
What i was speaking about is creating an electronic brake for your motor (by shorting its wires).
MarkT mentioned combining outputs, which is meant to allow for a higher current to flow through that combination.
You didn't mention you were out to do that, but that doesn't mean you weren't planning on doing so.
But you mentioned 2 motors which would be controlled the same way, but at any time only one of these motors would be enabled by a PWM signal.
This second scenario as you call it, doesn't apply to your question, but it shows that this L293d is has many applications.
I have no doubt that MarkT made that remark so others looking at your thread won't draw incorrect conclusions and make quite catastrophic mistakes.

Ah ok great , because i got confused. Since your original advice is still valid i will go with it.