The Direct Answer: Safe Default Transistors Used for DC Switching

When you need to switch a DC load with a microcontroller GPIO, the 2N3904 (NPN BJT) and the IRLZ44N (Logic-Level N-Channel MOSFET) are the safest, most reliable default choices on the bench. If you are designing a custom PCB and need surface-mount parts, the AO3400 (SOT-23 N-Channel MOSFET) is the industry standard for low-side switching.

Pinout & Symbol Quick Reference:
2N3904 (TO-92 package): Hold the flat side facing you with the pins pointing down. The pins are Emitter (E), Base (B), and Collector (C). In schematics, the NPN symbol features an arrow on the emitter pointing outward.
IRLZ44N (TO-220 package): Hold the metal tab facing you with pins down. The pins are Gate (G), Drain (D), and Source (S). The MOSFET symbol shows a gate line separated by a gap from the channel, with an arrow on the source pointing inward for N-channel.

Here are the exact ratings for these default parts so you don't exceed their limits:

  • 2N3904 (NPN BJT): VCEO = 40V, IC = 200mA, PD = 625mW. Best for relays, small LEDs, and low-power solenoids.
  • IRLZ44N (N-CH MOSFET): VDSS = 55V, ID = 47A, RDS(on) = 22mΩ @ VGS=5V. Best for motors, high-current LED strips, and heating elements.
  • AO3400 (SMD N-CH MOSFET): VDSS = 30V, ID = 5.7A, RDS(on) = 35mΩ @ VGS=4.5V. Best for compact PCB designs switching moderate loads.

BJT vs MOSFET: Operation Regions and Specs

To use a transistor as a switch, you must drive it into its lowest resistance state (Saturation for BJTs, Ohmic/Linear for MOSFETs). Here is how the operation regions compare when designing switching circuits.

Region BJT Condition (NPN) MOSFET Condition (N-CH) Primary Use Case
Cutoff VBE < 0.6V, IC ≈ 0 VGS < VGS(th), ID ≈ 0 Switch OFF (Open circuit)
Active / Saturation VBE ≈ 0.7V, VCE > VCE(sat) VGS > VGS(th), VDS > VGS-Vth Amplification / Linear control (Avoid for switching)
Saturation / Ohmic VBE > 0.7V, VCE ≈ 0.2V VGS ≥ 4.5V, VDS is very low Switch ON (Closed circuit, minimal heat)
The VGS(th) Trap: Many makers look at a MOSFET datasheet, see a Gate-Source Threshold Voltage (VGS(th)) of 2.0V, and assume it will fully turn on with a 3.3V ESP32 GPIO. This is false. VGS(th) is merely the voltage where the MOSFET begins to conduct (usually defined at a tiny 250µA). To achieve the rated low RDS(on) and handle high current without melting, you must look at the RDS(on) test conditions, which typically require VGS = 4.5V or 5V.

How to Bias and Select the Right Transistor Used in Your Circuit

Let's build a complete application circuit: switching a 12V relay (coil resistance 400Ω, requiring 30mA) using a 3.3V GPIO from an ESP32 and a 2N3904 NPN BJT.

Step-by-Step Base Resistor Calculation

  1. Calculate Collector Current (IC): The relay needs 30mA. So, IC = 30mA.
  2. Apply Forced Beta: The 2N3904 datasheet lists a DC current gain (hFE) of 100 to 300. However, to guarantee hard saturation (acting as a true switch with minimal VCE voltage drop), we use a "forced beta" of 10. Therefore, required Base Current IB = IC / 10 = 30mA / 10 = 3mA.
  3. Calculate Base Resistor (RB): The ESP32 GPIO outputs 3.3V. The BJT base-emitter junction drops about 0.7V.
    Voltage across resistor = 3.3V - 0.7V = 2.6V.
    Using Ohm's Law: R = V / I = 2.6V / 0.003A = 866Ω.
  4. Select Standard Value: Choose the next standard E12 resistor value up to slightly limit current while maintaining saturation: 1kΩ. (This yields 2.6mA base current, which is still sufficient for a forced beta of ~11).

Complete Application Circuit Component List

  • Q1: 2N3904 NPN Transistor
  • R1: 1kΩ Base Resistor (0.25W)
  • D1: 1N4148 or 1N4007 Flyback Diode (Cathode to 12V, Anode to Collector)
  • K1: 12V DC Relay (400Ω coil)

Wiring: ESP32 GPIO → R1 → Base of Q1. Emitter of Q1 to GND. Collector of Q1 to Relay Coil Pin 1. Relay Coil Pin 2 to 12V Supply. D1 placed in parallel with the relay coil, reverse-biased, to absorb inductive kickback when the transistor switches off.

Failure Modes and Multimeter Testing

Transistors rarely fail without a reason. Understanding how they die helps you debug your board when the magic smoke escapes.

Common Failure Modes

  • BJT Thermal Runaway: As a BJT heats up, its VBE drops, causing it to draw more base current, which creates more heat. Without proper heat sinking or emitter degeneration, it destroys itself.
  • BJT Secondary Breakdown: Occurs when high VCE and high IC happen simultaneously (operating in the active region with a heavy load). Localized hot spots melt the silicon die.
  • MOSFET Gate Oxide Puncture: The gate is insulated by a microscopic layer of silicon dioxide. Exceeding the VGS(max) (usually ±20V) or introducing static discharge (ESD) punctures this layer, permanently shorting the gate to the source.
  • MOSFET Avalanche Failure: Switching off a highly inductive load without a flyback diode causes a massive voltage spike that exceeds VDSS, punching through the drain-source channel.

How to Test with a Digital Multimeter (DMM)

Set your multimeter to Diode Test mode (the symbol with an arrow and a line).

  1. Testing an NPN BJT (2N3904):
    • Place the Red probe on the Base (B) and Black on Emitter (E). You should read a forward voltage drop between 0.60V and 0.75V.
    • Keep Red on Base (B), move Black to Collector (C). Expect a similar 0.60V - 0.75V reading.
    • Reverse the probes (Black on B, Red on E or C). The meter must read "OL" (Open Loop).
    • Measure between Collector and Emitter in both directions. Both must read "OL". If any of these tests fail, the BJT is dead.
  2. Testing an N-Channel MOSFET (IRLZ44N):
    • First, discharge any residual gate charge by touching a wire across the Gate (G) and Source (S) pins.
    • Place the Black probe on the Drain (D) and Red on the Source (S). You are testing the intrinsic body diode. You should read a forward drop of about 0.4V to 0.6V.
    • Reverse probes (Red on D, Black on S). It must read "OL".
    • With the Black probe still on Source (S), briefly touch the Red probe to the Gate (G) to charge the gate capacitance and turn the MOSFET on.
    • Move the Red probe back to the Drain (D). The meter should now read a very low voltage (near 0.00V) because the channel is conducting. If it still reads "OL", the MOSFET is blown or the gate is shorted.

FAQ: Common Questions About the Transistor Used in Maker Projects

What transistor used for high-current DC motor switching?

For DC motors drawing more than 1A, abandon BJTs entirely. The base current required to saturate a BJT at 5A would be 500mA, which will fry your microcontroller and overheat the BJT. Use a logic-level N-Channel MOSFET like the IRLB8721 (VDSS=30V, ID=62A, fully enhanced at VGS=4.5V) or the IRLZ44N. Always place a Schottky diode (like the 1N5822) across the motor terminals to clamp inductive flyback voltage, and use a 100Ω gate resistor with a 10kΩ gate-to-source pulldown resistor to prevent oscillation during PWM switching.

Which transistor used for 3.3V ESP32 logic level outputs?

If you are constrained to 3.3V logic, standard MOSFETs like the IRF520 (which needs 10V to fully turn on) will operate in their linear region, overheat, and fail. You must select a MOSFET explicitly rated for "Logic Level" drive. The AO3400 (SMD) or the IRLML2502 (SOT-23) are excellent 3.3V-compatible choices, guaranteeing low RDS(on) at VGS = 2.5V or 3.3V. If you must use a BJT, the 2N3904 works perfectly with 3.3V, provided you calculate the base resistor to supply enough current for saturation (as demonstrated in the circuit above).

How do I know if the transistor used in my circuit is saturated?

You verify saturation by measuring the voltage across the main switching terminals while the circuit is under load. For a BJT, measure VCE (Collector to Emitter) with your multimeter. If the transistor is truly saturated, VCE should be very low, typically between 0.1V and 0.3V. If you measure 1.5V or higher, the BJT is in the active (linear) region, meaning it is dropping voltage, wasting power as heat, and not delivering full voltage to your load. For a MOSFET, measure VDS (Drain to Source); a fully enhanced MOSFET will show only a few millivolts of drop at moderate currents.