NPN & PNP Interactive Overview

NPN & PNP Interactive Overview

Dustin van Hooydonk

Transistors are the building blocks of modern electronics. Whether you're building an LED dimmer or your first Arduino project — you can't avoid the transistor. This article explains the two most common types: the NPN and PNP transistor, what the difference is, and when to use which.


What is a transistor?

A transistor is a semiconductor component with three pins. It can act as a switch (on/off) or as an amplifier (small signal → large signal). The three pins are:

  • Base (B) — the control input. A small current here determines whether the transistor conducts.
  • Collector (C) — where the main current enters (in NPN).
  • Emitter (E) — where the main current exits, usually connected to GND (in NPN).

💡 Remember: A transistor doesn't conduct automatically. You need a threshold voltage on the Base — typically ~0.6–0.7 V for bipolar transistors — to switch it on.


NPN vs PNP — Interactive Overview

NPN — Negative-Positive-Negative

An NPN transistor has two N-type layers with a thin P-type layer in between. Current flows from Collector → Emitter when a positive voltage is applied to the Base.

Switch rule: Base = HIGH → transistor ON → current flows from Collector to Emitter.

Typical use: LED control from Arduino, motor driver (low-side), relay driver.

Common types: BC547, BC337, 2N2222

// Arduino: NPN as low-side switch
// Base resistor: (5V - 0.7V) / 1mA ≈ 4.3kΩ → use 4.7kΩ
void loop() {
  digitalWrite(9, HIGH); // NPN ON — current flows to GND
  delay(1000);
  digitalWrite(9, LOW);  // NPN OFF
  delay(1000);
}
PNP — Positive-Negative-Positive

A PNP transistor has two P-type layers with an N-type layer in between. Current flows from Emitter → Collector when the Base is pulled lower than the Emitter (i.e. toward GND).

Switch rule: Base = LOW → transistor ON → current flows from Emitter to Collector.

Typical use: High-side switch, H-bridge motor control, complementary amplifier stages.

Common types: BC557, BC327, 2N2907

// Arduino: PNP as high-side switch
void loop() {
  digitalWrite(9, LOW);  // PNP ON — base pulled to GND
  delay(1000);
  digitalWrite(9, HIGH); // PNP OFF
  delay(1000);
}

NPN vs PNP — Comparison

Property NPN PNP
Layer structure N – P – N P – N – P
Switch ON signal HIGH on Base LOW on Base
Current direction Collector → Emitter Emitter → Collector
Switch type Low-side High-side
Common Arduino use LED, relay, small motors H-bridge, high-side load
Common types BC547, 2N2222, BC337 BC557, 2N2907, BC327

Practical Scenarios

Dimming an LED with PWM

The most classic application. Connect the collector of an NPN (e.g. BC547) to the cathode of your LED (via resistor to Vcc). The Arduino drives the base via a 1 kΩ resistor. Use analogWrite() for PWM dimming.

Wiring: Arduino pin 9 → 1kΩ → Base · Collector → LED → 220Ω → 5V · Emitter → GND

Controlling a DC motor

For one-direction control, a single NPN transistor works fine. For reversible direction, use an H-bridge: 2× NPN + 2× PNP in a bridge configuration. Always add a flyback diode (e.g. 1N4007) in parallel with the motor coil.

Switching a relay

A relay coil draws more current than an Arduino pin can supply. Use an NPN transistor (BC337 or TIP120 for higher loads) as a driver. Always add a flyback diode across the relay coil — without it, the voltage spike when switching off will destroy the transistor.

Audio / signal amplifier

For linear amplification, the transistor is biased in its active region (not fully on or off). A push-pull amplifier pairs one NPN and one PNP: the NPN amplifies the positive half-cycle, the PNP handles the negative half.


Conclusion

NPN and PNP transistors are complementary partners. In most Arduino projects you'll reach for an NPN for low-side switching. But as soon as you need high-side control or build an H-bridge, the PNP becomes essential.

Ready to build? Check out our Arduino starter kits and individual transistors & components in the shop.

Back to blog

Leave a comment