BJT as a Switch: Base Resistor Design and Saturation Explained

Logic outputs, sensors and timer ICs can supply only a few milliamps, yet we often need to drive relays, buzzers, lamps or small motors that draw much more. A bipolar junction transistor (BJT) used as a switch solves this: a small base current controls a much larger collector current. This tutorial explains the three operating regions, then designs an NPN low-side switch for a relay with every number worked out.

Operating Regions

An NPN transistor has three terminals: collector (C), base (B) and emitter (E). Current flowing into the base, from base to emitter, allows a larger current to flow from collector to emitter. In the active region the collector current is Ic = hFE x Ib, where hFE (also called beta) is the current gain.

RegionBase-emitterCollector-emitterUsed for
Cut-offVbe below about 0.5 V, Ib ~ 0Open switch, Ic ~ 0Switch OFF
ActiveVbe ~ 0.65 VIc = hFE x Ib, Vce variesAmplifiers
SaturationVbe ~ 0.7 to 0.9 VVce(sat) ~ 0.1 to 0.3 VSwitch ON

For switching we want the transistor either fully off or fully on. In saturation Vce is small, so the power lost in the transistor (Vce x Ic) is small. If we supply only just enough base current, the transistor sits in the active region with several volts across it and gets hot. The cure is to overdrive the base.

Forced beta rule: Ib = Ic / 10   (switching design value)
Base resistor:    Rb = (Vdrive - Vbe(sat)) / Ib
Transistor loss:  P = Vce(sat) x Ic + Vbe x Ib

Datasheets typically specify Vce(sat) at Ic / Ib = 10, which is where the rule of thumb comes from. The forced beta of 10 works even if the actual hFE of your part is anywhere from 50 to 300.

The Low-Side Switch Circuit

        +5 V
          |
     +----+----+
     |         |
   Relay     1N4007 (cathode to +5 V)
   coil        |
     |         |
     +----+----+
          |
          C
IN --[Rb]--B   2N2222A
          |  E
  [10k]   |
   |      |
  GND    GND

The load sits between the positive supply and the collector; the emitter goes to ground. This is called a low-side switch. The 10 kΩ resistor from base to ground keeps the transistor firmly off if the input is floating, for example while a controller is starting up. The diode across the coil is the flyback diode that absorbs the coil's energy at turn-off.

Worked Example: Driving a 5 V Relay

A 5 V relay has a coil resistance of 70 Ω. The control signal is a 5 V logic output. Choose the transistor and the base resistor.

Collector current:
  Ic = (5 - Vce(sat)) / Rcoil = (5 - 0.2) / 70 = 68.6 mA

Base current (forced beta 10):
  Ib = 68.6 / 10 = 6.9 mA

Base resistor:
  Rb = (5 - 0.8) / 0.0069 = 609 Ω  -> use 560 Ω
  Actual Ib = 4.2 / 560 = 7.5 mA

Pull-down current stolen by 10k: 0.8 / 10000 = 0.08 mA (negligible)

Transistor dissipation:
  P = 0.2 x 0.0686 + 0.8 x 0.0075 = 0.014 + 0.006 = 0.020 W

Choice of transistor: the BC547 is rated for 100 mA collector current and 45 V, so 69 mA is within its rating but without much margin. The 2N2222A is rated for 600 mA continuous and 40 V, which gives comfortable headroom, so it is the better choice. 20 mW is nothing for a TO-92 package.

From a 3.3 V output

With a 3.3 V drive, Rb = (3.3 - 0.8) / 0.0069 = 362 Ω, so 330 Ω would be used, giving about 7.6 mA. The same transistor and relay work; only the base resistor changes.

PNP High-Side and Darlington Options

A PNP transistor such as the BC557 or 2N2907A can switch the positive side of a load, with the emitter on the supply. It turns on when the base is pulled below the emitter by about 0.7 V. If the load supply is higher than the logic supply, a PNP high-side switch needs an extra NPN stage to pull its base down, because a 5 V logic output cannot turn off a PNP whose emitter is at 12 V.

For loads of several hundred milliamps, a Darlington pair such as the TIP120, or a multi-channel driver like the ULN2003, offers very high gain, but its saturation voltage is around 1 V or more, so it wastes more power than a single BJT or a MOSFET.

Troubleshooting

  • Relay clicks but transistor dies after some time: the flyback diode is missing or reversed.
  • Transistor gets hot: measure Vce when ON. If it is more than about 0.4 V, the transistor is not saturated; reduce Rb.
  • Load never turns fully off: check for a floating base, add the base pull-down resistor.
  • No switching at all: verify the pinout. BC547 and 2N2222A TO-92 pinouts differ between manufacturers, so always check the datasheet for your exact part.
  • Logic output voltage drops when ON: the output is overloaded; increase Rb slightly or use a MOSFET.

Summary

To use a BJT as a switch, calculate the load current, divide by 10 to get the base current, and set the base resistor with Rb = (Vdrive - Vbe) / Ib. Choose a transistor whose current and voltage ratings exceed the load with margin, add a base pull-down, and always fit a flyback diode on inductive loads. Measure Vce when on: a few tenths of a volt confirms proper saturation.