Newbie puzzled by H-Bridge

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

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".

Thanks!

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?

Thanks.

6_9.png

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

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.

Ischia:
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. :wink:

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.

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.

Ischia:
So how am I supposed to apply 6V to both bases while still keeping 9V through the collector circuit?

You're not :). To turn the PNP transistor OFF, you need to stop the current from flowing from the emitter to base and out. This means that the voltage at the base cannot be lower than at the emitter (current always flows from higher voltage to lower voltage, just like water at different heights, you see?). You can't do that directly with 6V, because the emitter sees 9V and 9V is always bigger than 6V and therefore current will flow and this will turn the PNP transistor ON. A "converter" is needed, and that's one of the reasons why there are other transistors in an Hbridge besides the "4 switches". If your bridge ran at 6V, then you could use the control 6V signal directly, since with a PNP base at 6V and its emitter also at 6V there's no current flowing.

The simplest "translator" (voltage level translator) is this, a bipolar transistor "inverter":

If you apply 0V at Vin, the transistor is OFF and it's like it's not even there; in this case there's 10V at its colector, due to the resistor (actually depends on how much current flows in the resistor, but let's forget about that now and focus on concept). The voltage at the transistor's colector is the supply voltage, be it 10V as in the example or be it whatever you supply it with.

Now, if you apply let's say 5V to Vin, this will turn on the transistor (current will flow from base to emitter, since base voltage will be higher than emitter voltage) and it will connect its colector to GND.

As you can see, you turned 0V into 10V and 5V into 0V. That's why it's called an inverter and it performs "voltage level translation".

This is not the best way of doing it for an hbridge and there are a few more little details, but I'm just trying to show the concept.

images.jpg