# Switching relay with a PNP and TTL levels

I can not wrap my head around the fact how I can drive a relay (24V, 160ohm) with an tip32a PNP transistor which has TTL inputs from a controller. I can easily calculate my resistors when I use the NPN variant (tip31a), but I cannot conceive how to switch the transistor off with just TTL. The relay will be powered from 29.4V and has a resistor in series to give the appropriate 24V for the relay. And of course there is a diode over the relay.

Any tips will be greatly appreciated, but please note that I at the moment can not use any transistor but the tip32a.

If you have an open-collector or open-drain type logic output, you can drive a PNP with it, as long as the device is rated to take your supply voltage. In this configuration, use a pull-up resistor from the supply to the base of the PNP to ensure that the PNP defaults to the OFF state. Now tie the base of the PNP to the open-collector logic output through a second resistor, the value of which should pull just enough current from the base of the PNP to drive it to saturation.

The values aren't too hard to work out. The pull-up usually wants to be something large-ish, like 50K or 100K. The logic resistor will see the supply voltage, less the saturation E-B drop of the PNP, less the Vce sat of the logic output. Basically, the supply voltage minus about a volt. From there, knowing the necessary base current to the PNP will let you work out the exact value. (Be sure that to saturate, the necessary PNP base current isn't actually greater than the current-sink capacity of the logic pin!)

If you do not have an OC/OD output, you can buffer a regular output signal with a small NPN transistor, like a 2n2222 or 2n3904 etc. A typical TTL output, driving the base of a small NPN through about 1K to 2.2K will give you the sort of open collector (the collector of the NPN) that I've assumed above.

• Thank you, after consulting with one of my coworkers on at my internship earlier today we discovered that there was a problem in Multisim which I had used to verify my answer. Which was the same approach as you describe. – Erik Jun 10 '10 at 16:56
• Do you know any TTL ICs that allow 30V on their OC outputs? (Normal operation voltage, not absolute maximum ratings) – amadeus Oct 4 '13 at 10:48
• @amadeus - The 74LS06 has a 30V max on the outputs. Of course, you generally don't want to run at the max rating, but the stated 29.4 gives at least a little margin (though personally, I'd prefer to see a bit more) – JustJeff Oct 9 '13 at 1:34

You can't switch the PNP on and off with TTL levels. Since the emitter will be tied to 29V the base needs to be at 29V to turn it off. You need to do a level shift using a second transistor which is either an NPN or an N-channel MOSFET.

Using an NPN transistor the current limiting resistor will then be determined by

$R = \dfrac{(29.4 - V_{be1} - V_{ce2})}{I_{b1}}$

where $V_{be1}$ and $I_{b1}$ are for the PNP transistor and $V_{ce2}$ is for the NPN transistor.

Why don't you use an NPN as TIP31/TIP122 transistors? It will be very simple.

If you can't use NPN, use the TIP32 on common emitter, and on the base, put an small-signal NPN, as a 2n2222 on common emitter with a resistor (R1) on the 29V (VCC), put these block together with a resistor (R2), then calculate R2 to the same way you do the calculation on NPN (Saturation condition).

Then go to Rbase of the NPN, make sure it will be on the saturation condition, to the I2 current flowing into it.

The R1 value it's not so important as the above, so use it to achieve a faster switching condition, as the load is slower, put a value that the power is about 1/5 of the max. IC(NPN), it will work good with this case.

If you have any doubts, make an spice simulation to see if it works or not, if the transistors are on saturation and these things...

Good work for you!

• I only half understand, but if R1 is the resistor between the NPN's collector and the TIP's base its value is damn important! The TIP has only low beta, and you have to make sure you saturate it. – Federico Russo Apr 30 '12 at 14:42
• "put these block together with a resistor (R2)". What? – Federico Russo Apr 30 '12 at 14:43

29.4V is only 2% from 30V, and most power supplies have tolerances up to 5%, so that 29.4V might as well be 30.9V.
JustJeff's solution is based on a TTL output with open collector, which sounds like a good idea to cope with the high voltage. If you read the datasheet, however, it shows the 30V output as Absolute Maximum Ratings (AMR). AMR is for exceptional conditions, you're not supposed to operate continuously at those values. So you can't use an open collector output directly.

The alternative is a common push-pull output driving an NPN transistor, which in turn drives the TIP32A. Despite being a Darlington the TIP32A has an extraordinarily low $H_{FE}$: 50 at 1A.

So, supposing you need 1A the base current has to be at least 20mA. That's the NPN's collector current. A BC847C has an $H_{FE}$ of 400 minimum, so that will need 50$\mu$A base current. That's OK, TTL can source far less than it can sink, but the 50$\mu$A is less than the 400$\mu$A it can deliver.

Let's pick a base resistor of 22k$\Omega$, that will give a base current of 195$\mu$A. A 1000$\Omega$ resistor between the NPN's collector and the TIP32A's base will allow about 28mA, enough to get the 1A, and a current the NPN also can deliver with the given base current.

In this setup you usually add a pullup resistor between the TIP32A's base and emitter, so that the NPN's leakage current won't switch it on. But the TIP32A has resistors built-in, and the NPN's low leakage current of <5$\mu$A will only drop 40mV, far too little to switch it on.

If you want 3A from the TIP32A it needs at least 100mA base current and you'll need a Darlington for the NPN as well, like the BCV47.