Transistor as a Switch

Use a transistor to control high-power loads with a tiny input signal.

Overview

Transistors can switch loads that would destroy a microcontroller pin. Learn to use an NPN transistor as a low-side switch.

Components Needed

  • 1x 2N2222 or PN2222 NPN transistor
  • 1x 12V DC motor or relay
  • 1x 1N4001 diode
  • 1x 1kΩ resistor
  • 1x Push button
  • 2x 9V Battery
  • 1x Breadboard

Instructions

  1. Calculate Base Resistor

    To saturate the transistor: Ib = Ic / β. For 100mA load and β=100, Ib = 1mA. With 5V drive: R = (5 - 0.7) / 0.001 = 4.3kΩ. Use 1kΩ for good saturation.

  2. Add Flyback Diode

    Inductive loads (motors, relays) create voltage spikes when switched off. A diode across the load absorbs this spike and protects the transistor.

  3. Build the Circuit

    Connect: load between V+ and collector, emitter to ground, base resistor from control signal to base, flyback diode across load (cathode to V+).

  4. Test and Measure

    Measure Vce when on - should be near 0V (saturated). Measure when off - should equal supply voltage. Control the load with a button or microcontroller.

Challenges

  • Switch a motor forward and reverse using two transistors (H-bridge concept)
  • Control a relay to switch AC loads safely
  • Replace the BJT with a MOSFET and compare