Driving One Stepper Motor With L293D Using Two Pins

Question: Is it correct, that when I solder the following circuit there are only two pins nessessary
from the microcontroller to the L293D to drive a unipolar stepper motor ?

Answer: Yes. That is correct.

Question: Are the two NPN transistors and the 10kOhm pull-up resistors responsible for the signal inversion?

Answer: Yes. That is correct.



(Circuit from here)

There is a lot of information about the L293D on LMR and the web. But somehow I'm still unsecure if this circuit makes it possible to drive the stepper motor with only two control cables from the microcontroller to the L293D.

The stepper motor I use is the 28BYJ-48. With this stepper motor you need to make the following wiring:

  • Pink  is 1 out
  • Orange is 2 out
  • Yellow is 3 out
  • Orange is 4 out

There is a nice complement

There is a nice complement IC that creates the needed pulses for the L293. It’s name is L297. You feed it Direction, Step and other settings like full step or half step if I remember correctly.

Regarding your schematic, it seems correct and I think it will work fine.

Yet a Conceptual Problem?

After I have soldered four drivers I found that only two of them run fine. Two others not. One shivers the stepper. One does nothing.

While I was certain that it is my fault due to a solder failure (that I have not found) or a damaged H-bridge (that I have changed but got the same results) the LMR mogul pointed out that there might be indeed a conceptual problem with the circuit that is shown above (not the one from maxhirez).

So here is our shoutbox conversation (read from bottom to top, bottom is oldest, top is newest):


mogul: sure, but maybe I should comment instead…
mogul: with 1k you will have approx 4ma driving the base, and then with say 100 times amplification you could drive plenty collector ma
NilsB: mogul, may I copy&paste this conversation to the comments?
mogul: which of cause is impossible, and will kill the transistor
mogul: more or less, yes, its because a transistor is current amplifying a current, and without you will have infinite input,
NilsB: the 1kOhm is just to prevent short-circuit, right? Ohm’s Law.
mogul: just make them all four 1K, then you are sure you will saturate everything
mogul: jup,
NilsB: the 10kOhm is the pull-up resistor, right?
mogul: i think i would have chosen the opposite values
NilsB: ah… let me think…
mogul: and then i dont understand why your base resistor is 1K and the collector resistor is 10K
mogul: i dont like that one. you do have a constant current on two coils all the time
NilsB: the enable pins are always HIGH
NilsB: the original one
mogul: or max’ enhanced one?
mogul: the original one here:https://www.robotshop.com/letsmakerobots/node/32208?
NilsB: I am going to add my comments in the forum. but for now I guess the Fluke is my friend.
NilsB: mogul, it works. it does work. two of four identical circuits run perfect. two not. one shivers the motor, the other does nothing.


This is the NPN transistor I

This is the NPN transistor I use: S8050 D331 NPN Transistor 


How to Debug the Circuit?

mogul: also, without the motor connected, the circuit should only draw a few mA, please verify
 mogul: and by measure, i mean, volt between gnd and the pin
NilsB: ah mogul. thank you. I do that now.
mogul: 1in and 4in should be low,. 2in and 3in should be high
NilsB: My debug strategy was: Check each element. If there is a anomaly this might be the bug.
mogul: apply power, and measure the 4 input pins on the L293D
mogul: start wiring the two control lines low, and umplug the motor
NilsB: …how shall I find out if all components of the circuit are fine. This is my challenge now.


If voltage (aprox. 7V) is

If voltage (aprox. 7V) is applyed to the circuit that does shiver the driver motor then I see the following measurements:

1in = 0.55V
2in = 1.28V
3in = 2.29V
4in = 1.61V

If the same voltage is applyed to the working circuit this is the results:

1in = 0.54V
2in = 1.16V
3in = 1.91V
4in = 1.44V

As far as I understand LOW should be around 0V and HIGH around VCC -1.5V (that is due to the voltage drop in the L293D (see disadvantages here)) so this should be 7V-1.5V= 6.5V.

Next Measurement. Pin 7 (2in) is higher than expected.


If voltage (aprox. 3.7V) is applyed to the circuit that does shiver the driver motor then I see the following measurements:

1in = 0.57V
2in = 1.49V
3in = 3.41V
4in = 2.91V

If the same voltage is applyed to the working circuit this is the results:

1in = 0.57V
2in = 0.69V
3in = 3.61V
4in = 3.01V


Possible Problem: Enable Pins are Permanently High

Also LMR merser pointed out that there might be a problem having the enable pins permanently to HIGH.

In the datasheet it says:

"Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an enable input is high, the associated drivers are enabled and their outputs are active and in phase with their inputs. When the enable input is low, those drivers are disabled and their outputs are off and in the high-impedance state. With the proper data inputs, each pair of drivers forms a full-H (or bridge) reversible drive suitable for solenoid or motor applications."

Here is the conversation from the shoutbox:


merser: perhaps you should connect a dc motor to the circuit the way I have to see what I mean about the continual drive with en tied
 merser: yeah you could use 3 that way
 merser: I don’t think it can be good for a stepper either
 merser: It’s pretty harsh on a gear motor when it is continually driving in one direction and then swapped in the other
NilsB: ok fine. then I need four pins or 3 if enables are looped. right?
merser: yep
NilsB: so I connect the enable to the microcontroller?
merser: Just a loop
merser: switch enables for both back on
NilsB: but I need a trigger to do that.
merser: swap control 1 and 2
merser: No switch 1,2 and 3,4 enable off
NilsB: so 3,4en switch with 3in and 1,2en swith with 2in
merser: in that process
merser: switch enables back on
merser: change controls
merser: as in switch enable off
NilsB: shall I bind them to the pull-up resistor?
merser: It’s only microseconds but it might matter
NilsB: switching them… yes…
merser: when you step
merser: try switching them instead
NilsB: yes. enables permanently to 5v.
merser: yeah
NilsB: the circuit you mean?
merser: do you have the enables tied permanently to Postive?


I can’t say I understand how the circuit functions, but,

the page the information is coming from is http://www.tigoe.com/pcomp/code/circuits/motors/stepper-motors/

According to the page NilsB needs to drive his two pins with 1 0, 0 0, 0 1, 1 1. Further down the page states that the previous order is half out, or, 0 1, 1 1, 1 0, 0 0.

Neither one of those make any sense to me though.

This isn’t really a reply, but,

it relates. So, here it is.

I looked at the “Further Reading” on your actual machine post. You show an image from the datasheet on your stepper motors. Your stepper motor wires are numbered differently from the page I linked to above. Pink and Orange will be either 1 and 2 or 3 and 4. Yellow and Blue will be 3 and 4 or 1 and 2 in that order.

According to your

According to your observation I soldered it like as follows and it works fine.

  • Pink  is 1
  • Orange is 2
  • Yellow is 3
  • Orange is 4