H-bridge Brake question

Discussion in 'General Electronics Chat' started by wannaBinventor, Jun 13, 2010.

  1. wannaBinventor

    Thread Starter Member

    Apr 8, 2010
    I'm using a very basic all NPN H-bridge as featured here. (the one on the left)

    The transistors are 2N2222, the motor is just some radioshak 3v, 800mA motor. Logic signals are sent to the transistor bases through 1k resistors from a 16F84A. I was using 1N4007 as flyback diodes, but the recovery time proved too slow since I was pulsing the motor which resulted in a motor that barely turned. Despite the "dangers," I just removed the flyback diodes.

    I used a stopwatch to measure full power turning to stopped with just coasting and using the "brake button." It would coast to a stop in about 1.5 second while the brake stopped it in ~1 second.

    I'm wondering if this was an expected "brake time" vs. "coast time." I know it's capable of stopping much faster because it can go from forward to reverse on a dime.

    I'm thinking that the "brake" mainly works through the flyback diodes - and as such I'm not going to have much braking. Is this correct?

    With all the appropriate components, how fast should I expect the motor to brake?
  2. SgtWookie


    Jul 17, 2007
    What you really need is diodes that are faster recovery; it would be nice if they have a lower Vf as well. Schottky diodes like 1N5817 thru 1N5819 would work just fine. Simple "fast recovery" diodes would work OK, too.

    Without the reverse-EMF "flywheel" diodes, there is no path for current when the transistors turn off. You're likely to burn up one or more transistors due to their voltage limits being exceeded.

    Using four NPN transistors gets around the dreaded "shoot-through" problem, but only the lower transistors are operating as saturated switches; the upper side transistors are operating as voltage followers. You will find that there is anywhere from 0.7v to 2v from emitter to collector on those upper transistors, depending on the load on the motor. They will dissipate power as heat, and burn up pretty quickly.

    Check out Steve Bolt's H-Bridge:
    It's just about as simple, but minimizes losses in the transistors because they are both being used as saturated switches.

    In your case, you have to be concerned with how much current the motor is drawing. Yours is apparently rated for 800mA @ 3v. If you are running with 5v, you'll have to be certain to not exceed the ratings of the transistors in use.

    The PN/2N2222 and PN/2N2907A transistors are both rated for a maximum Ic of 800mA; but 500mA is more realistic. In order to get 500mA collector current, you really should figure that you will need 1/10 that much current flowing through the bases.

    To calculate the base resistors:
    Rb = (Vsupply - Vbe) / (Ic/10)
    Rb = the base current limiting resistor
    Vsupply = the voltage being applied to the input of Rb
    Vbe = the voltage on the base with respect to the emitter when the transistor is conducting the desired collector current
    Ic = the collector current.

    If you're using 5v for a supply, and if you figure Vbe will be around 0.8v, and you want 500mA collector current, then:
    Rb = (5v-0.8v) / (500mA/10) = 4.2/.05 = 84 Ohms.

    84 Ohms is not a standard value of resistance. A standard table of resistances is here:
    Bookmark that page.
    Looking at the E24 values (green columns), you will see that 84 Ohms is not a standard value, but 82 is. That's close enough.

    Then you'll need to figure out the power rating for the base resistor.
    Since P=E^2/R (Power = Voltage Squared / Resistance), and you have 4.2v across 82 Ohms, power is 215mW. We double that for reliability, so 430mW. You'll need an 82 Ohm, 1/2 Watt resistor for each base.

    Now if you're going to be using a microcontroller for this, you'll have another problem - the uC will have a maximum current source/sink per I/O pin of about 20mA, and you need about 50mA. That's too much to drive directly from most uC's. As a matter of fact, 240 Ohms is the absolute lowest you can go without exceeding the manufacturer's specifications for the I/O pin limit.

    The difference is that you are applying an external voltage, instead of the built-up EMF in the motor either free-wheeling to a stop, or getting stopped a bit faster by shorting the power leads.

    No, you'll get more braking action if you turned on both lower or both upper transistors at the same time. Applying voltage in reverse would give you LOTS more braking action, but would burn up the motor and transistors in a big hurry.
  3. wannaBinventor

    Thread Starter Member

    Apr 8, 2010
    Thanks for the extensive reply Sgt. You are always very helpful.

    Question - Does the divisor of ten in your base resistor formula mean that you are assuming a gain of 10? Is this low for the 2n2222?

    I was banking on 1000 ohms at the base giving me something like 4.25mA (I just used a .75 BtoE drop) x 100 gain = 425mA collector current.
  4. SgtWookie


    Jul 17, 2007
    That's a very valid question.

    Download a datasheet for a PN2222/PN2222A transistor from http://www.onsemi.com
    (OnSemi is a spinoff of Motorola)
    Take a look at figure 4 on page 4, "Collector Saturation Region".
    Note that when Ib=Ic/10, Vce(sat) is at it's lowest point. This means that the power dissipation in the transistor itself will be at the lowest point.

    Basically, when a transistor is "in saturation" it means that increasing the current through the base will not result in an increase in collector current; Vce is as low as it will go.

    You will find that practically all bjt's (bipolar junction transistors) are rated for saturation with Ib=Ic/10.

    You might "get away" with using Ib=Ic/30, but transistors simply don't perform the same. Out of a batch of 100, you might have 10% to 40% that will burn up because their gain wasn't high enough. That would not be acceptable in a production environment; rework costs would go through the roof.
  5. wannaBinventor

    Thread Starter Member

    Apr 8, 2010
    Thanks for helping clear that up.