To connect an NPN bipolar junction transistor (BJT) as a low-side switch, wire the load between the positive supply and the collector, connect the emitter to system ground, and feed the base through a current-limiting resistor from your control signal. For 90% of hobbyist and prototyping tasks involving relays, solenoids, or LED strips under 200mA, the 2N3904 is your default pick.
This guide walks through the exact schematic trace, physical pin mapping, and verification steps to get your circuit switching reliably without frying your microcontroller GPIO.
The Decision Tree: Pick Your Transistor for the Load
Before tracing the diagram, you must match the transistor to your load. Using an undersized BJT will cause thermal runaway; using a massive Darlington for a tiny load wastes voltage headroom. Use this decision matrix to select your part.
| Load Current (Ic) | Recommended Part | Package | Base Resistor (5V Logic) | Best Use Case |
|---|---|---|---|---|
| < 200 mA | 2N3904 | TO-92 | 1kΩ to 2.2kΩ | Standard 5V/12V relays, small LEDs, buzzers |
| 200 mA - 800 mA | 2N2222A | TO-92 / TO-18 | 470Ω to 1kΩ | High-power LEDs, small DC motors, solenoid valves |
| 1 A - 5 A | TIP120 | TO-220 | 1kΩ (Darlington) | LED strips, stepper motor coils, automotive relays |
| > 5 A | IRLZ44N (MOSFET) | TO-220 | 100Ω Gate + 10kΩ Pull-down | Heaters, large motors, high-current battery loads |
Reading the Schematic: Symbols and Node-by-Node Trace
In a schematic, an NPN BJT is represented by a circle (sometimes omitted) with three terminals. The Base (B) is the perpendicular line. The Collector (C) is the angled line without an arrow. The Emitter (E) is the angled line with an arrow pointing outward, indicating conventional current flow direction.
Here is the exact node-by-node trace for a 12V relay switched by a 5V microcontroller GPIO, using the 2N3904.
- Node 1 (Source to Load): The 12V positive supply connects to Pin 1 (Coil) of the relay.
- Node 2 (Load to Collector): Pin 2 (Coil) of the relay connects directly to the Collector (C) of the 2N3904.
- Node 3 (Flyback Diode): A 1N4007 diode is placed in parallel with the relay coil. The cathode (silver stripe) connects to Node 1 (12V). The anode connects to Node 2 (Collector). This clamps inductive kickback.
- Node 4 (Emitter to Ground): The Emitter (E) of the 2N3904 connects to the system ground (0V). This ground must be shared with the 12V supply and the microcontroller.
- Node 5 (Control to Base): The 5V GPIO pin connects to one leg of a 1kΩ resistor. The other leg of the resistor connects to the Base (B) of the 2N3904.
When the GPIO goes HIGH (5V), current flows from the GPIO, through the resistor, into the Base, and out the Emitter to ground. This forward-biases the base-emitter junction, allowing a much larger current to flow from the 12V source, through the relay coil, into the Collector, and out the Emitter, energizing the relay.
Physical Pinout and Terminal Mapping Table
Schematics are clean; physical parts are confusing. The 2N3904 typically comes in a TO-92 plastic package. If you hold the transistor with the flat side facing you and the pins pointing down, the pins from left to right are Emitter, Base, and Collector.
| Terminal | Schematic Symbol | TO-92 Pin (Flat side facing you) | TO-220 Pin (TIP120 - Tab facing you) | Function in Circuit |
|---|---|---|---|---|
| Emitter (E) | Arrow pointing OUT | Pin 1 (Left) | Pin 3 (Right) | Current exit path to Ground |
| Base (B) | Perpendicular line | Pin 2 (Middle) | Pin 1 (Left) | Control signal input (via resistor) |
| Collector (C) | Angled line, no arrow | Pin 3 (Right) | Pin 2 (Middle / Metal Tab) | Current entry path from Load |
Step-by-Step Wiring and Breadboard Assembly
Follow this sequence to build the circuit on a standard solderless breadboard. This order prevents accidental short circuits and ensures the flyback diode is correctly oriented before power is applied.
- Seat the Transistor: Push the 2N3904 into the breadboard so each leg is in a separate row (e.g., rows 10, 11, 12). Confirm the flat side is facing you: E (10), B (11), C (12).
- Wire the Emitter Ground: Insert a jumper wire from row 10 (Emitter) to the negative (blue) ground rail. Connect this rail to your power supply ground and microcontroller ground.
- Install the Base Resistor: Insert a 1kΩ resistor. One leg goes to row 11 (Base). The other leg goes to an empty row (e.g., row 20). Run a jumper from row 20 to your microcontroller's GPIO pin (e.g., Pin D4).
- Place the Load (Relay): Connect the relay coil's positive pin to the positive (red) 12V rail. Connect the relay coil's negative pin to row 12 (Collector).
- Install the Flyback Diode: Insert the 1N4007 diode. The anode (unmarked side) must go to row 12 (Collector). The cathode (silver stripe side) must go to the positive 12V rail. Reversing this will short the 12V supply to ground through the diode when the relay turns on.
- Apply Power: Connect the 12V supply to the red rail, and the 5V USB to the microcontroller. Send a HIGH signal to the GPIO to test.
Verifying Your Connections with a Multimeter
Before applying power, or if the circuit fails to switch, use your multimeter's Diode Test Mode (usually indicated by a diode symbol and sound wave icon) to verify the transistor junctions and diode polarity in-circuit.
Testing the BJT Junctions (Power OFF):
- Base to Emitter (Forward): Red probe on Base, Black probe on Emitter. Expected reading: 0.600V to 0.750V.
- Base to Collector (Forward): Red probe on Base, Black probe on Collector. Expected reading: 0.600V to 0.750V.
- Reverse Bias Check: Swap probes (Black on Base, Red on Emitter/Collector). Expected reading: OL (Over Limit / Open).
- Collector to Emitter: Probes in either direction. Expected reading: OL. If you read near 0.00V, the transistor is blown short or wired incorrectly.
Testing the Flyback Diode (Power OFF):
- Red probe on Anode, Black probe on Cathode (stripe). Expected: 0.500V to 0.700V.
- Swap probes. Expected: OL.
Common Wiring Faults and How to Fix Them
Even with the right diagram, bench mistakes happen. Here is how to diagnose the three most common failures when learning how to connect transistor circuits.
Fault 1: The relay clicks rapidly or the microcontroller resets when the GPIO goes HIGH.
Cause: Missing or reversed flyback diode. When the transistor turns off, the relay coil's collapsing magnetic field generates a high-voltage spike (inductive kickback) that travels back into the microcontroller's ground or VCC, causing a brownout.
Fix: Verify the 1N4007 cathode stripe is pointing toward the positive supply rail.
Fault 2: The transistor gets too hot to touch, or melts the breadboard plastic.
Cause: The transistor is operating in the linear (active) region instead of saturation. This happens if the base resistor is too large, starving the base of current. The transistor acts like a variable resistor, dissipating the load's power as heat.
Fix: Calculate the correct base resistor. For a 2N3904 driving a 70mA relay, you need at least 0.7mA of base current (assuming hFE of 100). To force saturation, overdrive it by 5x (3.5mA). Using a 5V GPIO: R = (5V - 0.7V) / 3.5mA = 1.2kΩ. Swap a 10kΩ resistor for a 1kΩ resistor.
Fault 3: The load stays ON even when the GPIO is LOW or the microcontroller is unplugged.
Cause: Floating base pin. A BJT is highly sensitive to ambient electromagnetic noise. If the base is left disconnected, it can act as an antenna and turn itself on.
Fix: Add a 10kΩ pull-down resistor between the Base and Ground. This ensures the base is held firmly at 0V when the GPIO is high-impedance or floating.
For deeper theoretical background on BJT operating regions and saturation math, refer to the All About Circuits BJT textbook chapter. For exact maximum ratings and thermal derating curves, always consult the manufacturer's datasheet, such as the onsemi 2N3904 documentation.






