Electronic – PNP transistor to command LED

bjtledpnp

Usually I use NPN to drive LEDs but in my project I have to use PNP because the cathode of the LED is tied to GND.

Then I have a question, is it possible to have a command of 3.3V and the PNP tied to the 5V.

I am thinking it is not possible because if the command is at 0 the BJT is saturated and everything is OK but if the command is at 3.3V then Veb= 5-3.3=1.7>0.7 and the BJT is still not blocked.

Am I right?

Best Answer

It doesn't matter what kind of transistor you use if the anode of the LED is tied to ground and you don't have a negative supply.

"LED" stands for light emitting diode. To light a LED, you put forward current thru it, meaning in the direction so that the inherent diode is forward biased and conducts normally. The anode is then more positive than the cathode.

LEDs don't work on the Zener principle, or anything else that makes use of reverse biased conduction. Most LEDs are not very good diodes in that they leak and their typical reverse voltage before breakdown is around 5V. The leakage is partly a function of light hitting them, and this can be harnessed to use a LED as a light sensor. However, that does not apply here since I assume you want to light your LED normally.

By the way, both a PNP and NPN can be used to drive a LED from the high side, but again, none of that matters with the LED hooked up backwards.

Added now that cathode is tied to ground:

You now say the cathode is tied to ground, which makes more sense if you want to light the LED normally. It now appears your question is how to control this LED from a 3.3 V logic signal but have most of its current come from a 5 V supply, and the LED cathode tied to ground outside your control.

There are many ways to do this. This is probably the simplest:

This is assuming a normal green LED which will have a forward drop of about 2.1 V and that you want close to 20 mA thru the LED. If you only wanted a few mA, you could probably drive it directly from the digital output, so I'll assume the problem is you want full brightness and your digital output can't source 20 mA.

This circuit will light the LED when the digital signal is high. In that case, the base will be at 3.3 V. I am using 700 mV for the B-E drop, which leaves 500 mV accross R1. At 27 Ω, that sets the LED current at 18.5 mA. There will be some slop, so I wouldn't want the nominal to be higher than that given a "20 mA" LED. The brightness difference between 18.5 and 20.0 mA will be nearly impossible to see with your eye even in a side by side comparison.

This circuit requires the digital output to only source the LED current divided roughly by the gain of the transistor. Actually it is divided by the gain+1, but the gain of a transistor is never known that precisely so gain and gain+1 are basically the same thing. Let's say the gain of the transistor is 50 at that operating point. You can certainly find small signal transistors with a minimum guaranteed gain of 50 at 20 mA. At 20 mA LED current, that means the digital output only needs to source about 400 µA. That is easily within the capability of a normal digital output.