H-bridge questions: shoot-through and base voltage

I want to build a line-following robot and I want to use Locked Anti-Phase Drive (where PWM toggles the motor back and forth between drive and brake, no 'coast'). For learning purposes, I'm building my own H-bridge. I know there are many H-bridge ICs there, but I want the learning experience.

My motors will have about 1A stall current (though I never plan to stall them) but if I want to slam them into reverse from forward, I believe that will result in up to 2A of current through the bridge. My robot will run on 4xAAA NiMH, so about 5.8V when fully charged. From what I understand, it's a hassle to drive FETs at this low voltage... and since my current requirements are low and efficiency is not a priority, I'd like to use BJTs as documented on this website:

http://www.robotroom.com/BipolarHBridge.html

( I am also looking at these websites for reference: http://modularcircuits.tantosonline.com/blog/articles/h-bridge-secrets/h-bridges-the-basics/ http://www.mcmanis.com/chuck/robotics/tutorial/h-bridge/bjt-circuit.html http://www.talkingelectronics.com/projects/H-Bridge/H-Bridge-1.html )

My first question has to do with shoot-through. Not shoot-through from inappropriate inputs, but, briefly when toggling one side of the bridge from lower NPN to the upper PNP as is done in Locked Anti-Phase. Looking at the ZTX1049A/ZTX968 datasheets, looks like the PNP turns on in 120ns an the NPN turns off in 380ns so for at least 260ns we have something approximating a dead short, yes? What strategies are available (or preferred) to combat this? I.e., one Atmega output pin per transistor and time them conservatively vs. using a single Atmega output pin per side with additional components?

My second question has to do with base vs collector/emitter voltages. Since base voltage (5.0V or 3.3V) from the Atmega output pin will be lower than the NPN collector/emitter voltage, I fear I may not saturate the transistor (not turning fully ON) which is Bad. (See: http://letsmakerobots.com/node/9450 "you will need the voltage at the base to be at least 0.6V higher than the emmiter voltage. This is often a problem if you are driving motors at a higher voltage than the MPU" but it is unclear if this is referring to FET only or all transistors). Given the information on the datasheet, how do I make sure I fully saturate the transistor given the lower base voltage / higher collector/emitter voltage? And does a similar (opposite?) problem manifest on the PNP transistor?

Datasheets: www.diodes.com/datasheets/ZTX1049A.pdf www.diodes.com/datasheets/ZTX968.pdf

EDIT: So, according to this: http://forum.arduino.cc//index.php?topic=109152.30 the voltage problem is indeed a problem and the solution is to add more transistors. So it will be a lot less hassle to stick a diode on the battery pack and run everything at the same 5V...

"you will need the voltage at the base to be at least 0.6V higher than the emmiter voltage. This is often a problem if you are driving motors at a higher voltage than the MPU"

well to answer this tiny little bit, for the low-side transistor, the emitter would normally be at ground volts, so you will have no trouble driving the base to at least 0.6V higher than that.

Driving the high-side of the H is going to be more of a problem, it depends what sort of transistor you use.

michinyon: well to answer this tiny little bit, for the low-side transistor, the emitter would normally be at ground volts, so you will have no trouble driving the base to at least 0.6V higher than that.

Awesome, thanks! That's good -- so I'm looking at the datasheet for the low side NPN BJT, and it shows VBE(sat) as 0.95V. So as long as I drive the base to at least 0.95V with enough current to saturate, it doesn't matter what the collector voltage is?

Driving the high-side of the H is going to be more of a problem, it depends what sort of transistor you use

Yeah that seems to be a sticky point -- getting enough voltage on the PNP base to turn it fully off. Reading the datasheet, it looks like VBE(sat) is -1.05V. Now if I directly connect the PNP base to the Atmega pin (well, through a current-limiting resistor), will I be able to turn the PNP BJT fully OFF with a HIGH signal greater than 1.05V (and with sufficient current) and it doesn't matter what the emitter voltage is?

If so, that makes life easy and the the only remaining problem is not burning out the Atmega pin with excessive voltage when we take it LOW. I believe the PNP's body diode (at least 0.83V VBE(on)) means that a 5.8V emitter voltage shows up as 4.97V at the base, correct? If so, this would seem to be within the Atmega's specifications (if I run it at ~5V)?

EDIT: So, I found http://www.calculatoredge.com/electronics/BJT.htm which shows that with a 5.8V supply and 5.0V / 20mA / 250 Ohm on the base and an Hfe of 100 you get about 1.9A output. Output does go down as the base voltage decreases, so with say 3.3V base and all else being equal, you only get 1.2A out of the transistor. So, I think this gives me the information I need for the NPN low side.

The only remaining question is for the PNP high side -- how do we calculate how much voltage is needed to fully turn it off? Is it simply VBE(sat) or is it something else like the emitter voltage minus VBE(sat)? I have a suspicion it's the latter.

In order to get low saturation voltage @ 1.9A motor current, you need to drive the transistors with much more than 20mA base current. Ignore the hfe figure of the transistors, what matters is the Vce(sat) and the Ic and Ib at which it is measured. I suggest you use this circuit:

but adjust the transistor types and component values to suit. This circuit also solves the problem of providing the correct base drive to the PNP transistors.

[EDIT: I suggest R1 = R2 = R3 = R4 = 100 ohms, also R5 = R6 = 100 ohms, and R7 = R8 = 1K.]

[EDIT 2: I just realised that this arrangement doesn't give you the 'brake' feature you are looking for.]

dc42:
In order to get low saturation voltage @ 1.9A motor current, you need to drive the transistors with much more than 20mA base current.

What saturation current should I design for to accommodate a 2A load? With an hFE of 200 (ZTX1049A) and 16.4mA on the base, that online calculator reports over 3A – is that enough?

I also found http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=53533 which suggests that for a PNP, Ve minus VBE(on) is what you need on the base to turn the thing off.

Ignore the hfe figure of the transistors, what matters is the Vce(sat) and the Ic and Ib

Sorry for being dense – I’m trying to understand this – but doesn’t the hFE change what Ic you get from the Ib?

The hfe refers to the linear operating range of the transistor. You are trying to use it as a switch, which isn't in the linear operating range. The datasheet for the ZTX1049A gives the minimum hfe as 200 @ Ic=4A and 300@Ic=1A, but in both cases at Vce=2V. So if you supply 16.4mA to the base when switching 3A and rely on those hfe values, your only guarantee is that Vce (the voltage drop between collector and emitter) will be no more than 2v. This is far too high for two reasons: (1) you only have 5.8V to start with, so you can't afford to lose 2V of it in each transistor; (b) at 1.9A collector current and Vce=2V, the power dissipation would be 3.8W, which would very quickly fry the transistor.

To get a handle on how the transistor is guaranteed to behave as a switch, you need to look at the Vce(sat) values. The datasheet quotes Vce(sat) as 180mV maximum @ Ic = 2A, Ib = 10mA. This indicates that 10mA is enough to switch 2A. I have to confess that this took me by surprise, since more usually, Vce(sat) @ Ic=2A would be specified at Ib=100mA or Ib=200mA.

The graph of typical characteristics suggests that at 2A collector current, increasing the base current from 10mA to 20mA will cause Vce(sat) to drop somewhat, but little will be gained by using more than 20mA. So your 16.4mA is about right for these particular transistors.

dc42: The hfe refers to the linear operating range of the transistor. You are trying to use it as a switch, which isn't in the linear operating range.

Ding! The light goes on. :)

The datasheet for the ZTX1049A gives the minimum hfe as 200 @ Ic=4A and 300@Ic=1A, but in both cases at Vce=2V. So if you supply 16.4mA to the base when switching 3A and rely on those hfe values, your only guarantee is that Vce (the voltage drop between collector and emitter) will be no more than 2v. This is far too high for two reasons: (1) you only have 5.8V to start with, so you can't afford to lose 2V of it in each transistor; (b) at 1.9A collector current and Vce=2V, the power dissipation would be 3.8W, which would very quickly fry the transistor.

After reading that three times, I think I got it. We want Vce to be as close to zero as possible. So I look in the Vce(sat) section and find my desired saturation Ic and see what Ib I need to obtain it, and that will tell me what Vce (and how much heat) to expect. Hence, "what matters is the Vce(sat) and the Ic and Ib at which it is measured" just like you said. Thanks for taking the time to educate me!

This indicates that 10mA is enough to switch 2A. I have to confess that this took me by surprise

Well these transistors are supposed to be "high performance" and I'll be paying for that performance (about a buck apiece, hope I don't let the magic smoke out).

So in relation to my 5.8V supply vs 5.0V logic level. For the NPN low-side, I need to calculate my base resistor assuming a 5.0V signal to obtain the Ib mentioned earlier and the rest will take care of itself.

Now for the PNP high-side, I have to turn my brain upside down. Let's run the Atmega at 5.3V. When the pin is LOW, it will tolerate 5.8V appearing on it...

Voltage on any Pin except RESET with respect to Ground ................................-0.5V to VCC+0.5V

...and the PNP's body diode means I should get something less than 5.8V anyway, so I think we're good there.

What I'm not sure of is when the pin is HIGH to switch the PNP off. I think we need at least 4.97V? Now, the pin will be supplying a nominal 5.3V, but won't the base resistor drop that voltage? Perhaps a pullup would help? I see what appear to be pullups on the PNP bases in the circuit dc42 posted as well as some of the other circuits I linked to earlier.

For that matter, I see pulldowns on the NPN bases in some H-bridge circuits -- are those really necessary? Some of the other circuits omit them. I understand why we need them on high-Z CMOS inputs, but it's hard for me to imagine enough EMI to turn on a floating BJT.

EDIT: I see from the ZTX968 datasheet that 50mA Ib is needed for 2A Ic anyway, so I can't drive this directly with an Atmega pin anyway. So I guess I just throw an external transistor at it and not worry about it.

So, applying what I’ve learned, I’ve attached a schematic. For brevity, only half is shown and the flyback/catch diodes have been omitted.

R1 is a pullup to keep the Q1 turned off until PIN1 goes HIGH. I think. When PIN1 goes HIGH and Q3 conducts, R4 limits the current flowing out of the Q1 base.

Supply voltage can exceed logic level as long as care is taken to drive both Q2 and Q3 into saturation.

Of course care must be taken to not allow PIN1 and PIN2 HIGH at the same time, and also PIN2 needs to go LOW a few hundred ns before PIN1 goes HIGH.

I think the motor will even “coast” if PIN1 and PIN2 are both LOW.

That schematic is close to what you need, however it would be better to connect R1 between the base and emitter of Q1, so that Q1 turns off faster. And don't forget the flyback diodes!

A motor is not an inductor. 1A of drive current does not necessarily indicate 1A of short-circuit current, or 2A of reverse drive current.

A PM (permanent magnet) motor, left to spin without power applied, generates voltage. The amount of current and how long it flows depends on a lot of things including the speed, resistance of wiring and contacts, and the inertia stored in whatever spinning parts are attached to it.

I don't know how to tell you what that current will be, I think you'll have to determine it empirically.

Polymorph, the OP has already stated that the stall current is 1A. If the motor is running in one direction, lightly loaded, then it will produce a back emf that is on average just below the drive voltage, Under these conditions, the average current flow if you suddenly reverse the drive will indeed be (almost) twice the stall current, since you have twice the voltage (i.e. applied voltage + back emf) across the winding. If the load on the motor is substantial, the back emf will be lower, and the current flow will therefore be less than twice the stall current.

I see what you are saying. That makes sense. I guess the only thing that the momentum of the system contributes to, is how long it takes to decelerate.

tylernt:

michinyon: well to answer this tiny little bit, for the low-side transistor, the emitter would normally be at ground volts, so you will have no trouble driving the base to at least 0.6V higher than that.

. So as long as I drive the base to at least 0.95V with enough current to saturate, it doesn't matter what the collector voltage is?

Thats not what I said. The emitter will be at ground, so you won't have trouble driving the base at least 1 V higher than that. The collector voltage is another matter, the voltage there will be determined by all the other components. In an H bridge, the collector of the low-side transistor is going to be connected to one side of the motor, normally.

I suggest you use this circuit:

That's the most confusing diagram of an H-bridge that I have ever seen.

If one is attempting a DIY H-bridge, it is probably best to locate somebody that has actually built a working example (I only remember one such person posting in this forum). Most internet h-bridge designs seem to be "conceptual" and probably don't work in the real world. Below is an interesting read on somebody that figured a DIY h-bridge would be easy to make.

http://forum.arduino.cc/index.php?topic=53425.0

Zoomkat, the thread you linked to uses FETs. Is the same circuit applicable to BJTs?

So, in this thread http://forum.arduino.cc/index.php?topic=149469.0

This circuit was mentioned http://www.hvlabs.com/Images/dcmotorcontroller.jpg

…which has diodes paralleled to the gate resistors of FETs to make them turn on slower and turn off faster. Is this technique applicable to the base resistors of BJTs as well? It would really be nice to drive my H-bridge with just two Atmega pins instead of four (proposed half-bridge attached). I may lose ‘coast’ (not sure what happens when the Atmega pin is tri-stated) but I don’t care about that.

Lots of ideas on H-bridge design below.

https://www.google.com/search?q=h-bridge&num=100&lr=&as_qdr=all&tbm=isch&tbo=u&source=univ&sa=X&ei=e91gUqxchfDxBO2QgcAG&ved=0CEEQsAQ&biw=1156&bih=614&dpr=1

zoomkat: Lots of ideas on H-bridge design below.

https://www.google.com/search?q=h-bridge&num=100&lr=&as_qdr=all&tbm=isch&tbo=u&source=univ&sa=X&ei=e91gUqxchfDxBO2QgcAG&ved=0CEEQsAQ&biw=1156&bih=614&dpr=1

I promise I did Google this topic before posting. ;) I'm not a 1-post noob, my first post shows several links to H-bridge web pages that I had studied and I took the effort to read and link to the transistor datasheets (though I hadn't yet learned about hFE and saturation, as dc42 had to point out).

The problem with Googling for "H-bridge" is there are so many out there -- FET, BJT, IC, 4-pin input, 3-pin input, 2-pin input, speed magnitude, locked anti-phase, some that can't brake, some with switching-shoot-through, etc etc. And some of the circuits on the web are just plain bad!

I'd love to just experiment with my circuit in hardware, but I don't have an oscilloscope so it's hard to tell when I do something silly or wrong (even with the 'scope, I probably wouldn't have known to connect R1 to the Q1 base as dc42 suggested). I've been doing software for many years so generally I just jump in the IDE and start writing and re-writing code until I get it right because there is little penalty for mistakes. Doing that with hardware can be expensive when things blow up, so I ask here for advice. (And I've just learned a ton that I didn't know before.) I may end up with an H-bridge identical to one already out there on Google somewhere, but this way I know the hows and whys of every component so I can apply that knowledge to future circuits that aren't on Google. :)

As you seem to be interested in the BJT h-bridges, the below h-bridges might be of interest as they seem to have actually been built and work.

http://www.solarbotics.net/library/circuits/driver_robinson.html

http://www.pyroelectro.com/tutorials/h_bridge_4_transistor/index.html

zoomkat:
As you seem to be interested in the BJT h-bridges, the below h-bridges might be of interest as they seem to have actually been built and work.

http://www.solarbotics.net/library/circuits/driver_robinson.html

10A H-Bridge Motor Controller - Introduction | PyroElectro - News, Projects & Tutorials

I’ve taken a look at both of those. They are both designed on the same principle as the one I linked to in reply #3, in that a single driver transistor turns on the upper transistor on one side of the bridge and the lower transistor on the other side.

The first one uses PNP transistors to turn on the H-bridge transistors. This means that the motor power supply cannot be more than about 1V more than the power supply to the 74HC139. If this chip is being driven from a 5V Arduino, it will be powered from 5V. So the design is suitable for 5V or 6V motors only. The design has trimpots for balancing the motors. However, these rely on the hfe being constant, and hfe varies with temperature; so I can’t recommend this approach. One good thing about the design is that the use of the 74HC139 prevents turning on both the upper and lower transistors at the same time (that is why it uses PNP transistors, because the 74HC239 has active low outputs). Missing from this design are the flyback diodes.

The second one uses darlington transistors. These are among my least favourite devices, because of their high saturation voltage. You can expect to get about 4V or more voltage drop in the H-bridge unless the motor current is low - and if the motor current is low, you are better off using single transistors, such as the ones you were proposing to use. One small redeeming factor is that these particular darlingtons incorporate flyback diodes.