Shop by category
Shop all componentsAnalog circuits
Ib = (Ic ÷ hFE) × overdriveRb = (Vin − Vbe) ÷ IbA 5 V relay coil (70 mA) from a 3.3 V ESP32 pin with a BC547 (hFE ≥ 100), overdrive 5: Ib = 0.07 ÷ 100 × 5 = 3.5 mA, Rb = 2.6 ÷ 0.0035 = 743 Ω, use 680 Ω.
Microcontroller pins can only supply a few milliamps, so loads like relays, buzzers and LED strips are switched through a transistor. The base resistor sets the base current: enough to drive the transistor fully on (saturated), but not so much that it overloads the pin.
Datasheet hFE varies a lot between parts and falls at high current, so designers overdrive the base by 3 to 10 times. Remember a flyback diode across relay coils, and for loads above half an amp, choose a logic-level MOSFET.
For a BC547 or 2N2222 switching 100 mA from a 5 V pin, about 1 kΩ drives the transistor fully on. Use the calculator for your exact current.
To make sure the transistor saturates. Using 2 to 5 times the minimum base current keeps the voltage drop low and the transistor cool.
For loads over about 500 mA, a logic-level MOSFET usually runs cooler and needs no base current.
Ib = (Ic ÷ hFE) × overdrive; Rb = (Vin − Vbe) ÷ Ib.
A 5 V relay coil (70 mA) from a 3.3 V ESP32 pin with a BC547 (hFE ≥ 100), overdrive 5: Ib = 0.07 ÷ 100 × 5 = 3.5 mA, Rb = 2.6 ÷ 0.0035 = 743 Ω, use 680 Ω.
Geekobot builds that use it include Darlington touch switch, Three-level water tank indicator with transistors, Two-transistor LED flasher (astable multivibrator) and Rain alarm with two transistors. Each has the full parts list, wiring and code.
Results are estimates for design and learning. Check critical designs against the component datasheet. Made by the Geekobot Learning Team. How we write our calculators