Bipolar transistors for MCU boards

The small NPN and PNP transistors, digital transistors and Darlington arrays that drive LEDs, relays, buzzers and level shifts from a GPIO, and when a MOSFET is the better choice.

11 parts, 5 recommended. Updated .

What to look for

  • Collector current with margin, then the gain at that current. Datasheet gain falls away at the top of the range
  • Saturation voltage at your current, which sets the heat and what the load actually gets
  • Collector-emitter voltage with margin over the rail you are switching (VCEO)
  • Base drive. A bipolar transistor turns on at about 0.7 V, so it works from 1.8 V, 3.3 V or 5 V logic, but it needs base current and a resistor
  • Digital (pre-biased) transistors with the base resistors built in when you have many simple switches
  • A Darlington array (ULN2003A) for several relays or a stepper, accepting a voltage drop of about 1 V
  • A MOSFET instead for more than a few hundred milliamps, battery circuits, or anywhere the base current or the voltage drop matters

Alternatives

MMUN2211L

onsemi (also called DTC114E; PNP twin MMUN2111L, DTA114E)

SOT-23 (NPN, 10 kΩ + 10 kΩ built in)

A transistor and its two resistors in one part. Neat for many LEDs or small switches, open-drain style level shifting, and keeping inputs defined at reset. The DTC114E name is made by several makers.

  • Digital NPN with 10 kΩ base and 10 kΩ base-emitter resistors
  • 50 V
  • 100 mA
  • gain 35 min at 5 mA
  • 0.25 V max saturation at 10 mA
Price not yet checked
Datasheet onsemi DTC114E/D Rev. 11, Oct 2026 (PNP DTA114E/D Rev. 11)

MMBT2222A

onsemi (also many others)

SOT-23 (NPN)

The surface-mount 2N2222, for loads between the MMBT3904 and the BC817 class. Either the BC817-40 or this does most relay-driving jobs.

  • NPN
  • 40 V
  • 600 mA
  • gain 100–300 at 150 mA
  • 0.3 V max saturation at 150 mA and 1.0 V at 500 mA
  • 300 MHz min
Price not yet checked
Datasheet onsemi MMBT2222LT1/D Rev. 13, Sep 2026

BCP56

onsemi (also Diodes, Nexperia; PNP twin BCP53)

SOT-223 (NPN)

When a SOT-23 cannot shed the heat. Higher voltage and current for 24 V solenoids, bigger relays and linear jobs, in a package that solders easily by hand.

  • NPN
  • 80 V
  • 1 A
  • gain 40–250 at 150 mA (-16 is 100–250)
  • 0.5 V max saturation at 500 mA
  • 1.5 W on a good copper pad
Price not yet checked
Datasheet onsemi BCP56T1/D Rev. 16, Aug 2024

ULN2803C

Texas Instruments (others still make the ULN2803A)

SOIC-20

Eight channels instead of seven, so a whole 8-bit port or shift register drives eight relays. TI has replaced its ULN2803A with this part.

  • 8 Darlington channels
  • 50 V
  • 500 mA per channel
  • built-in clamp diodes
  • 2.7 kΩ input resistors
Price not yet checked
Datasheet TI SLRS076B, rev. Sep 2024

2N3904

onsemi (also many others; 2N3906 is the PNP)

TO-92 (through-hole)

The breadboard and through-hole version, with the same figures as the MMBT3904. Check the pinout of the part you buy against the datasheet.

  • NPN
  • 40 V
  • 200 mA
  • gain 100–300 at 10 mA
  • 0.2 V max saturation at 10 mA
  • 300 MHz min
  • 625 mW
Price not yet checked
Datasheet onsemi 2N3904/D Rev. 3, Oct 2024

Avoid for new designs

TIP120

onsemi (also others)

TO-220 (NPN Darlington)

The motor and LED-strip driver in countless tutorials. With 2 V or more across it, it wastes power and gets hot, and the load loses that voltage. For an MCU board a logic-level MOSFET such as the AO3400A does the job with a fraction of the loss.

  • NPN Darlington
  • 60 V
  • 5 A
  • gain 1000 min
  • 2.0 V max saturation at 3 A and 4.0 V at 5 A
Price not yet checked
Datasheet onsemi TIP120/D Rev. 10, Jun 2024

Which one to start with

  • Up to about 50 mA (LEDs, buzzers, signal switching): MMBT3904, or the MMBT3906 for a PNP.
  • 50–300 mA (relays, LED strings, solenoids): BC817-40, or the BC807-40 for a PNP.
  • Several relays or a unipolar stepper: ULN2003A (seven channels), or the eight-channel ULN2803C.
  • Lots of simple switches with no spare board space: MMUN2211L / DTC114E digital transistors.
  • More heat or a 24 V load: BCP56 in SOT-223.
  • More than about half an amp, or a battery-powered circuit: a logic-level MOSFET. See MOSFETs for MCU boards.

Typical circuits

A low-side switch from a GPIO

An NPN with its emitter to ground and the load between the supply and the collector. Size the base resistor for a forced gain of 10–20, far below the datasheet gain, so the transistor is fully saturated at the worst-case gain:

  • Base current = load current ÷ 10 to 20.
  • Base resistor = (GPIO high voltage − 0.8 V) ÷ base current.

Example: a 100 mA relay coil from a 3.3 V GPIO with a BC817-40. A forced gain of 20 gives 5 mA of base current, so (3.3 − 0.8) ÷ 0.005 = 500 Ω; use 470 Ω. Check the GPIO can source 5 mA. Add a 10–47 kΩ resistor from base to emitter so the transistor stays off while the MCU is in reset, and a diode across any relay or solenoid coil (see General-purpose diodes).

A high-side switch

A PNP with its emitter to the supply, collector to the load. If that supply is the MCU’s own rail, a GPIO can drive the base through a resistor. If it is higher (5 V, 12 V), the GPIO cannot pull the base up far enough to turn it off, so add a small NPN (or a digital transistor) to pull the PNP’s base down, with a resistor from base to emitter to turn it off.

Relays and steppers with a ULN2003A

Inputs straight from the MCU, each output to one end of a coil, the other end of every coil to the supply, and the COM pin to that same supply so the built-in diodes catch the flyback. Expect about 1 V across each output when on, and add up the heat when several channels are on together.

BJT or MOSFET?

  • A bipolar transistor turns on from any logic level, is cheap, is robust against static, and suits small loads, analog jobs and 1.8 V logic driving a 5 V load. It costs base current and a few tenths of a volt of drop.
  • A MOSFET has no gate current and very little drop when fully on, so it wins above a few hundred milliamps and on battery power, provided the gate is driven above its specified on-resistance voltage.

Pitfalls

  • Datasheet gain is not design gain. Gain varies by a factor of 3 between parts and falls at high current. Design for saturation with a forced gain of 10–20, not the typical figure.
  • No base resistor. A base tied straight to a GPIO draws as much current as the pin can give and can damage both. Always use a resistor.
  • PNP high-side switches on a higher rail. As above, a GPIO at 3.3 V cannot turn off a PNP whose emitter is at 5 V or 12 V. Use an NPN to drive it.
  • Through-hole pinouts differ. The 2N3904 is E-B-C, while the BC547 family is C-B-E. Swapping one for the other on a footprint reverses the transistor. Surface-mount SOT-23 parts are consistent (1 base, 2 emitter, 3 collector), but check the datasheet anyway.
  • Darlington drop. Darlington drivers (ULN2003A, TIP120) lose 1–2 V or more. Fine for a 12 V relay; not for a 3.3 V load or anything where the heat matters.
  • Tiny markings. A SOT-23 transistor is identified only by a code such as 1AM (MMBT3904) or 6C (BC817-40). Keep a note of the codes on your BOM to check assembled boards.

About this guide

A short list of parts worth starting with for this job, chosen on engineering merit, with the reasons, typical circuit notes and the usual pitfalls. Prices are shown at a small quantity and at volume, with the source and the date they were checked.

Disclaimer

  • Guidance only. Specifications are summarised in my own words from the manufacturer's datasheet revision shown; always design from the current datasheet. Parts marked "not yet checked" have not been verified against it.
  • Prices are a guide, not a quote, and change often. Check with your supplier before you order.
  • Part and manufacturer names are used only to identify parts. This guide is independent and not affiliated with, endorsed by or sponsored by any manufacturer or supplier.
  • Provided as is, without warranty. You are responsible for the designs you build.