NPN and PNP to drive LEDs

I have the following circuit below. One of the restrictions I have is that I need to drive 4 LEDs using 9V. (sorry I forgot why 9V is not enough for all 4 LEDs in series so there's a drop voltage after the PNP and the LEDs Vf is not exactly 2V, maybe 2.1v or 2.2V which is normal based on the datasheet range of vf= 2v-2.4v), so I connected the 4 LEDs in parallel. Each LED has a Vf about 2V and operates at 20-23mA. I have one NPN and PNP transistor to drive the LEDs.

I know this might not be the best design, but I'll like to try this design in the best possible way. The 5V / 0V at Q2 is coming from the GPIO in the microcontroller. Connecting the LEDs in parallel Ic at Q1 needs to be at least 40mA output. In the circuit below I have R3 = 1k thus Ib at Q2 is about 4mA, and using a 10 gain Q2 Ic = 40mA, and using another R1 = 1k will decrease the Q2 Ib current to about 8mA and this becomes Ib at Q1 which will turn Q1 Ic to about 80mA twice as much the current needed to drive the LEDs at 20-23mA. I'm using a NPN 2n2222(2N2222 Datasheet and PNP 2N29072N2907 Datasheet.

I just wanted to know if the circuit below with the values I used is good enough to work? based on my calculations above. I calculated the values based on a 10 gain, is that correct to use based on the datasheets. What other resistor values could work to get at least 50ma at Ic of Q1 • Just use two parallel strings of 2 series LEDs. Why you would use two parallel strings of 3 and 1 LEDs appears strange. Sep 26 '21 at 10:06
• Yes, I could do that too. The same output current of at least 40mA.
– Citi
Sep 26 '21 at 20:24

I would put all 4 LEDS in parallel, each w their own resistor. Much more elegant and balanced. Also, draw your schematic with supplies inverted...much clearer. To turn on the PNP, you pull down the 1K with the NPN, and draw 8mA to GND. With a PNP gain of x100, it can support 8 x100mA going to LEDS...and you only need 100mA...so it turns ON hard..which is good as a switch.

The NPN has 0.5mA into the base when +5 is on. With NPN gain of say x100, it supports collector current of 0.5 x 100 = 50mA...much more than you need...you need 8mA...so NPN turns on hard...which is good for switching.

Use 330 1/4W resistors as shown.

• You could also try all 4 LEDS in series...that gives 8V, and turn on the PNP hard...it should only drop 0.1V, so you have (9-8)/0.020 = 50 ohm, in series with the LEDs to current limit them to 20 mA. Sep 26 '21 at 8:39
• Doesn't having 1k at NPN base give us around 4mA, because of the NPN voltage drop not 0.5mA into the base when +5 is on.
– Citi
Sep 26 '21 at 22:35
• However, having the resistor values set to 1k , at the bases of the transistors should be okay?
– Citi
Sep 26 '21 at 23:01
• Ooops..you are right. Base current is (5 - 0.7)/1k = 4.3mA. That is plenty to turn on NPN hard. I usually use 10k...you dont need that much base current as your collector is only pulling down 9mA from base of PNP...but no harm using 1k. Sep 27 '21 at 1:53
• so making R3=10k will give about 0.4mA at Q2 Ib, then the max Ic current at Q2 will be about 4ma and Q1 Ic will then be around 40ma. So a lower resistor value at R3, will increase the Q1 IC max current, keeping the two 1k resistor values at bases of the transitors.
– Citi
Sep 27 '21 at 2:37

Calculate the R5 = (9v - 4x2v) / 20mA = 50ohm (use 47ohm)

For Beta = 150

Calculate Q2_ib = 20mA / 150 = 133uA

Calculate R2 = (9v - 0.7v) / 133uA = 62Kohm (use 47k)

For R4 even 1Mohm should be enough, but it is not common to use such high values (except low power designs) due to noise affecting. • This is the better way to do this. The diodes being in parallel will have more even brightness, assuming they are the same color. If not then you'll likely want a string per diode color. R4 should be 100k - 500k but 47k will work. Sep 27 '21 at 5:00