When you move beyond blinking LEDs directly from a microcontroller GPIO, you hit the fundamental wall of transistor electronics: logic chips cannot source the current required by motors, solenoids, or high-power relays. You need a solid-state switch. But walking into a parts supplier or opening your bench bin reveals dozens of part numbers, package types, and acronyms. Do you need a Bipolar Junction Transistor (BJT) or a Metal-Oxide-Semiconductor Field-Effect Transistor (MOSFET)? What happens if you feed 3.3V to a gate that requires 10V?

This guide cuts through the semiconductor physics and gives you a decision-forward framework for selecting, biasing, and testing the right transistor for your next build.

The Safe Defaults: What to Keep in Your Parts Bin

Before diving into load calculations, here is the short answer for 90% of hobbyist and DIY maker projects. If you stock these three components, you can switch almost any DC load under 30V and 60A without needing specialized gate drivers or heatsinks.

The Bench-Trinity Defaults:
  • 2N7000 (N-Channel MOSFET): Max 200mA, 60V Vds. TO-92 package. Use for small indicators, low-power optocouplers, and signal routing.
  • 2N2222A (NPN BJT): Max 800mA, 40V Vce. TO-92 package. The universal default for driving small 5V relays or medium-current LEDs from 5V logic.
  • IRLB8721 (Logic-Level N-Channel MOSFET): Max 62A, 30V Vds. TO-220 package. Fully turns on at Vgs = 4.5V (and works well enough at 3.3V). Use for high-current DC motors, solenoids, and heavy 12V/24V loads directly from an ESP32 or Arduino.

Pinouts, Symbols, and Operation Regions

To wire a transistor correctly, you must map the physical pins to the schematic symbol. The most common packages you will encounter are the TO-92 (small plastic teardrop) and the TO-220 (larger metal tab for heat dissipation).

Physical Pin Mapping

Hold the component with the flat side facing you and the leads pointing down:

  • 2N2222A (NPN BJT, TO-92): Emitter (E), Base (B), Collector (C).
  • 2N7000 (N-Ch MOSFET, TO-92): Source (S), Gate (G), Drain (D).
  • IRLB8721 (N-Ch MOSFET, TO-220, flat side facing you): Gate (G), Drain (D), Source (S). Note: The metal mounting tab on the back is internally connected to the Drain.

Operation Regions Table

Transistors operate in distinct regions depending on the bias applied. In digital electronics and microcontroller projects, we almost exclusively use the transistor as a switch, toggling between Cutoff and Saturation/Ohmic.

Region BJT State (Vce / Ic) MOSFET State (Vds / Id) Primary Use Case
Cutoff Vce = V_supply, Ic ≈ 0A (Vbe < 0.6V) Vds = V_supply, Id ≈ 0A (Vgs < Vth) Switch OFF (Open circuit)
Active / Linear Vce is intermediate, Ic = β × Ib Vds is intermediate, Id ∝ (Vgs-Vth)² Signal Amplification, Linear Regulators
Saturation / Ohmic Vce ≈ 0.2V, Ic limited by load Vds ≈ Id × Rds(on), Id limited by load Switch ON (Closed circuit, minimal heat)

Source: For deeper semiconductor physics, refer to the Electronics Tutorials BJT guide and their companion Introduction to MOSFETs.

Decision Tree: Selecting the Right Transistor

Choosing between a BJT and a MOSFET comes down to load current, available logic voltage, and switching speed. Use this decision matrix to terminate your selection process with a concrete part number.

Load Current Supply Voltage Logic Level (GPIO) Concrete Pick (Part Number) Why This Part?
< 200mA < 60V 3.3V or 5V 2N7000 (N-Ch MOSFET) Zero steady-state gate current draw; simple drive.
200mA - 800mA < 40V 5V 2N2222A (NPN BJT) Cheap, robust, handles 5V logic easily with a single base resistor.
> 1A < 30V 3.3V or 5V IRLB8721 (Logic-Level MOSFET) Extremely low Rds(on) at 3.3V; no heatsink needed for <10A.
> 1A > 30V up to 100V 5V+ IRF520 + Gate Driver IC High voltage tolerance, but requires 10V+ on gate to fully saturate.
The 3.3V Trap: Never use a standard IRF520 or IRF540 directly with an ESP32 or Raspberry Pi (3.3V logic). These are standard-level MOSFETs requiring Vgs = 10V to achieve their rated Rds(on). At 3.3V, they will operate in the linear region, act as a massive resistor, overheat, and destroy your load. Always look for the "IRL" prefix (e.g., IRLZ44N, IRLB8721) which denotes Logic-Level gate thresholds.

Complete Application Circuit: 12V Relay Driver from 3.3V Logic

Let's build a robust switch for a 12V automotive-style relay (coil resistance ~75Ω, drawing ~160mA) using an ESP32 (3.3V GPIO). We will use the IRLB8721 logic-level MOSFET.

Component List & Values

  • Q1: IRLB8721 (N-Channel Logic-Level MOSFET)
  • R1 (Gate Resistor): 100Ω to 330Ω (Limits inrush current from the GPIO pin charging the gate capacitance)
  • R2 (Pull-down Resistor): 10kΩ (Prevents floating gate turn-on during MCU boot)
  • D1 (Flyback Diode): 1N4007 or 1N4148 (Protects MOSFET from inductive voltage spikes)
  • K1: 12V DC Relay

Wiring Steps

  1. Gate Drive: Connect the ESP32 GPIO pin through R1 (330Ω) to the Gate (G) of the IRLB8721.
  2. Pull-Down: Connect R2 (10kΩ) between the Gate (G) and Source (S). This ensures the relay stays off if the ESP32 pin is high-impedance during boot.
  3. Source to Ground: Connect the Source (S) pin directly to the common system Ground (GND).
  4. Load Connection: Connect the Relay Coil's negative terminal to the Drain (D) pin. Connect the Relay Coil's positive terminal to the 12V supply.
  5. Flyback Protection: Place D1 in parallel with the relay coil. The cathode (striped end) must point toward the 12V supply, and the anode points toward the Drain. This routes the inductive kickback safely back to the 12V rail when the MOSFET turns off.

Why no base resistor math? Unlike a BJT, a MOSFET is voltage-controlled, not current-controlled. Once the gate capacitor is charged, steady-state gate current is effectively zero. The 330Ω resistor is only there to protect the ESP32 GPIO from the brief nanosecond current spike required to charge the gate capacitance (typically ~2000pF for this part).

Bench Testing: Failure Modes and Multimeter Diagnostics

Transistors rarely fail gracefully. When they die, they usually fail shorted (Collector-to-Emitter or Drain-to-Source), which leaves your load permanently turned on, or they fail open due to a blown internal bond wire.

How to Test an NPN BJT (2N2222) with a DMM

Set your multimeter to Diode Test Mode.

  1. Place the red probe on the Base (B) and black on Emitter (E). You should read a forward voltage drop of 0.6V to 0.7V.
  2. Place red on Base (B) and black on Collector (C). You should read 0.6V to 0.7V.
  3. Reverse the probes (black on B, red on E or C). The meter should read OL (Open Loop).
  4. Measure across C and E in both directions. It must read OL. If it reads near 0.0V, the BJT is shorted and dead.

How to Test an N-Channel MOSFET (IRLB8721) with a DMM

MOSFET testing relies on charging and discharging the internal gate capacitance using your multimeter's diode test voltage (usually 2V-3V).

  1. Discharge first: Touch the Gate (G) and Source (S) pins simultaneously with your finger or a wire to bleed off any stray static charge.
  2. Set DMM to Diode Mode. Place black probe on Source (S), red probe on Drain (D). It should read OL (or the body diode drop of ~0.5V if you swap probes, depending on internal diode orientation).
  3. Charge the gate: Keep the black probe on Source (S). Move the red probe to the Gate (G) for two seconds to charge the internal capacitor.
  4. Verify conduction: Move the red probe back to the Drain (D) while keeping black on Source (S). The meter should now read a very low voltage drop (near 0.0V to 0.2V), indicating the channel has turned on.
  5. Touch G and S together again to discharge. The D-S path should return to OL.
Warning on In-Circuit Testing: Never trust a multimeter diode test while the transistor is soldered to a board. Parallel resistors, microcontroller GPIO protection diodes, and flyback diodes will create false low-resistance paths. Desolder at least two pins (or lift the component entirely) before bench-testing.

Final Verdict: Which Transistor Should You Stock?

If you are building a modern embedded system using 3.3V logic (ESP32, Raspberry Pi, STM32), make the IRLB8721 your default heavy-lifter and the 2N7000 your default signal switch. The days of designing complex base-resistor networks and worrying about BJT beta-drop (hFE variance) for simple on/off switching are over for hobbyists. MOSFETs offer vastly superior thermal performance, zero steady-state gate current, and simpler drive requirements—provided you strictly enforce the "logic-level" Vgs threshold rule.

Keep a sleeve of 2N2222A BJTs on hand for legacy 5V Arduino repairs or when you specifically need a linear amplifier for an analog audio stage, but for 95% of digital load-switching tasks, a logic-level MOSFET with a proper flyback diode is the undisputed champion of the workbench.