Maker Pro
Maker Pro

PNP Transistor to Drive LED

I'm using a PIC to control some LEDs and not sure in this case that I need current limiting resistors on the base. In the drawing below I have the collectors of two LEDs connected to pins 4 and 5 of J3 with current limiting resistors. The bases of Q1 nd Q2 are tied to RA3 and RA4 of the PIC which has internal pullup resistors. I've read somewhere that in this configuration you don't need resistors on the base because the current would be self limiting. Is this the correct way to do this? Better to use a mosfet?


upload_2017-5-1_15-15-50.png
 
Last edited:
Ok so that's probably going to be a 2N2907. Have a look at the data sheet under maximum ratings. Especially look for something related to the junctions of the transistor. See any issue that might arise?
Cheers
Adam
 
I don't read a lot of datasheets but says the max Ic is 600ma. The LED will be about 40ma. Vebo is 5v which is my supply voltage so shouldn't be able to exceed that. Is there another parameter that I should look at? Maybe just as important is will this configuration saturate the transistor so the LED is fully on?
 
Last edited:
Vebo is the maximum allowed reverse voltage that will never happen in this circuit.
The PNP transistors in your circuit are emitter-followers with a 0.7V voltage loss, not as switches that saturate.
When the PIC output goes low then the LED will light. The LED turns off if the PIC output is high and has the same power supply voltage as the LEDs (+5V).
 
But what about the other PN junction? Are there any issue there. The reason I said for you to look at the data sheet was to get you thinking, knowing full well the maximum rating for what I was looking for wouldn't be there. And why isn't is specified? What limitations dose this have on the circuits max voltage?

Thanks
Adam
 
But what about the other PN junction? Are there any issue there.
A transistor normally has its collector-base junction reverse biased. The datasheet lists its maximum allowed voltage that is MUCH higher than the emitter-base maximum allowed reverse voltage. The emitter-base junction has avalanche breakdown (conducting like a zener diode) when its maximum allowed reverse voltage is exceeded. The avalanche breakdown current burns and slowly damages the hFE of the transistor.
 
I was trying to weed out why it is better to have a resistor to protect the PN junction from excess current and yes in the circuit above it's fine. I wanted the OP to think about a situation when the PN junction left like that could damage the transistor. But it didn't quite work out :)

Cheers
Adam
 
John,

What you have drawn is the emitters going to the resistors. So an LED connected between the other end of the resistor (cathode) and +5 (anode) would get current. No need for a base resistor.

However, this is not the best way to do it. The transistor in this configuration is acting as an emitter follower. There will be 0.6V (plus or minus some mV) between base and emitter (resistor). Then the LED will drop between 1.7V (ordinary red LED) and 3.5V (newer LED types) or maybe as much as 3.6V for blue LEDs. That leaves as little as 0.8V for the resistor, less if your 5V supply is on the low side.

So say you calculate the resistor for 20mA at 5V - 3.6V - 0.6V = 0.8V. That's 40 ohms, so you use 39 ohms. Say it turns out that the supply is actually 4.4V (the allowable minimum for a USB charger). Now you have only 0.2V for the resistor, and your LED current will be 5mA, not the intended 20mA.

Because you have so little voltage across the resistor any variation in the factors that control it will give proportionally larger variations in the current.

If you reconfigure as shown in the diagram (this is my first post, so I'm not sure if I'm doing the diagram properly), the transistor will "hard switch" and saturate at around 50-100mV. So you have gained 0.5V or so extra for the resistor. Doesn't sound like much, but it's a 63% increase, reducing the sensitivity to variations in voltage by that much.

Untitled-1.jpg

In general, driving a LED that needs 3.6V off a 5V (nominal) supply is never going to be a precision operation, once all the possible variations are taken into account.

That answers your question as asked.

Now, is there a better way? Most likely. I am not intimately familiar with PIC, and you didn't specify the chip type. However, most micros these days (I say these days because I've been doing this for nearly 50 years) can drive LEDs directly. And modern LEDs are so bright that they will burn your eyeballs on 5mA. Just go through a resistor directly to the LED. Get the PIC data sheet and find the output voltage drop at say 5mA. Get the LED data and find the voltage drop at 5A. Subtract both from 5V, divide by 5 and you have the resistance in KΩ.
 
The question is why are you using a PNP emitter follower, when an NPN common emitter configuration is better?
If you do switch that that configuration, you will need a base resistor though.

Bob
 
Why to use three PIC pins to control two LEDs? Why to use PNP transistors or any transistor as most PIC pins can drive a LED by itself? There are zillions LED types these days but the "ordinary" LED still handles up to 20mA without problem giving the maximum light, though a lot of them do well with 5mA. Low power types go as low as 1mA. As others stated already you'd better do some math to calculate an effective series resistor. Keep in mind that the forward voltage is related to the color of the LED.
 
there's something i don't get here. you said

so you're saying VCC - VLED - VBE = VR
but isn't it supposed to be VCC - VLED - VCE = VR?

You are right, and so am I :)

In this case Vce and Vbe will be the same (assuming no voltage drop in the processor, which is a fairly reasonable assumption at the low base current level). But I always think of Vbe as ~0.65V whereas Vce can be anything.
 
John,

What you have drawn is the emitters going to the resistors. So an LED connected between the other end of the resistor (cathode) and +5 (anode) would get current. No need for a base resistor.

However, this is not the best way to do it. The transistor in this configuration is acting as an emitter follower. There will be 0.6V (plus or minus some mV) between base and emitter (resistor). Then the LED will drop between 1.7V (ordinary red LED) and 3.5V (newer LED types) or maybe as much as 3.6V for blue LEDs. That leaves as little as 0.8V for the resistor, less if your 5V supply is on the low side.

So say you calculate the resistor for 20mA at 5V - 3.6V - 0.6V = 0.8V. That's 40 ohms, so you use 39 ohms. Say it turns out that the supply is actually 4.4V (the allowable minimum for a USB charger). Now you have only 0.2V for the resistor, and your LED current will be 5mA, not the intended 20mA.

Because you have so little voltage across the resistor any variation in the factors that control it will give proportionally larger variations in the current.

If you reconfigure as shown in the diagram (this is my first post, so I'm not sure if I'm doing the diagram properly), the transistor will "hard switch" and saturate at around 50-100mV. So you have gained 0.5V or so extra for the resistor. Doesn't sound like much, but it's a 63% increase, reducing the sensitivity to variations in voltage by that much.

View attachment 33703

In general, driving a LED that needs 3.6V off a 5V (nominal) supply is never going to be a precision operation, once all the possible variations are taken into account.

That answers your question as asked.

Now, is there a better way? Most likely. I am not intimately familiar with PIC, and you didn't specify the chip type. However, most micros these days (I say these days because I've been doing this for nearly 50 years) can drive LEDs directly. And modern LEDs are so bright that they will burn your eyeballs on 5mA. Just go through a resistor directly to the LED. Get the PIC data sheet and find the output voltage drop at say 5mA. Get the LED data and find the voltage drop at 5A. Subtract both from 5V, divide by 5 and you have the resistance in KΩ.
 
I ever found a red LED controlled this way but when it was supposed to be off, there was a faint red glow left. As this was too visible in the dark I moved the LED and the resistor to the emitter side like SPLatMan advised. It made some people unhappy as the PCB had to be modified.
 
Top