The Short Answer: Safe Default Transistors and Pinouts

If you need to know how to use a transistor for general-purpose switching or low-power amplification, the safest default NPN part numbers are the 2N3904 (up to 200mA) or the 2N2222 (up to 800mA). For high-current loads like motors or solenoids, default to the TIP120 Darlington pair (up to 5A). If your circuit requires high-side switching, use the PNP equivalents: 2N3906 or 2N2907.

For the standard TO-92 plastic package (like the 2N3904 or BC547), hold the transistor with the flat side facing you and the pins pointing down. From left to right, the pins are:

  1. Emitter (E): The reference terminal, usually tied to ground (NPN) or VCC (PNP).
  2. Base (B): The control terminal. A small current here dictates the flow between Collector and Emitter.
  3. Collector (C): The terminal that receives current from the load (NPN) or supplies current to the load (PNP).
Bench Tip: Never rely purely on visual memory for pinouts. Manufacturers occasionally use different die configurations (e.g., the BC547 is C-B-E, while the 2N3904 is E-B-C). Always verify with a multimeter or check the specific manufacturer's datasheet before soldering.
Safe Default Bipolar Junction Transistors (BJTs)
Part Number Type Package Max Collector Current (Ic) Max Vceo Typical hFE (Gain)
2N3904 NPN TO-92 200 mA 40 V 100 - 300
2N2222A NPN TO-18 / TO-92 800 mA 40 V 100 - 300
BC547 NPN TO-92 100 mA 45 V 110 - 800
TIP120 NPN Darlington TO-220 5 A 60 V 1000+
2N3906 PNP TO-92 200 mA 40 V 100 - 300

Transistor Operation Regions: Cut-off, Active, and Saturation

Understanding how to use a transistor requires knowing its three operating regions. A BJT is not a simple mechanical relay; it is a current-controlled device. The voltage across the Base-Emitter junction (Vbe) and the Collector-Emitter junction (Vce) determines the region. The following table assumes a standard silicon NPN transistor at 25°C ambient.

BJT Operation Regions and Typical Voltages
Region Base-Emitter Voltage (Vbe) Collector-Emitter Voltage (Vce) Collector Current (Ic) Primary Application
Cut-off < 0.5V Equal to Supply Voltage 0 mA (Leakage only) Switch OFF (Open circuit)
Active (Linear) ~0.6V to 0.7V > 0.3V (Typically 1V - 5V) Ic = hFE × Ib Amplifiers, analog signal processing
Saturation ~0.7V to 0.8V < 0.2V (Vce_sat) Limited by external load Switch ON (Closed circuit)

According to All About Circuits' BJT theory guide, the most common mistake hobbyists make is leaving a switching transistor in the active region. If Vce is 2.5V while switching a 1A load, the transistor is dissipating 2.5W of heat (P = Vce × Ic) and will quickly overheat without a massive heatsink. For switching, you must drive the base hard enough to force the transistor into saturation, dropping Vce to ~0.2V and reducing power dissipation to a safe 0.2W.

How to Bias a Transistor: A Complete LED Driver Circuit

Let's build a practical circuit: using a 5V Arduino GPIO pin to switch a 12V, 50mA relay coil using a 2N3904 NPN transistor. This demonstrates exactly how to bias the base and protect the circuit.

Component Selection and Biasing Math

  • Load: 12V Relay coil drawing 50mA (Ic = 50mA).
  • Transistor: 2N3904 (Max Ic is 200mA, so 50mA is well within safe limits).
  • Control Signal: 5V DC from microcontroller GPIO.

To ensure the transistor saturates fully, we do not rely on the datasheet's typical hFE (which might be 200). Instead, we use a forced beta of 10. This guarantees saturation even if the transistor's gain is on the low end of the manufacturing tolerance.

  1. Calculate Required Base Current (Ib): Ib = Ic / Forced Beta = 50mA / 10 = 5mA.
  2. Calculate Base Resistor (Rb): The GPIO provides 5V, and the Base-Emitter junction drops ~0.7V. The voltage across the resistor is 5V - 0.7V = 4.3V.
    Rb = V_Rb / Ib = 4.3V / 5mA = 860Ω.
  3. Select Standard Resistor: Choose the next lower standard E12 value to ensure slightly more base current. We will use an 820Ω resistor (yielding ~5.2mA of base current, safely within the Arduino's 20mA recommended GPIO limit).

Wiring Steps

  1. Connect the Arduino GPIO pin to one leg of the 820Ω base resistor.
  2. Connect the other leg of the 820Ω resistor to the Base (middle pin) of the 2N3904.
  3. Connect the Emitter (left pin, flat side facing you) directly to the system Ground (shared between the 12V supply and the Arduino).
  4. Connect one terminal of the 12V relay coil to the 12V positive supply.
  5. Connect the other terminal of the relay coil to the Collector (right pin) of the 2N3904.
  6. Critical Safety Step: Place a 1N4007 flyback diode in reverse bias across the relay coil (cathode/stripe to 12V, anode to Collector). When the transistor switches off, the collapsing magnetic field in the relay coil generates a high-voltage spike that will instantly punch through the transistor's Collector-Base junction and destroy it. The diode safely recirculates this inductive kickback.
Design Note: As detailed in Electronics Tutorials' guide on transistor switches, always place the load on the collector side of an NPN transistor (low-side switching). Placing the load on the emitter (emitter-follower configuration) means the emitter voltage will always be ~0.7V lower than the base voltage, preventing the transistor from ever reaching full saturation and starving your load of voltage.

Testing and Troubleshooting: How Transistors Fail

Transistors rarely fail gracefully. They typically fail due to thermal runaway (exceeding the maximum junction temperature, causing a short), secondary breakdown (exceeding the Vceo voltage rating while drawing current), or overcurrent (melting the internal silicon bond wires, resulting in an open circuit).

You can test a BJT out-of-circuit using the Diode Test mode on a standard digital multimeter. A BJT is essentially two diodes sharing a common anode (NPN) or cathode (PNP).

Testing an NPN Transistor (e.g., 2N3904)

  1. Set your multimeter to Diode Test mode (the symbol with a diode and a sound wave).
  2. Place the Red probe on the Base and the Black probe on the Emitter. You should read a forward voltage drop between 0.550V and 0.750V.
  3. Keep the Red probe on the Base and move the Black probe to the Collector. You should read a similar forward voltage drop (0.550V - 0.750V).
  4. Reverse the probes: Black on Base, Red on Emitter, then Red on Collector. The meter should read OL (Over Limit) or infinite resistance.
  5. Test across Collector and Emitter in both directions. Both should read OL. If you read a short (0.000V or a beep) between Collector and Emitter, the transistor has suffered thermal failure and is dead.
Warning: Never trust an in-circuit transistor test. Parallel resistors, microcontroller GPIO pull-ups, and load coils will create alternate current paths, giving you false 'short' or 'low voltage' readings on your multimeter. Desolder at least the Base and Collector legs to lift them off the PCB pads before testing.

Frequently Asked Questions

How to use a transistor as a switch instead of an amplifier?

To use a BJT as a switch, you must drive it into hard saturation. This means supplying enough base current so that the Collector-Emitter voltage (Vce) drops to its minimum (typically 0.2V). Do not use the datasheet's linear hFE value for your base resistor calculations; instead, use a 'forced beta' of 10 or 20. If your load requires 100mA, design your base resistor to supply at least 5mA to 10mA of base current, ensuring the transistor acts like a closed mechanical relay rather than a variable resistor.

How to use a transistor to control a high-power motor?

For high-power DC motors (drawing more than 1A), standard small-signal transistors like the 2N3904 will overheat and fail. You should upgrade to a Darlington transistor like the TIP120 (rated for 5A) or, ideally, switch to a logic-level N-channel MOSFET like the IRLZ44N. MOSFETs are voltage-controlled rather than current-controlled, meaning they draw virtually zero continuous current from your microcontroller's GPIO pin and have much lower 'on' resistance (Rds_on), resulting in far less heat generation at high currents. Always use a heavy-duty flyback diode (like a Schottky 1N5822) across the motor terminals to handle the massive inductive kickback.

What is the difference between NPN and PNP transistors in a circuit?

The primary difference is their placement in the circuit and the polarity of the control signal. NPN transistors are used for low-side switching; they are placed between the load and ground, and you turn them ON by applying a positive voltage to the base. PNP transistors are used for high-side switching; they are placed between the positive supply and the load, and you turn them ON by pulling the base voltage down toward ground (usually via a secondary NPN transistor or an open-drain microcontroller pin). If your load must remain grounded at all times for safety or sensor-referencing reasons, you must use a PNP transistor or a P-channel MOSFET.

How to use a transistor with an Arduino without burning the pin?

Arduino GPIO pins (like those on the Uno or Nano using the ATmega328P) have an absolute maximum current rating of 40mA per pin, with a recommended continuous limit of 20mA. If you connect an Arduino pin directly to a transistor's base without a resistor, the base-emitter junction acts like a forward-biased diode, effectively shorting the 5V pin to ground through the silicon. This will instantly draw excessive current and permanently destroy the microcontroller's GPIO pin. Always calculate and install a base resistor (typically between 470Ω and 4.7kΩ) to limit the base current to a safe 1mA - 10mA range.