Let's Make Robots!


I have noticed several people using an H-bridge schematic (commonly circulated on the web) that will work, but if both inputs are high at the same time, can throw a short across the motor power supply.  As long as they never let that happen, these circuits will work, but I consider it unsafe. Since many people here have different levels of expertise in both hardware and software, it is better to use an arrangement that prevents accidentally shorting anything.

Here is a circuit layout with 4 transistors that will drive a motor, but without the chance of shorting the power. In my circuit below, when Q1 is on, Q3 must be off, and when Q2 is on, Q4 must be off.

The reverse EMF diodes can be any fast switching diodes, but Schottky diodes would be preferred. They switch in like 100 picoseconds --(one ten billionth of a second.)


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Circuit diagram reading 101 fail. Sorry Dan.

<grins>  No worries.

As IG said, the capacitor IS across the outputs.  The only way that those extra lead lengths would matter would be if we were working in microwave frequencies.  

>>However, you did make me realise something I did not explain fully.

I mentioned (below) that this circuit could be used with PWM, and I mentioned (above) that the capacitor was optional.  Let me note that those statements go together.  What I mean is that the capacitance can mess up the PWM waveform, so when you are using pulse width modulation (such as for a stepper motor), just leave the capacitor out entirely.  :-)

Follow the connections. The cap is across the outputs.


I have always used the SN754410NE, mainly because it is cheap and available; but really mainly because I understand it and it's nice tidy package.

Is the advantage to your design that is can handle more power, cheaper, etc? Or is it the pride of design that come from using components instead of a package IC?  Just wondering why I see so many people cooking up their own H-bridges.


In my latest project, I actually used L293Ds, (which are pin compatible with your SN754410s).   However, this 'blog page' is meant to be informative for sometimes people have transistors lying around that they could use if they knew how.

I purposely specified commonly available transistors for that reason.  The 2N3904 and 2N3906 are quite common, and so are the 2N2222 and its compliment, the 2N2907, only slightly less so.  They can often be scavenged from old equipment for FREE. (-and as a true Scot, I LUV being frugal...  ha ha)

Even if you must buy some, on the other hand, they are extremely cheap (Well, unless you get them from Radio Shark.)  From my favourite small parts supplier, Satistronics in China these parts sell for the following prices:

2N3904 - Quantity=100 for $2.00    (2 cents each)

2N3906 - Quantity=100 for $3.00    (3 cents each)

  --[Needing two of each of these would bring the cost to 2+2+3+3=10 cents worth of transistors.]

2N2222 - Quantity=100 for $4.00    (4 cents each) but the power transistors are a wee bit pricier at:

TIP142 - Quantity=10 for $5.50  (55 cents each)

TIP147 - Quantity=10 for $3.70  (37 cents each)


   As you see, they are reasonably priced. That company does not sell the SN754410NE, so let me check another place. I do not know what you pay, but I see them at Jameco Electronics for $1.95 each. -not too much more than I paid for L293Ds.

The advantange to Dan M's H-Bridge is that no matter how you set the two signal pins, you can't short anything out like you would with a "normal" H-Bridge. The one disadvantage I see to it is that you can never set the motor to coast, it's always forward, backwards or braked. At least, that's how I see it.

However, it sure beats most H-Bridges I've seen, in simplicity to wire, to use and it's "foolproofness". Good work Dan!

Thank you. The only place there is a "coast" setting in this design is in between the on states. In other words as the voltage at the input raises, the PNPs switch off, before the NPNs can switch on, giving you the occasion of both being off. This is just transitional, though, between switching states.


If you put the microcontroller's output into a Hi-Z state (tri-stating), would that coast the h-bridge?

You can do this in an Arduino, for example:

digitalWrite( pinNumber, LOW );
pinMode( pinNumber, OUTPUT ); // now we're sourcing current, i.e. GND
pinMode( pinNumber, INPUT ); // now we're tri-stated
pinMode( pinNumber, OUTPUT ); // and back again

With a base from each PNP along with a base from each NPN tied together (as per design), I was not sure where the input would float if tri-stated, so I decided to check this by breadboarding it. Measuring at the points where the bases are tied together, I found that one common base point read 0.18 volts while the other read 0.3 volts. The result being that both NPNs were turned off and both PNPs were on, which would hold both ends of the motor at virtual ground.

I am still not certain why they floated at that particular voltage, but I am presuming that it demonstrates a slight difference between 2N3904s and 2N3906s, making the circuit favour the ground rail over the plus rail. One could experiment with biasing resistors to get them to float in the middle but that is likely more trouble than it is worth.

So, at least for the transistors I used, that is the answer.

Oh, and the motor forward and reverse worked properly. In addition, both base inputs high gave a high reading at both ends of the motor and both inputs low gave a low reading at both ends of the motor, so the drive capability worked as planned.