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 / RequirementRecommended Device TypeConcrete Default Pick
Load < 200mA, driving from 3.3V/5V GPIOSmall-signal N-Channel MOSFET2N7000 (TO-92)
Load 1A to 30A, driving from 3.3V/5V GPIOLogic-Level Power MOSFETIRLZ44N (TO-220)
Load < 800mA, high-temperature automotive/industrialGeneral Purpose NPN BJT2N2222 (TO-92/TO-18)
Audio amplification or linear analog circuitsLow-noise NPN BJT2N3904 (TO-92)
High-side switching (load connected to ground)P-Channel MOSFET or PNP BJTIRLML6402 (SOT-23)
Bench Rule of Thumb: Never use a standard power MOSFET like the IRF520 with a 3.3V ESP32 or 5V Arduino. The IRF520 requires 10V at the gate to fully turn on (low Rds(on)). At 5V, it will operate in its linear region, overheat, and destroy your load. Always look for the 'L' in the part number (e.g., IRLZ44N), which designates a logic-level gate threshold.

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 RegionBJT (NPN) VoltagesMOSFET (N-Ch) VoltagesState / Behavior
CutoffVbe < 0.5V, Ic = 0Vgs < Vth (typically < 2V)Switch OPEN. No current flows.
Active (Linear)Vbe ≈ 0.7V, Vce > 0.3VVgs > Vth, Vds > Vgs - VthAmplifier. High heat dissipation. Avoid for switching.
SaturationVbe > 0.8V, Vce < 0.2VVgs >> 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).

Safety & Hardware Protection: Never omit the flyback diode when switching inductive loads (relays, solenoids, DC motors). If you are using a MOSFET instead of a BJT, the diode is still mandatory, though some power MOSFETs include a parasitic body diode that can handle small inductive spikes. For reliability, always use an external Schottky (e.g., 1N5819) or standard silicon (1N4007) diode.

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):

  1. Set DMM to diode mode (symbol: ▶| ).
  2. 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.
  3. Move the Black probe to the Collector (C), keeping Red on Base. You should read a similar 0.600V to 0.750V drop.
  4. 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):

  1. Discharge the gate by touching the Source and Gate pins together with your finger or a probe.
  2. Set DMM to diode mode. Place Red on Drain and Black on Source. It should read OL.
  3. Keep Black on Source. Momentarily touch the Red probe to the Gate to charge it via the DMM's internal battery.
  4. 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.
  5. 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 NumberTypeMax Vds / VceMax Id / IcKey Spec (Rds_on / hFE)Best Use Case
2N3904NPN BJT40V200mAhFE: 100 - 300Low-current signal switching, audio pre-amps.
2N2222NPN BJT40V800mAhFE: 100 - 300General purpose switching, 12V automotive relays.
2N7000N-Ch MOSFET60V200mARds(on): 5Ω @ Vgs=10VSwitching small LEDs or logic-level translation.
IRLZ44NN-Ch MOSFET55V47ARds(on): 0.022Ω @ Vgs=5VHigh-current motors, LED strips, solenoids from 5V/3.3V logic.
IRLML6402P-Ch MOSFET20V3.7ARds(on): 0.065Ω @ Vgs=4.5VHigh-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.