Transistor as Switch
Part of The Transistor
Using a transistor as a switch drives it between cutoff (fully off) and saturation (fully on), replacing mechanical switches and relays for applications requiring speed, reliability, and electronic control.
Why This Matters
The transistor as a switch is arguably the most important application in all of electronics. Every bit of computation β from the simplest calculator to the most powerful server β consists of transistor switches opening and closing to represent binary 0 and 1. Every digital logic gate, memory cell, and processor is built entirely from transistor switches.
Even outside computing, the transistor switch has displaced mechanical switches in most applications: relay drivers, LED drivers, motor controllers, power management circuits. Mechanical switches wear out, bounce, have limited speed, and require physical force. Transistor switches are controlled by voltage, operate in nanoseconds, last indefinitely, and can be made microscopic.
Understanding transistor switching is the gateway to digital electronics. Once you can make a transistor switch reliably, you can build logic gates, and from logic gates, every digital system follows.
The Fundamental Principle
A bipolar transistor (NPN) has three terminals: emitter, base, collector. In its natural state (base undriven), almost no current flows between collector and emitter β the transistor is OFF. Apply a small positive voltage to the base (relative to emitter), and a large current can flow from collector to emitter β the transistor is ON.
The ratio of βlargeβ to βsmallβ:
- Base current that turns the transistor on: typically 0.1β10 mA
- Collector current that flows as a result: 10β1,000 mA (depends on load)
- The ratio I_C / I_B = Ξ² (current gain) = 50β500 for typical transistors
This is current amplification. But in switching applications, we do not care about proportional amplification β we care only about ON and OFF. We drive hard enough to guarantee full ON (saturation) with a substantial safety margin.
The Two States
State 1: Cutoff (Switch Open, Load Off)
Conditions: V_BE < 0.5 V (silicon), base current β 0
Behavior:
- No current flows through collector-emitter junction
- Only tiny leakage current I_CEO (nano to microamps)
- V_CE β VCC (collector voltage rises to supply voltage through load resistor)
- Power dissipation β VCC Γ I_CEO β negligible
In a circuit: With a lamp as load, the lamp is off. With a resistor as load, voltage across resistor is zero (no current). With a relay as load, relay is de-energized.
State 2: Saturation (Switch Closed, Load On)
Conditions: V_BE β 0.7 V, sufficient base current flowing to exceed I_C / Ξ²
Behavior:
- Maximum current flows through collector-emitter, limited only by the load
- V_CE β 0.1β0.3 V (saturation voltage β nearly zero)
- Power dissipation = V_CE_sat Γ I_C = 0.2 Γ I_C (low for reasonable load currents)
In a circuit: Lamp is on at full brightness. Voltage across collector resistor equals (nearly) the full supply voltage. Relay energizes.
Designing a Switch Circuit: Complete Procedure
Step 1: Determine Load Requirements
What current does the load require when on?
- LED: 10β20 mA
- Small relay (9V, 500Ξ© coil): 9/500 = 18 mA
- Large relay (12V, 200Ξ© coil): 12/200 = 60 mA
- Small DC motor: 100β500 mA
- Solenoid: 100β1,000 mA
Call this I_C_max.
Step 2: Choose Transistor
Transistor must handle I_C_max with margin:
- Choose I_C_rated β₯ 2 Γ I_C_max (for continuous) or I_C_max Γ 3 for inductive loads
- Choose V_CE_rated β₯ 1.5 Γ VCC (for inductive spikes)
- Choose a device: BC547 (100 mA max), 2N2222 (600 mA), TIP31 (3A), 2N3055 (15A)
Step 3: Find Minimum Ξ²
From the datasheet, find Ξ²_min (minimum guaranteed gain) at the expected I_C. Note: Ξ² decreases at high currents β check the graph, not just the typical value.
Step 4: Calculate Base Current for Saturation
I_B_required = I_C_max / Ξ²_min (just barely active) I_B_actual = I_B_required Γ oversaturation_factor (typically 5β10Γ)
A factor of 5β10 accounts for:
- Ξ² variation: your actual transistor may have Ξ² = 150 even if minimum is 100
- Temperature: Ξ² changes with temperature
- Noise margin: ensures clean switching over component tolerances
Step 5: Calculate Base Resistor
R_B = (V_control β V_BE) / I_B_actual
Where V_control is the control voltage (logic output, sensor output, etc.) and V_BE β 0.7 V for silicon, 0.2 V for germanium.
Example calculation:
- Load: 12V relay coil, 300Ξ© resistance β I_C = 40 mA
- Supply: VCC = 12V, control: 5V logic output
- Transistor: 2N2222, Ξ²_min at 40 mA = 75
- I_B_required = 40 / 75 = 0.53 mA
- I_B_actual = 0.53 Γ 10 = 5.3 mA
- R_B = (5 β 0.7) / 0.0053 = 811 Ξ© β use 820 Ξ©
Step 6: Add Flyback Diode (for Inductive Loads)
Any load with inductance (relay, motor, solenoid): add diode across load, cathode to VCC, anode to collector. Use 1N4001 or 1N4148.
Step 7: Verify
Build circuit. Measure:
- V_CE with transistor ON: should be < 0.5 V (saturation confirmed)
- V_CE with transistor OFF: should be close to VCC (cutoff confirmed)
- Transistor temperature after 10 minutes: warm is fine, hot (>60Β°C) means problem
Comparison: Transistor Switch vs Mechanical Relay
| Property | Transistor Switch | Mechanical Relay |
|---|---|---|
| Switching speed | Nanoseconds to microseconds | 5β50 milliseconds |
| Life | Billions of cycles | 1β10 million cycles |
| Isolation | Same ground (usually) | Full electrical isolation |
| AC switching | Not directly (DC only for BJT) | Yes (any voltage type) |
| Audible indication | Silent | Click (useful!) |
| Complex loads | Limited by V_CE, I_C | Versatile |
| Cost | Very low | Low |
Use transistor switch when: speed matters, size matters, lifespan matters. Use relay when: electrical isolation needed, switching AC mains, switching high voltage. Use both: transistor drives relay (the relay driver circuit) β combining electronic control with electrical isolation.
A First Project: LED Blinker with Transistor Switch
Demonstrates transistor switching with visible output:
Circuit:
- 9V battery
- NPN transistor (BC547 or 2N3904)
- LED with 470Ξ© series resistor from collector to 9V
- 100 kΞ© resistor from base to 9V through a pushbutton to ground (invert: press button β base goes high β LED on)
- Alternatively: base connected to the output of a 555 timer in astable mode for automatic blinking
With 555 timer at 1 Hz:
- 555 outputs 5V: transistor base sees ~(5β0.7)/100kΞ© = 43 Β΅A β I_C = 43Β΅A Γ 200 = 8.6 mA β LED on
- 555 outputs 0V: base at 0V β transistor off β LED off
- Result: LED blinks at 1 Hz
This circuit is the foundation of all LED drivers, indicator lamps, relay drivers, and digital output circuits.
Summary
Transistor as Switch β At a Glance
- Cutoff: V_BE < 0.5 V β I_C β 0 β V_CE β VCC β load off
- Saturation: V_BE β 0.7 V, sufficient I_B β I_C = load-limited β V_CE < 0.3 V β load on
- Design rule: I_B_actual = (I_C_max / Ξ²_min) Γ 5β10 for guaranteed saturation
- R_B = (V_control β 0.7V) / I_B_actual
- Always add flyback diode across inductive loads (relays, motors, solenoids)
- Verify: V_CE < 0.5 V (on), V_CE β VCC (off); transistor warm but not hot
- Transistor switch is the atom of digital electronics β cascaded inverters build all logic