# 7 segment LEDs and PNP - Need guidance

Discussion in 'General Electronics Chat' started by elementalrage, Jan 6, 2010.

1. ### elementalrage Thread Starter Active Member

Jul 30, 2009
59
3
I want to run a 7 segment common anode display by Kingbright (Link to datasheet) . The forward voltage is 3.7 per segment (1.85 per LED) at 30ma Forward Current.

I will be using some 2n2907 PNP transistors (Datasheet) to give power to it from a 5 volt source.

How do I figure the base current of the 2N2907?

It looks like I need 47 ohm resistors for each segment.

However; I can't seem to find a good calculator for the BASE current calculation and it appears as though there are 2 LEDs in series on each segment, so I'm a bit lost. We're working on a temperature display for a smoker in case you're wondering using a PIC microcontroller.

rage

Last edited: Jan 6, 2010
2. ### beenthere Retired Moderator

Apr 20, 2004
15,815
283
It would be helpful to see the schematic.

3. ### elementalrage Thread Starter Active Member

Jul 30, 2009
59
3
The drawing is quite crude, but it is a very simple design.

File size:
11.7 KB
Views:
62
4. ### Ron H AAC Fanatic!

Apr 14, 2005
7,050
657
Will you have multiple segments on at a time, or only one segment at a time, multiplexed?

5. ### k7elp60 Senior Member

Nov 4, 2008
478
69
No matter what the drive, multiplexed, direct drive each segment of the LED should have a current limiting resistor. No need to operate them at the full 30mA if they are direct drive. I assume that the transistor is to control current to the common anode.

6. ### Ron H AAC Fanatic!

Apr 14, 2005
7,050
657
True. I asked to question so we could ascertain the maximum collector current, which will enable us to determine the required base resistor.

Ib≈Ic(max)/10

7. ### elementalrage Thread Starter Active Member

Jul 30, 2009
59
3
They will not be multiplexed. They will be direct-driven. Each segment, which contains 2 LEDs, will have a 47 ohm resistor going to them.

If each LED uses 20ma, then that equals 280ma when they're all on. Each segment has 2 LEDs in serial, so when they're all on that's 14 LEDs. I'm not certain how to calculate the BASE resistor required to saturate the transistor.

8. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
Ib=Ic/10.
However, you won't be able to drive all of the segments directly using a PIC, as you will likely exceed the maximum package current sink. Depending on the particular uC, that'll be around 150mA-200mA.

I don't know why you won't multiplex the two displays; that'll make it a lot easier to drive them.

[eta]
You have misquoted the specs for the 7-segment LED displays.
Typ Vf=3.7 @ 20mA
So, for one display (if you are not using the DP) the Ic will be 140mA
140/10 = 14mA.

Vce will be around 0.15v-0.2v

Your Vbe will be around 0.85v with 14mA current.
Rb=(Vcc-Vbe)/(Ic/10)
Rb=(5-0.85)/14mA
Rb=4.15/0.014
Rb=296 Ohms; 300 Ohms is the closest standard value. 1/10W would be OK.

If all seven segments of a single display were on, you would be sinking 14mA + 7*20mA=157mA.
For longer life, you should consider operating the displays at lower current. 15mA will probably be bright enough.
This will reduce your total current sink of your uC as well
7*15mA=105mA
You can then increase the value of Rb:
Rb=(5-0.85)/10.5mA
Rb=4.15/0.0105 = 395 Ohms. 390 Ohms is a standard value.
Total current for one 7-segment display is now 105mA+10.5mA=115.5mA; within a PIC's current sink limit.

For the individual segments, you'll need to account for the Vce of the PNP transistor as well.
Rlimit >= (Vcc - (Vf + Vce))/DesiredCurrent
Rlimit >= (5v - (3.7+0.15))/15mA
Rlimit >= (5-3.85)/0.015
Rlimit >= 1.15/0.015
Rlimit >= 76 Ohms. 75 Ohms is actually close enough, and is a standard value.
If you used 47 Ohms, you would be getting 24.5mA current per segment instead, which would burn them out rather quickly.
You would also be exceeding the maximum package sink limit for your PIC.

Last edited: Jan 6, 2010
9. ### elementalrage Thread Starter Active Member

Jul 30, 2009
59
3
There is only 1 7 segment LED display. It has 2 LEDs per segment.

I am not driving it directly from the PIC. What I am doing is switching a PNP transistor, using the PIC, connected to the common anode of the 7 segment display.

My question is how to calculate the BASE resistor value needed to saturate the PNP transistor.

10. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
Rb=(Vcc-Vbe)/(Ic/10)

11. ### Ron H AAC Fanatic!

Apr 14, 2005
7,050
657
If you don't switch the cathodes with the PIC outputs, you'll just have an 8 displayed.
I'm not sure you are clear that, although you have 14 LEDs, you only have 7 current paths, so with 20mA per segment, the total current will be, as SgtWookie said, 140mA, not 280mA.

12. ### elementalrage Thread Starter Active Member

Jul 30, 2009
59
3
Well written, Wookie! Thank you very much!

13. ### elementalrage Thread Starter Active Member

Jul 30, 2009
59
3
The 7 cathodes are all tied to one of the output ports. I didn't show them all in my schematic. I actually have a working unit.

I understand the segmented LED structure and how it was built. I just wasn't clear on the datasheet values and that is what screwed up my math.

Thanks to all!

14. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
OK, glad you're understanding it better.

However, if you only have the one 7-segment display, you really don't need to use a PNP transistor to control the common anode - simply connect it to Vcc (+5v).

That way, you free up the I/O pin that would otherwise have to control the base current for the PNP transistor.

Unless you're wanting to use the PNP transistor for PWM or the like.