BJT is a current controlled device, where the output current is controlled by the input current.

In this article I provide formula to calculate base resistor. (and test MathJAX)

Voltage drop for red light emitting diode is 2,0 V. We also have to take into account voltage drop of the transistor. So current limiting resistor R_{D} for LED is:

$$ R_D = \frac{U_{CC} - U_D - U_{CE}}{I_D} = \frac{5,0 \, \mathrm{V} - 2,0 \, \mathrm{V} - 0,7 \, \mathrm{V}}{20 \, \mathrm{mA}} = 115 \, \mathrm{\Omega} $$

where

- R
_{D}– load current limiting resistor, Ω; - U
_{CC}= 5,0 V – supply voltage, V; - U
_{D}= 2,0 V – light emitting diode voltage drop, V; - U
_{CE}= 0,7 V – transistor voltage drop between collector and emitter, V; - I
_{D}= 0,02 A – recommended current for a red general purpose LED, A.

Standard nominal resistance of current limiting resistor R_{D} should be picked in increasing direction, because we don't want to exceed 20 mA current limit. It is 120 Ω. Let's check what current will actually be with standard resistor:

$$ I_D = \frac{U_{CC} - U_D - U_{CE}}{R_D} = \frac{5,0 \, \mathrm{V} - 2,0 \, \mathrm{V} - 0,7 \, \mathrm{V}}{120 \, \mathrm{\Omega}} = 19,2 \, \mathrm{mA} $$

Roughly estimate the base current. General purpose PNP transistors have DC gain around h_{FE} = 100. It depends on the load and can be clarified in the datasheet of the transistor. For 2N2222 it is 75 at I_{C} = 10 mA and U_{CE} = 10 V.

$$ I_B = \frac{I_D}{h_{FE}} = \frac{19,2 \, \mathrm{mA}}{75} = 0,256 \, \mathrm{mA} $$

where

- I
_{B}– base current, A; - h
_{FE}– DC current gain of the transistor.

Now the base resistor:

$$ R_B = \frac{U_{CC} - U_{BE}}{I_B} = \frac{5,0 \, \mathrm{V} - 0,7 \, \mathrm{V}}{0,256 \, \mathrm{mA}} = 16,8 \, \mathrm{k \Omega} $$

where

- R
_{B}– base resistor, Ω, - U
_{BE}= 0,7 V – base-emitter voltage drop, V.

When selecting the base resistor, it should be a bit less, than calculated. Because if the transistor doesn't close fully, then it will heat excessively. Closest standard resistor nominal in decrease direction is 16 kΩ. Let's recalculate the base current:

$$ I_B = \frac{U_{CC} - U_{BE}}{R_B} = \frac{5,0 \, \mathrm{V} - 0,7 \, \mathrm{V}}{16 \, \mathrm{k \Omega}} = 0,269 \, \mathrm{mA} $$

Make sure that the base current doesn't exceed transistor limit. Also need to check power dissipation of all the components in this circuit:

$$ P_{RD} = I_D^2 R_D = (19,2 \, \mathrm{mA})^2 \cdot 120 \, \mathrm{\Omega} = 44,2 \, \mathrm{mW} $$

$$ P_{RB} = I_B^2 R_B = (0,269 \, \mathrm{mA})^2 \cdot 16 \, \mathrm{k \Omega} = 1,16 \, \mathrm{mW} $$

$$ P_{VT1} = P_{BE} + P_{CE} = U_{BE} I_B + U_{CE} I_C = $$

$$ = 0,7 \, \mathrm{V} \cdot 0,269 \, \mathrm{mA} + 0,3 \, \mathrm{V} \cdot 19,2 \, \mathrm{mA} = 188 \, \mathrm{\mu W} + 5,76 \, \mathrm{mW} = 5,95 \, \mathrm{mW} $$

where

- P
_{RD}– heat power dissipation of current limiting resistor for the load, W. - P
_{RB}– heat power dissipation of current limiting resistor for the base of the transistor, W. - P
_{VT1}– heat power dissipation of the transistor, W.

When buying the current limiting resistor for the load, it should be able to handle heat power dissipation of 44,2 mW. The same goes for base resistor and the transistor itself.

**Datasheets**:

Download Diotec Semiconductor - 2N2222A - General Purpose NPN Transistor 40V 600mA datasheet.

Download CML Innovative Technologies - LED Indicator 8mm datasheet.