Calculator KB-33
Transistor base resistor calculator
Switching a relay, LED strip, or motor from a microcontroller pin.
Result
In brief: Calculate the base resistor for a transistor switch: base current, E24 value, power dissipation, and saturation margin. For control from Arduino, ESP32, and other microcontrollers. Example: E24 series resistor: 820 Ω.
Calculation example
| Control voltage | 5 V |
|---|---|
| Load current | 100 mA |
| hFE coefficient | 100 |
| Saturation margin | 5 times |
| Base-emitter voltage drop | 0.7 V |
| E24 series resistor | 820 Ω |
|---|---|
| Exact calculation | 860 Ω |
| Base current | 5.244 mA |
| Resistor power dissipation | 22.5 mW |
| Pin load | MCU output is sufficient |
How it is calculated
Rb = (Ub − Ube) / Ib
To use a transistor as a switch, supply the base with more than the minimum current. This fully turns it on and keeps it from getting too hot. A margin of 5–10× is typical; round the resistor value down.
What to look for
- Always connect a protection diode in parallel with the coil when switching a relay or other inductive load.
- For currents above 500 mA, a logic-level MOSFET is usually easier to use: it doesn't need base current.
Frequently asked questions
What resistor should I use at the base of a transistor driven by an Arduino?
R = (Ucontrol − 0.7) · hFE / (Iload · k). For 5 V, 100 mA, hFE of 100, and a safety factor of 5, the result is 860 Ω; choose 820 Ω from the E24 series.
Why leave a margin for base current?
So the transistor goes into saturation: the voltage drop across it is minimal, and it barely heats up. Current gain drops as current increases and varies between devices, so a safety factor of 5–10 is usually used.
How much current can a microcontroller pin handle?
Check the datasheet: for an Arduino Uno with an ATmega328, up to 20 mA is recommended. If the base needs more, add a second transistor or a logic-level MOSFET.
