Understanding the BJT transistor switch calculator — concept and principle
A bipolar junction transistor (BJT) is often used as a low-side switch so that a microcontroller pin can drive a relay, motor, lamp or LED string. This calculator sizes the base resistor so the transistor is driven hard into saturation, and estimates the power the transistor dissipates while it is on.
How it is calculated
- Base current: I_B = of × I_C / h_FE.
- Base resistor: R_B = (V_in − 0.7) / I_B, with I_B in amperes.
- Saturation power: P ≈ V_CE(sat) × I_C = 0.2 V × I_C.
- Load: R_load = (V_cc − 0.2) / I_C and P_load = (V_cc − 0.2) × I_C, the load that draws this current from the supply.
I_C is the load (collector) current, h_FE the minimum current gain from the datasheet, V_in the drive voltage from the logic pin, V_cc the supply and of the overdrive factor. The model assumes V_BE ≈ 0.7 V, V_CE(sat) ≈ 0.2 V.
The principle
In the active region a BJT's collector current is about h_FE times its base current. A switch, however, should not sit in that region, because the transistor would drop several volts and heat up. Supplying more base current than I_C / h_FE pushes it into saturation, where the collector-emitter voltage collapses to a few tenths of a volt and the load current is set by the load itself. Gain varies between parts and falls at high current and low temperature, so designers multiply the minimum by an overdrive factor of 2 to 10. Ohm's law across the voltage left after the V_BE drop then gives the base resistor.
Worked example
- Minimum base current: 100 mA / 100 = 1 mA.
- With overdrive 5: I_B = 5 × 1 = 5 mA (a forced gain of 20).
- Voltage across the base resistor: 5 − 0.7 = 4.3 V.
- R_B = 4.3 / 0.005 = 860 Ω.
- Power at saturation: 0.2 V × 100 mA = 20 mW.
- With a 12 V supply: R_load = 11.8 V / 0.1 A = 118 Ω, and the load takes 11.8 V × 0.1 A = 1,180 mW.
| Collector (load) current (mA) | Base resistor (Ω) |
|---|---|
| 25 | 3,440 |
| 50 | 1,720 |
| 75 | 1,146.666667 |
| 100 | 860 |
| 125 | 688 |
| 150 | 573.3333333 |
| 200 | 430 |
How to read the result
Choose the nearest standard resistor at or below the result (820 Ω in the E12 series gives about 5.2 mA) so the transistor stays saturated. Check that the logic output can source that current; many microcontroller pins are limited to a few mA to around 20 mA.
Common mistakes
- Using typical h_FE instead of the minimum at the operating current.
- Omitting a flyback diode across a relay or motor coil, which can destroy the transistor at turn-off.
- Choosing a base resistor that asks more current than the driving pin can supply.
Frequently asked questions
What overdrive factor should I use?
A forced gain of 10 to 20 (overdrive 5 to 10 with h_FE 100) is a common rule for reliable saturation.
Why not just use a very small base resistor?
Too much base current wastes power, can overload the driving pin and slows turn-off because of stored charge.
When should I use a MOSFET instead?
For load currents above a few hundred mA, a logic-level MOSFET needs almost no gate current and has lower conduction loss.
Sources: Sedra and Smith, Microelectronic Circuits, chapter on bipolar junction transistors · Horowitz and Hill, The Art of Electronics, 3rd edition, chapter on transistors