/    Calculators » Transistor base resistor calculator
Support the project on Patreon


Calculator KB-33

Transistor base resistor calculator

Switching a relay, LED strip, or motor from a microcontroller pin.

KB-33Transistor base resistor calculatorCalculates in real time

Result

E24 series resistor820 Ω
Exact calculation860 Ω
Base current5.244 mA
Resistor power dissipation22.5 mW
Pin loadMCU output is sufficient
Share calculation

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

Input data
Control voltage5 V
Load current100 mA
hFE coefficient100
Saturation margin5 times
Base-emitter voltage drop0.7 V
Result
E24 series resistor820 Ω
Exact calculation860 Ω
Base current5.244 mA
Resistor power dissipation22.5 mW
Pin loadMCU output is sufficient

How it is calculated

Ib = Ic / hFE · k
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.

Updated · kirich.blog · The calculation runs in your browser; no data is sent anywhere.

See also