An n-p-n transistor is a bipolar junction transistor (BJT) where a small current injected into the Base terminal controls a much larger current flowing from the Collector to the Emitter. If you need a reliable, low-cost switch for a microcontroller project, the safe default part numbers are the 2N3904 (for loads under 200mA) or the 2N2222 (for loads up to 800mA). In 2026, you can still pick up a 10-pack of either for under $6, making them the undisputed workhorses of the hobbyist bench.
Unlike MOSFETs, which are voltage-controlled, the n-p-n transistor is strictly current-controlled. This means you cannot simply connect a GPIO pin directly to the base; you must calculate and install a base resistor to limit current and force the transistor into saturation. Below, we break down the exact part numbers to stock, how to bias the device, a complete real-world circuit, and how to test a suspect component with your multimeter.
Safe Default N-P-N Transistor Part Numbers & Ratings
Before wiring anything, you must select a transistor that can handle your load current ($I_C$) and supply voltage ($V_{CE}$). Always derate your maximums by at least 20% for thermal safety. Here are the five n-p-n transistors you should keep in your bench kit, along with their critical datasheet limits.
| Part Number | Package | Max $I_C$ (mA) | Max $V_{CE}$ (V) | $h_{FE}$ (DC Gain) | Primary Application |
|---|---|---|---|---|---|
| 2N3904 | TO-92 | 200 | 40 | 100 - 300 | Low-power logic switching, small LED drivers |
| 2N2222 / PN2222 | TO-92 / TO-18 | 800 | 30 | 100 - 300 | Relay drivers, medium-power motor switching |
| BC547 | TO-92 | 100 | 45 | 110 - 800 (depends on A/B/C suffix) | Audio preamps, high-gain signal amplification |
| 2N4401 | TO-92 | 600 | 40 | 100 - 300 | Higher voltage logic switching, alternative to 2N2222 |
| TIP31C | TO-220 | 3000 | 100 | 10 - 50 | High-current loads, linear power supplies, audio output |
Biasing the N-P-N Transistor: Operation Regions
To use an n-p-n transistor effectively, you must understand its physical symbol and its three operating regions. In the schematic symbol, the Emitter is the leg with the arrow. For an n-p-n device, the arrow points outward, away from the Base. A common mnemonic is NPN = Not Pointing iN. The Collector is the straight leg opposite the arrow, and the Base is the middle vertical line.
By manipulating the Base-Emitter voltage ($V_{BE}$) and the Collector-Emitter voltage ($V_{CE}$), you push the transistor into one of three distinct regions. For switching applications (like driving a relay), you only care about Cutoff and Saturation. For audio or sensor amplification, you use the Active region.
| Operation Region | Base-Emitter Voltage ($V_{BE}$) | Collector-Emitter Voltage ($V_{CE}$) | Collector Current ($I_C$) | Primary Application |
|---|---|---|---|---|
| Cutoff | < 0.6V (Typically 0V) | $V_{CE} = V_{CC}$ (Supply Voltage) | 0 mA (Leakage only) | Open switch (OFF state) |
| Active (Linear) | $\approx$ 0.6V to 0.7V | > 0.2V (Typically $V_{CC}/2$) | $I_C = \beta \times I_B$ | Signal amplification, analog audio |
| Saturation | $\approx$ 0.7V to 0.8V | $\approx$ 0.2V ($V_{CE(sat)}$) | $I_C < \beta \times I_B$ (Limited by load) | Closed switch (ON state) |
When designing a switch, your goal is to drive enough Base current ($I_B$) to guarantee Saturation. If you under-drive the base, the transistor stays in the Active region. In the Active region, the transistor acts like a variable resistor, dropping significant voltage across $V_{CE}$ and dissipating that energy as heat ($P = V_{CE} \times I_C$). This is the primary cause of thermal failure in hobbyist switching circuits.
A Complete N-P-N Switching Circuit with Component Values
Let us build a practical circuit: switching a 12V, 100mA automotive-style relay coil using a 3.3V GPIO pin from an ESP32 DevKit v1. We will use the 2N2222 as our n-p-n transistor.
1. Calculate the Base Resistor ($R_B$)
To ensure the 2N2222 enters hard saturation, we use a 'forced beta' ($\beta_{forced}$) of 10. This is a standard engineering rule of thumb that guarantees saturation regardless of the transistor's actual $h_{FE}$ variations.
- Load Current ($I_C$): 100 mA
- Required Base Current ($I_B$): $I_C / 10 = 100\text{mA} / 10 = 10\text{mA}$
- ESP32 GPIO Voltage ($V_{GPIO}$): 3.3V
- Base-Emitter Drop ($V_{BE}$): 0.7V
Using Ohm's Law: $R_B = (V_{GPIO} - V_{BE}) / I_B$
$R_B = (3.3\text{V} - 0.7\text{V}) / 0.010\text{A} = 260 \Omega$
The closest standard E12 resistor value is 270 $\Omega$. This will yield a base current of 9.6mA, which is perfectly safe for the ESP32 (which has a recommended GPIO limit of 20mA) and sufficient to saturate the transistor.
2. Component List and Wiring Steps
- Transistor (Q1): 2N2222 (TO-92 package). Place it on the breadboard.
- Base Resistor (R1): 270 $\Omega$ (1/4W). Connect one leg to the ESP32 GPIO pin (e.g., D5) and the other to the Base (middle pin) of Q1.
- Relay Coil: Connect the positive terminal of the 12V relay coil to your 12V power supply. Connect the negative terminal to the Collector (left pin, flat face forward) of Q1.
- Grounding: Connect the Emitter (right pin) of Q1 to the common ground shared by the ESP32 and the 12V power supply. Never forget to tie the microcontroller ground to the load ground.
- Flyback Diode (D1): Place a 1N4007 diode in parallel with the relay coil. The cathode (striped end) must point toward the 12V positive supply, and the anode points toward the Collector. This snubs the inductive voltage spike when the transistor turns off.
How N-P-N Transistors Fail and How to Test Them
N-P-N transistors rarely fail without a reason. The most common failure modes include thermal runaway (caused by inadequate heat sinking in the Active region), secondary breakdown (exceeding the Safe Operating Area with high $V_{CE}$ and high $I_C$ simultaneously), and overvoltage punch-through (exceeding $V_{CEO}$ without a flyback diode on inductive loads). When they fail, they typically short out internally, most commonly resulting in a Collector-Emitter short.
You can verify the health of an n-p-n transistor using a standard digital multimeter set to Diode Test Mode (the symbol with an arrow and a line). An n-p-n transistor is essentially two back-to-back diodes sharing a common anode at the Base.
Step-by-Step Multimeter Testing Procedure
- Remove from Circuit: Never test a transistor while it is soldered into a board. Parallel paths through resistors and coils will give you false readings. Desolder it or pull it from the breadboard.
- Identify the Base: If the pinout is unknown, use the meter to find the pin that acts as a common anode to the other two. For a known 2N2222 (flat face forward, pins down), the pins are Emitter (1), Base (2), Collector (3).
- Test Base to Emitter (Forward): Place the red probe on the Base and the black probe on the Emitter. You should read a forward voltage drop between 0.600V and 0.750V.
- Test Base to Emitter (Reverse): Swap the probes (black on Base, red on Emitter). The meter should read OL (Over Limit / Open).
- Test Base to Collector (Forward): Red probe on Base, black on Collector. Expect the same 0.600V to 0.750V drop.
- Test Base to Collector (Reverse): Black on Base, red on Collector. Expect OL.
- Test Collector to Emitter: Place probes across Collector and Emitter in both directions. Both must read OL. If you read a short (0.000V or a beep) in either direction, the silicon has melted internally and the part is dead.
For further reading on semiconductor physics and safe operating areas, refer to the Bipolar Junction Transistors chapter on All About Circuits. If you need exact thermal derating curves for your specific batch, always pull the manufacturer datasheet, such as the Texas Instruments 2N2222 Datasheet, to ensure your design stays within the Safe Operating Area (SOA) limits.
By sticking to proven default part numbers like the 2N2222, calculating your base resistor for hard saturation, and always using flyback diodes on inductive loads, the n-p-n transistor will remain one of the most reliable and versatile components in your electronics arsenal.






