Recipe
Size an NPN base resistor
Use when: a pin switches a load through an NPN transistor in a low-side switch
Goal: a standard resistor value that saturates the transistor while keeping the pin under its limit
Taught in The transistor as a switch
Quick recipe
-
1
Get I_C from the load, then check it against the transistor's maximum collector current and the supply against its maximum voltage.
Example
A 40 mA load on 5 V with a 2N3904: 40 mA is well under 200 mA, and 5 V under 40 V.
Why: no base resistor can rescue a transistor that is too small for the load.
-
2
I_B = I_C / 10. Check that it is also several times I_C / h_{FE(min)}.
Example
I_B = 40 / 10 = 4 mA. The bare minimum is 40 / 60 \approx 0.67 mA, so 4 mA is about six times that.
Why: the datasheet's saturation figures were measured at this ratio, and the extra margin covers transistors with low gain.
-
3
I_B must sit under the pin's limit with room to spare.
Example
4 mA on an Uno R4 Minima pin: under 8 mA.
- it does — carry on.
- it doesn't — this load is too big for a pin-driven BJT; use a logic-level MOSFET (§3).
Why: the pin supplies all of the base current.
-
4
R_B = (V_{pin} - V_{BE}) / I_B with V_{BE} \approx 0.8 V. Round down to a standard value, then recompute I_B and compare it with the pin's limit again.
Example
(5.0 - 0.8) / 4\ \text{mA} = 1.05 kΩ, so use 1 kΩ; then I_B = 4.2 / 1 = 4.2 mA, under 8 mA.
Why: rounding down only raises the base current, the safe direction for saturation, but that higher current still has to fit the pin.
Common mistakes
- Designing with a typical gain instead of the datasheet's minimum, so some transistors never fully turn on.
- Leaving out the base resistor and shorting the pin through the base-emitter junction.
- Using 0 V for the base-emitter drop, which overstates the base current a little and hides the real margin.
- Rounding R_B up "to be safe", which lowers the base current and can stop the transistor saturating.