3
\$\begingroup\$

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?

\$\endgroup\$
0

4 Answers 4

7
\$\begingroup\$

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.

\$\endgroup\$
3
  • \$\begingroup\$ How a PNP can drive the LED from the high side? How will it be saturated? i don't get it. And yes it is the cathode which is tied to GND \$\endgroup\$
    – damien
    Oct 25, 2012 at 13:14
  • 1
    \$\begingroup\$ This answer is no longer relevant to the question as amended. \$\endgroup\$
    – Dave Tweed
    Oct 25, 2012 at 14:02
  • 1
    \$\begingroup\$ @DaveTweed: Amended to updated question. \$\endgroup\$ Oct 25, 2012 at 14:35
3
\$\begingroup\$

If the anode is tied to ground you're out of luck. If the cathode is tied to ground, you'd need another transistor to drive the first one. Something like this would work:

proposed schematic

There are other options, of course. Many many ways to skin a cat.

\$\endgroup\$
5
  • \$\begingroup\$ Yes sorry about my mistake it is actually the cathode you are right \$\endgroup\$
    – damien
    Oct 25, 2012 at 13:14
  • \$\begingroup\$ Why not drive the PNP transistor directly? Use a pullup resistor from the base to +5, and then use a diode with its anode toward the base of the PNP transistor. Logic goes low, diode allows current flow, and LED turns on. If your I/O can withstand 5V you could even use a tristate pin instead and drive low to turn it on. \$\endgroup\$
    – akohlsmith
    Oct 25, 2012 at 13:14
  • 1
    \$\begingroup\$ @AndrewKohlsmith: The diode would still allow current to flow if the processor pin is at 3.3V, so that won't work. The tristate pin will work only if it doesn't have protection diodes. \$\endgroup\$
    – Dave Tweed
    Oct 25, 2012 at 14:06
  • 1
    \$\begingroup\$ @Remiel: Minor tweak to your circuit: If you eliminate R2 and R3 and instead put a resistor in series with the emitter of Q2, you a) save a part, and b) reduce the loading on the processor pin. \$\endgroup\$
    – Dave Tweed
    Oct 25, 2012 at 14:12
  • \$\begingroup\$ @DaveTweed bah you're right about the current flow even with 3.3V. I commented too quickly and read too slowly. \$\endgroup\$
    – akohlsmith
    Oct 25, 2012 at 23:44
1
\$\begingroup\$

For a 3.3V signal you don't need this: a simple emitter-follower NPN circuit, in which the resistor + LED are the load, should do. 3.3V volts minus the 0.7 VBE is still a large enough voltage to drive the LED. The NPN's collector supplies the current and that is that.

Now if the problem was that you want to turn on grounded LED with a small voltage, the following circuit, consisting of an NPN stage followed by a PNP stage will let us do that:

enter image description here

Here, we need as little as around 0.7V to turn on the Q1 NPN, to get enough current to flow across R1 to develop a voltage that turns on Q2 PNP.

R2 is necessary to present a decent impedance to the source which drives Q1, and also to limit the current through the Q1-Q2 path. We don't put an emitter resistor on Q2 because we want that to saturate easily.

\$\endgroup\$
2
  • \$\begingroup\$ Can you undelete your comment? Even if it was wrong, the thinking process behind it and coming to the conclusion that it was wrong might be educational for us dummies. \$\endgroup\$
    – Kaz
    Oct 26, 2012 at 17:55
  • \$\begingroup\$ That sucks. What happens? How it should work is: when you click the little X, a confirm dialog box comes up. If you confirm, then the comment is gone. Maybe there is some issue between the Javascript and your browser. (Try another one?) \$\endgroup\$
    – Kaz
    Oct 26, 2012 at 18:55
0
\$\begingroup\$

Rushing. Diagrams later maybe.,
You should be able to draw this yourself from the following.

  1. Use two resistors.
    R1 from +5 to base.
    R2 from base to 0/3.3 Signal.
    R1 is say 10k
    R2 is say 39k - call it 40k for now. Call 0/33.3V signal Vin.

When Vin = 3.3V there is 1.7V from Vin to +5V.
R1 / R2 form a 5:1 divider so R1 has 1.7/5 = 0.34V across it.
So the transistor has 0.35 voplt drive as Vbe and is turned off.

When Vin = 0V the 5:1 divider produces %v/5 = 1V as Vbe fir the transistor and it is turned on.

  1. Adding a zener gives wider on to off voltage change at the transistor base.

If you place a say 3.3V zener diode in series with R2 you will get a reduced voltage swing at the top end and can use a much reduced R2 or increased R1.
eg say R2 = 10k, R1 = 100k or higher.
Ignore R1 for calculations to start.
When Vin = 3.3V then Vbase = 5V.
When Vin = 0V, Vbase = 0+ Vzener = 0+3.3 = 3.3V = 1.7V Vbe drive througfh R1 of 1ok.

I You can adjust the ratio of the two resistors for best resutss. As above with R2 = 4 x R1 and a 5:1 division the resultant 0.34 V drive should not turn the transistor on.
If you want even less drive you can use say 5:1 resistor ratio for a 6:1 division giving 1.7V/6 = 0.28 V when off and 5v/6 = 0.8V when on.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.