Go Down

Topic: Newbie puzzled by H-Bridge (Read 19355 times) previous topic - next topic


And the subject has been well covered too both from a lay standpoint and a techie standpoint. PNP transistors are difficult for most to understand. I do it by remembering they are opposite... JAM current into an NPN base to turn it on (Neg earth or ground reference) and Pull current OUT of the PNP base to turn it on both turning on exactly the same way just one reversed from the other and most important is that the most positive element (again neg earth) for a PNP Must be the Emitter and for an NPN the collector of course. I had a hell of a time with that as when transistors became commercially available in the late 50's 59-60 they were all pnp types (my first one was a bright blue CK722 from Raytheon... terrible little delicate and very leaky devices that cost $10.00 ea (a Very respectable sum converted to today's dollars).
I learned on vacuum tubes and what a journey it's been... I remember the first Blue LED's from Cree, really delicate > 5 mA was usually fatal.
and about $30.00 ea If I remember right...
From tubes to Quantum physics all in 50 years. WOW

--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard


Jun 09, 2012, 09:34 am Last Edit: Jun 09, 2012, 09:40 am by terryking228 Reason: 1
This discussion is a great example of the way people on this forum are into IdeaStuff and helping others.  

From tubes to Quantum physics all in 50 years. WOW

I am very fortunate to have been able to take this Trip, in 60 years in my case since I first built something with a vacuum tube.

WARNING: Terry feels Another Story coming on...

Just when I thought all that was obsolete knowledge, two guys showed up at my office door at IBM. "Uh, we heard you know something about vacuum tubes.".

"Yeah, did that in the Old Days!".

"We have this electron beam welder. It just stopped working.  It has a huge tube in it, a 4-1000A. Every heard of something like that?"

"Well, it's almost exactly like a 4-400A, but bigger. It must look like this:".  (Reaching up on my shelf and taking down the 4-400A souvenir from my Broadcast days in it's box, and taking it out).

"Yes! That's exactly what it looks like! You have one on your shelf?? Wow!"

"OK, what's the symptom? Let's go look at your machine"...

"The high voltage is there, the tube filament lights up, but almost no beam current any more."

...An hour later, we determined that the Screen resistor was open (my first guess). I brought a workable large temporary resistor in from my Ham Radio junkbox at home the next day and it worked until the right replacement part came in from  Siemens...

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info


For the last 30 minutes I've been staring at the circuit posted by P18F4550.

From a practical standpoint, it makes it easier to see how, when for instance X2-2 on the right gets 5V (say), T6 opens and triggers T2 and T4.

However, I'm trying to understand why this works: in my imagination, I see current being "pulled" away from the T4 base, therefore opening it. Fine, but how does this relate to what I've read elsewhere, with the base getting 0V to open and 5V to close? I'm having difficulty visualizing what happens at the T4 base there, since the only thing I see is the emitter getting 5V.

I didn't think a tiny three-legged object could be this mysterious...


John Bardeen won the Nobel Prize in Physics twice, once for this little 3-legged device...
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info


I didn't think a tiny three-legged object could be this mysterious...

Weekend reading material:

Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0


Thank you zoomkat, I've been reading that and several dozen more specific search terms for a week :)


OK I've actually built the aforementioned H-bridge with 2N2907/2N2222 which I almost fried because the motor was drawing 4 amps, bla bla, I'll try again with TIP130/135 as someone suggested...

The question is: how do I trigger the "top" (PNP) transistors in the bridge with the Arduino? I know how to trigger the "bottom" NPN ones (just attach an output pin to the base and send a +5V HIGH value) -- does that mean that for the PNP pair I have to send a HIGH value at sketch launch to the base and then just set it to LOW to open the transistor?

Sorry if it's obvious, I just would not to fry my Uno on my first project. Thank you.


Yes, you would set your Arduino output LOW to turn the PNP transistor "on".


Something still escapes me here. Like I wrote, I'd like to use a low voltage (from Arduino) to control the H-Bridge, which in turn uses a larger voltage source (such as 9V). The attached schematic is the right-hand side of the bridge. Don't mind the specific transistor types, these will probably change, the importance is the PNP/NPN layout.

The problem with this is that I get 5.3V at the bottom NPN base (which is fine) but 8.3V at the top PNP base. All grounds are connected together, and I can't have "two different grounds" can I? So how am I supposed to apply 6V to both bases while still keeping 9V through the collector circuit?



Jun 13, 2012, 02:47 pm Last Edit: Jun 13, 2012, 02:56 pm by boredat20 Reason: 1
I don't understand your question. The larger voltage source is power for your load (motor) only, your Arduino provides the control for the transistors which operate in PNP + NPN pairs. 5v to the NPN base and GND to the corresponding PNP turns your motor one way. Do the same to the other set and it turns the other way. You're never aplying 6v(?) to both bases.

Have you considered buying an H-bridge IC like an l293 or something similar depending on the specs you are looking for.

Alternatively use P18F4550's schematic (on the first page of this thread) and you can control each transistor pair with one Arduino pin.

Not sure if this helped.


I'm not applying 6V to both bases of course, I just pasted one side of the bridge -- because it's symmetrical, what's happening at the bottom part of the above diagram is equivalent to what happens to the opposite part (diagonally) in the real circuit.

When I activate the top gate, (by connecting the PNP base to ground), the voltage across the base resistor is not the same as the one on the NPN (bottom) base resistor (which I connect to 6V in order to open its gate). This is because the top PNP resistor gets its power from a 9V source and not from the 6V. So actually in the above diagram it's Ground "relative" to 9V that's opening the gate, not "relative" to 6V. Therefore base resistor voltage is not the same (and therefore current, if I don't change the resistor).

I thought this circuit needed to be symmetrical, so I don't know if I should change the top (PNP) base resistor so that the base current is the same as the bottom (NPN) base current, or if I should wire this up completely differently... As you probably see it's related to my earlier confusion with the way PNP transistors work.

I already have a 293 lying around, but I'm a real beginner and I'd like to understand the basics before I tackle ICs. When I understand what's going on in the real circuit I'd happily avoid building one from scratch :)

I hope my question is clearer.


OK, I think I understand now.

In my opinion, your next step should be to take a look at the datasheets for both transistors that you're using. That should give you all the information you need to select the appropriate resistor to turn them "fully on". Remember, a BJT is a "current controlled" device, i.e. the amount of current through the base determines how "on" the transistor is, and there is some amount of current that will turn the transistor "fully on". You'll find all of that and more in the datasheet.

Then, try hooking up an actual motor and measure the voltage across the terminals running both ways. Same for current draw. If your motor is turning at the speed you want, and the current draw and voltage at the motor are roughly equal running each way, I'd say you've been successful.


When I activate the top gate, (by connecting the PNP base to ground), the voltage across the base resistor is not the same as the one on the NPN (bottom) base resistor (which I connect to 6V in order to open its gate). This is because the top PNP resistor gets its power from a 9V source and not from the 6V.

I think I understand your question, and I like it. ;)

I have an H-bridge controller for my robot car, and I take your point about how the Arduino, which can only put out 5V can control a motor running at (say) 8V.

This is the schematic:


It seems to be inverted compared to the earlier one, but my impression here is that they are using, on the high side, a BC847C transistor to switch the MOSFET. Look at T2 and R5 for example. The MOSFET U1A is connected to "high" (eg 8V) via a 10K resistor. But when you turn on T2 by applying a small voltage to its base it switches the gate of U1A to Gnd, thus turning it off.

So I think the answer is: a small transistor is used as a buffer for the high-side stuff.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics


My little H-bridge (uses superbeta transistor pairs in surface mount packages for small size) includes a bridge-rectifier to provide the protection diodes (which some of the circuits above are missing I notice).

The way I've drawn it is to switch the H around so its more like an X, which makes the driver stage easier to see I think:

  (consider that circuit creative commons licenced BTW)

The driver stage will work happily from 3V3 or 5V logic - the BC847B's turn on both the PNP and NPN to saturation, you just have to be careful not to switch on both BC847's simultaneously.  R1/R2/R3/R4 are there to provide faster turn-off, probably not necessary.
Using matched NPN/PNP transistors in a single package is more for low-cost and convenience than any need to precisely match transistors.

R5 and R6 (220 ohms in the diagram) set the base current and are meant for 6V supply (provide 20mA or so which means the main transistors saturate at Vce = 0.15V for 1A load), meaning no heatsink needed.  The PBSS4032 transistors have guaranteed gain of 200 at 4A collector current and max peak current of 10A, so they will handle start-up transients (though would overheat on sustained over-current).  Its meant for small motors that take upto 2A max really.

For 12V operation I use 470ohms for R5 and R6 (220 ohm resistors would over-heat).

What I like about this design is its simplicity, the automatic current-limiting and that it doesn't use Darlington output stages (which would totally compromise the low-voltage performance by using up 2.5V of the supply!).  The down-side is that R5/R6 need to be selected for the voltage/current requirements (too small and you waste power in them and the current limit is too large, too large a value of R5/R6 and there isn't enough drive for the motor).

MOSFET output stages have the advantage of built-in diodes, but aren't as easy to drive unless the supply voltage happens to be the same as Vgs.  However for more demanding Hbridge applications you can team up a MOSFET H-bridge driver chip with all n-channel MOSFETs, which will handle faster switching and higher loads.

I've recently been working on a brushless motor controller using the FAN7388 3-phase MOSFET driver (3 half-H-bridges) and it makes things very simple (its rated to 600V even!).  Alas surface mount only.  I've also used the HIP4081 H-bridge driver which is available in DIP.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up