When makers search for a transistor explain guide, they usually get bogged down in quantum mechanics and semiconductor doping profiles. Here is the practical reality: a transistor is simply a voltage- or current-controlled switch that allows a low-power microcontroller GPIO pin to control a high-power load like a motor, relay, or LED strip. For 95% of DIY electronics, you only need to operate the transistor in two states: completely OFF (cutoff) or completely ON (saturation).
The direct answer to 'which one should I use?' depends entirely on your load current and logic voltage. If you are switching loads under 200mA from a 3.3V or 5V microcontroller, use a 2N7000 N-channel MOSFET. If you are switching loads over 1A, use an IRLZ44N logic-level MOSFET. If you specifically need analog amplification or are working with legacy 12V automotive circuits, use a 2N2222 NPN BJT. Below is the exact framework to select, bias, and test these components on your bench.
The Core Decision: BJT vs. MOSFET Selection Tree
Bipolar Junction Transistors (BJTs) are current-controlled devices, meaning you must continuously supply current to the base pin to keep them turned on. Metal-Oxide-Semiconductor Field-Effect Transistors (MOSFETs) are voltage-controlled; they draw virtually zero continuous current at the gate, making them vastly superior for battery-powered microcontroller projects.
| Condition / Requirement | Recommended Device Type | Concrete Default Pick |
|---|---|---|
| Load < 200mA, driving from 3.3V/5V GPIO | Small-signal N-Channel MOSFET | 2N7000 (TO-92) |
| Load 1A to 30A, driving from 3.3V/5V GPIO | Logic-Level Power MOSFET | IRLZ44N (TO-220) |
| Load < 800mA, high-temperature automotive/industrial | General Purpose NPN BJT | 2N2222 (TO-92/TO-18) |
| Audio amplification or linear analog circuits | Low-noise NPN BJT | 2N3904 (TO-92) |
| High-side switching (load connected to ground) | P-Channel MOSFET or PNP BJT | IRLML6402 (SOT-23) |
Pinouts, Symbols, and Operation Regions
To wire these correctly, you must map the pins to their physical packages. Note that pinouts vary by package (TO-92 vs SOT-23), so always verify against the manufacturer datasheet. The standard TO-92 pinouts (viewed from the bottom with the flat edge facing you) are:
- 2N2222 / 2N3904 (NPN BJT): Emitter (E), Base (B), Collector (C).
- 2N7000 (N-Channel MOSFET): Source (S), Gate (G), Drain (D).
When using a transistor as a switch, you must drive it into the saturation region. If it stays in the active (linear) region, it acts as a resistor, dissipating massive heat and dropping voltage to your load.
| Operation Region | BJT (NPN) Voltages | MOSFET (N-Ch) Voltages | State / Behavior |
|---|---|---|---|
| Cutoff | Vbe < 0.5V, Ic = 0 | Vgs < Vth (typically < 2V) | Switch OPEN. No current flows. |
| Active (Linear) | Vbe ≈ 0.7V, Vce > 0.3V | Vgs > Vth, Vds > Vgs - Vth | Amplifier. High heat dissipation. Avoid for switching. |
| Saturation | Vbe > 0.8V, Vce < 0.2V | Vgs >> Vth (e.g., 5V or 10V) | Switch CLOSED. Minimal voltage drop and heat. |
Biasing for Switching: 3.3V Logic to 12V Relay Circuit
Let us build a complete, working circuit to drive a 12V relay using an ESP32 GPIO pin (3.3V logic) and a 2N2222 NPN BJT. The relay coil has a resistance of 120Ω, meaning it draws 100mA (I = V/R = 12V / 120Ω). The ESP32 GPIO can safely source up to 40mA, but we want to keep it under 10mA to prevent brownouts.
Component List:
- Q1: 2N2222 NPN Transistor
- R1: Base resistor (calculated below)
- D1: 1N4007 Flyback diode
- K1: 12V SPDT Relay (120Ω coil)
Step 1: Calculate the Base Resistor (R1)
To force a BJT into hard saturation, we use a 'forced beta' (hFE) of 10, regardless of what the datasheet says about its maximum gain. This guarantees the transistor acts as a closed switch even under worst-case temperature variations.
- Target Collector Current (Ic) = 100mA
- Required Base Current (Ib) = Ic / 10 = 10mA
- ESP32 GPIO Voltage (Vgpio) = 3.3V
- Base-Emitter Voltage Drop (Vbe) = 0.7V
- R1 = (Vgpio - Vbe) / Ib = (3.3V - 0.7V) / 0.010A = 260Ω
The closest standard E12 resistor value is 270Ω. This will draw 9.6mA from the ESP32, safely within limits, while providing enough base current to saturate the 2N2222.
Step 2: Wire the Flyback Diode (D1)
Relay coils are inductors. When the transistor turns off, the collapsing magnetic field generates a massive reverse voltage spike (often >100V) that will instantly punch through the 2N2222's collector-emitter junction, destroying it and potentially frying your ESP32. Wire the 1N4007 diode in reverse bias across the relay coil (cathode stripe to +12V, anode to the transistor collector).
Failure Modes and Multimeter Diode Testing
Transistors rarely fail randomly; they fail due to specific electrical abuses. BJTs typically fail from thermal runaway (insufficient base drive causes them to operate in the linear region, heat up, and short internally) or overcurrent (melting the bond wires). MOSFETs fail from Gate-Source overvoltage (exceeding the ±20V Vgs max, which punctures the microscopic silicon dioxide gate oxide) or Electrostatic Discharge (ESD) during handling.
You can definitively test a suspected dead transistor on your bench using a digital multimeter (DMM) in Diode Test Mode.
Testing an NPN BJT (e.g., 2N2222):
- Set DMM to diode mode (symbol: ▶| ).
- Place the Red probe on the Base (B) and Black probe on the Emitter (E). You should read a forward voltage drop between 0.600V and 0.750V.
- Move the Black probe to the Collector (C), keeping Red on Base. You should read a similar 0.600V to 0.750V drop.
- Reverse the probes (Black on Base, Red on Emitter or Collector). The meter must read OL (Over Limit / Open). If it reads near 0.000V, the transistor is internally shorted and dead.
Testing an N-Channel MOSFET (e.g., 2N7000 or IRLZ44N):
- Discharge the gate by touching the Source and Gate pins together with your finger or a probe.
- Set DMM to diode mode. Place Red on Drain and Black on Source. It should read OL.
- Keep Black on Source. Momentarily touch the Red probe to the Gate to charge it via the DMM's internal battery.
- Move the Red probe back to the Drain. The meter should now read a very low voltage drop (e.g., 0.000V to 0.200V), indicating the channel is turned on.
- Touch the Gate and Source together again to discharge. The Drain-Source reading should revert to OL. If it stays at 0.000V after discharging, the MOSFET is shorted and dead.
The 'Safe Default' Transistor Part Numbers
Stop buying random transistor assortments from unverified marketplaces for critical project builds. Keep these specific, industry-standard part numbers in your bench stock. They are widely available from authorized distributors like Digi-Key or Mouser, have exhaustive datasheets, and cover 99% of maker applications.
| Part Number | Type | Max Vds / Vce | Max Id / Ic | Key Spec (Rds_on / hFE) | Best Use Case |
|---|---|---|---|---|---|
| 2N3904 | NPN BJT | 40V | 200mA | hFE: 100 - 300 | Low-current signal switching, audio pre-amps. |
| 2N2222 | NPN BJT | 40V | 800mA | hFE: 100 - 300 | General purpose switching, 12V automotive relays. |
| 2N7000 | N-Ch MOSFET | 60V | 200mA | Rds(on): 5Ω @ Vgs=10V | Switching small LEDs or logic-level translation. |
| IRLZ44N | N-Ch MOSFET | 55V | 47A | Rds(on): 0.022Ω @ Vgs=5V | High-current motors, LED strips, solenoids from 5V/3.3V logic. |
| IRLML6402 | P-Ch MOSFET | 20V | 3.7A | Rds(on): 0.065Ω @ Vgs=4.5V | High-side power switching, battery reverse-polarity protection. |
For deeper reading on semiconductor physics and load-line analysis, refer to the Bipolar Junction Transistors chapter on All About Circuits or the comprehensive Transistor tutorials at Electronics Tutorials. However, for building robust, functional circuits on your workbench today, stick to the decision tree, calculate your base resistors for hard saturation, and never forget the flyback diode.






