Microcontroller Interfacing –  Part 12

Using PNP Transistors to Switch Higher Voltage Loads

  

Goals

The easiest way to switch a higher power load than a microcontroller can handle is to use an NPN transistor as explained in Part 7.   Part 8 showed how to use a PNP transistor allowing the load to be at ground potential, as is sometimes necessary.  One limitation with the circuit described in Part 8 is that the load can’t run on a voltage higher than the microcontroller’s supply voltage.  This chapter shows  how to drive a higher voltage load that must be at ground.

High Side Switching

The circuits described in Parts 7 and 8 are pretty simple and if the application allows, are a good way to go. Unfortunately your application may have requirements that those circuits won’t meet.  Automotive applications for example usually require driving a grounded load with 12V.  Figure 12-1 shows one way to accomplish this.  In this circuit microcontroller port pin P0 turns NPN transistor Q1 on and off.  Q1 in turn handles the higher voltage and currents that the micro can’t handle to turn PNP transistor Q2 on and off. Q2 acts as the switch that supplies power to the load.

Let’s suppose the load is a 12V lamp that runs at .5 A. The first step is to select the transistor that switches the load.  A search though our parts bin produces a TIP32C transistor in a TO-22 case. That looks beefy.  Will it work?  Table 1 shows some key specs.  Note that the specs for the TIP32 have negative numbers. This is backwards than specs for NPN transistors.  This is because current directions are in the opposite directions with the two transistor types. Base current flows into an NPN transistor, but flows out of a PNP transistor.  We can ignore the polarity when we do the calculations.

NPN transistor driving a PNP transistor

Figure 12-1

Vceo is -100V. That is well above the 12V that drives the load.  It can handle 3A of collector current which is well above the load current, so it looks like a good candidate.  The next step is to determine what it will take to drive  a TIP32.

The minimum HFE, or gain of a TIP32C is 10 with a collector current (Ic) of 3A is 10.  We won’t be switching nearly that much current and the HFE will be higher under those conditions, but we want our designs to be reliable and reproducible, so we use the conservative value of 10. The collector current of a transistor is the base current multiplied by the gain.

Ic = Ib * HFE

Rearranging the equation gives us

Ib = Ic/HFE = .5A/ 10  = .05A, or 50ma

This means that transistor Q1 must sink at least 50ma.  Another important parameter for Q1 is to be able to handle the load supply voltage, V+ on Figure 12-1. Another search of the parts bin produces a 2N2222A transistor. Its specs are in Table 1.

From our calculations above, Ib2 is 50ma minimum.  Ib2 is also the collector current of Q1 if you ignore current supplied by R3, which we will do for now.  We need to select a value for R2 that will allow 50ma to flow from V+ through the emitter-base junction of Q2 through R2 and into the collector of Q1. Thus Ib2 is the same as Ic1.Ohm’s law tells us the value of R2 is

R2 = Vr2/Ir2

We know that the current through R2, Ir2,  is 50 ma.  What is the voltage across R2? That will be V+ (12V) minus the base emitter voltage, Vbe(sat),  of Q2 and the Vce(sat) of Q1. From Table 1

Vr2 = V - Vbe2  - Vce1  = 12 -1.8 - .3   =  9.9 V

Knowing the voltage across R2 and the desired current Ohm’s Law says:

R2 = V/I  = 9.9/.05 = 198 ohms

TIP32C Key Specs

Vceo                   -100V

Ic                         -3A

Vce(sat)               -1.2V

Vbe(sat)              -1.8V

HFE  (I c =3 A)     10

2N222A Key Specs

Vceo                     40V

Ic                           600 ma

Vce(sat)                .3 V

Vbe(sat)                1.2V

HFE (Ic = 150ma)   50

Table 1

Since 198 ohms is not a standard resistor value we will use a 220 ohm resistor.  I might consider using a the next standard value resistor less than 198 ohms to increase the current and improve the margins.  The problem here is that 50ma is quite a bit of current for a resistor.  Consider this

P = I*I*R = .050 * .050 * 198 = .495W

We will need at least a 1/2W resistor.  If we use a lower value resistor the current will increase slightly, but since power is related to the square of the current, the power dissipated will go up fast. So what do we do? So far we have been conservative in our estimates and used a worst case value for HFE, the gain of the transistor.  Chances are the gain will be much higher than 50 so we could get by with less base current, maybe quite a bit less. 

If I were just making one or two copies of this circuit, and these were the only PNP power transistors I had on hand,  I would try a larger value for R2, maybe approaching 1K. I could tweak the circuit until it worked properly and did not burn up resistors.  If I were designing a circuit for mass production this would be a bad idea. Sooner or later a batch of boards would be produced where the components had a mix of parameters that did not work. Or worse yet, they would test OK in the factory but fail in the field.

In a production design, a better option would be finding a PNP power transistor with a higher gain so less base current would be required. One option might be a Darlington transistor. Darlington pairs are two transistors in an array so the gain of the two transistors are multiplied together to give the gain of the device.  One possible part is a TIP117 which has a minimum gain of 500.  A TIP117 would only need 1ma, or 1/50th  the base current of the TIP32 we started with.  Rather than start all over in the calculations, we will continue the design with the TIP32C.

The next step is to calculate the value for R1.  R1 will limit the base current through Q1.  Since Q1 is acting as a switch to turn on Q2, we need to drive Q1 into saturation.  We know the base current multiplied by the gain will be the collector current. Switching that equation around and plugging in the parameters for Q1, a 2N2222 we had in our parts box we get

Ib1 = Ic1/HFE = .050/50  = .001A

We have the current through R1. Now we need the voltage across it. As explained in Part 2, the voltage across the loop must be zero.  Since the micro is running off 5V, the voltage at P0 when it is set high will also be near 5V.  Other than the resistor R1, the only other circuit element in the loop is Q1’s base-emitter junction. The data sheet says this value,  Vbe(sat) = 1.2V.  So:

Vr1 = Vp0 – Vbe  = 5 – 1.2 = 3.8V.

By Ohm’s law

R = V/I  = 3.8/.001 = 3800 or 3.8K ohms.

These values will give 1ma of base current though Q1. That is probably enough, but we can increase it quite a bit and give more margin for out of spec parts and other real world issues by using a lower value resistor.  Let’s pick a 2.2K resistor. Plugging that in,

Ib1 = V/R =3.8/2200 = .0017A

This would give us a collector current of

Ib * HFE = .0017 X 50 = .086A

This is more than the .050A required to drive Q2 into saturation. Just to be sure this value will not cause problems we see that the maximum base current for a TIP32C, Ibmax  is 3A, and Ic for Q1 is .6A.  This is not even close to the limits of our transistors.

Arduino I/O Expander

We now only need to figure the values of a few more components.  The first is R3.  When we want the load turned off, the base off Q2 must be at a  voltage near or higher than its emitter.  R3 will supply that voltage.  The only thing we need to be concerned with is if the value is too low, and Q1 is turned on, current will flow through R3 and through R2 and Q1.  If the value of R3 is too low, there will be more current through R2, which will raise the voltage of the base of Q2. This could prevent Q2 from fully turning on. 

A good rule of thumb would be to make R3 at least 10 times the value of R2. This will not increase the current through Q1 and R2 much. We already checked to see that we are not near the maximum collector current for Q1, so a bit more won’t harm anything.

The final resistor is R4.  When the system is turned on, there might be a some transient currents though P0 which could turn on Q1 and ultimately the load.  If the load is a motor or other device that could cause damage if the load is turned on until the micro is in full control, R4 would help prevent (but not guarantee) Q1 from being  turned on.  If the load is an LED or other device where a brief flash would not cause problems, R4 can be left off.  A rule of thumb of around 10X the value of R1 will be a good starting point for this resistor.

Finally, there is D1. As explained in earlier sections, we want to put the diode in the circuit if the load is inductive to protect the switching transistors. Motors, solenoids, and relays are all inductive loads.  If the load is purely resistive, D1 can be skipped.

Summary

Sometimes the design requirements require more than a single transistor when the load requires more voltage and/or current than the micro is capable of handling.  Using an NPN transistor to drive a PNP transistor will allow driving a grounded load with higher voltages and currents.

  

Gotcha List

1. Be sure both transistors can handle the voltage supplying the load.

2. Ensure the PNP transistor can handle the current required by the load.

3. Pick a PNP transistor with good gain to minimize base current requirements and excessive power consumption.

4. Protect the transistor with a snubbing diode if the load is a relay, solenoid, motor or otherwise inductive.

  

© 2009 - 2014 Gary C. Sutcliffe

  

¸

Created with the QTH.com SiteBuilder.