← Wiki · Component

NPN transistor

A bipolar transistor that switches or amplifies with a small base current. MMBT3904 switches LEDs, buzzers and small relays from a GPIO.

What it does#

Current into the base (B) lets a much larger current flow from collector © to emitter (E). With the emitter on GND it is a low-side switch, like an N-MOSFET, but driven by current: it always needs a base resistor.

The base resistor#

To switch hard (“saturate”), give the base about a tenth of the collector current. Example: 20 mA load from a 3.3 V GPIO: I_B ≈ 2 mA, R_B = (3.3 V − 0.7 V) / 2 mA ≈ 1.3 kΩ → 1 kΩ.

Example circuit: GPIO → 1 kΩ → base. The LED and its 100 Ω resistor hang from 5 V into the collector, so a 3.3 V pin switches a 5 V load.
GPIO → 1 kΩ → base. The LED and its 100 Ω resistor hang from 5 V into the collector, so a 3.3 V pin switches a 5 V load. Open the npn_switch example from this page in PCB Canvas: “Insert into my schematic”.

MOSFET or BJT?#

For tens of mA either works; the BJT is cheap and forgiving. For amperes choose a MOSFET: no base current, less heat. The catalog’s SS8050 (1.5 A) has the same pinout as the MMBT3904 (200 mA).

Pitfalls#

  • No base resistor = the GPIO drives a diode to GND and both suffer.
  • Saturation voltage: a switched-on BJT still drops 0.1–0.3 V.
  • Pinout: SOT-23 is 1 = B, 2 = E, 3 = C for these parts. TO-92 parts differ by manufacturer.

Footprint#

SOT-23. MMBT3904 (C20526) and SS8050 (C2150) are JLCPCB basic parts.