Bipolar Junction Transistors - BJT - NPN

NPN bipolar junction transistors (BJTs) are the most widely used transistor type in hobby LED circuits, Arduino projects, and general-purpose…

Read full description & FAQ ↓

3 Items

NPN bipolar junction transistors (BJTs) are the most widely used transistor type in hobby LED circuits, Arduino projects, and general-purpose electronic switching. An NPN transistor sits between your LED load and ground (low-side switching) and acts as an electronically controlled switch: when a small current flows into the base terminal from a microcontroller GPIO pin, the transistor turns on and allows a much larger current to flow from the collector to the emitter, powering the LED array. When the base current stops, the transistor turns off and the LEDs go dark. This simple, reliable switching behavior makes NPN transistors the standard recommendation in every Arduino LED tutorial, every beginner electronics book, and virtually every LED project guide you will find online.

Why you need a transistor for LED arrays: An Arduino Uno GPIO pin can source or sink a maximum of about 40mA (with a recommended operating limit of 20mA per pin and a total of 200mA across all pins). That is enough to drive one standard 20mA LED with a current-limiting resistor, but what if you want to control an array of ten LEDs (200mA total), a high-power LED at 350mA, or a 12V LED strip drawing an amp or more? Connecting that load directly to the GPIO pin would overdraw the pin, potentially damaging the microcontroller or causing erratic behavior as the supply voltage sags. The NPN transistor solves this: the GPIO pin only needs to supply a few milliamps of base current (through a base resistor), and the transistor switches the full load current from the main power supply, completely isolating the microcontroller from the heavy load.

The basic NPN LED switching circuit: Connect the LED array (with individual current-limiting resistors on each LED) from the positive supply rail to the transistor's collector pin. Connect the transistor's emitter pin to ground. Connect the Arduino GPIO pin to the transistor's base through a 1KΩ base resistor. When the GPIO pin goes HIGH (5V or 3.3V), about 4mA of base current flows into the base, turning the transistor on. The transistor passes the full collector current (up to 200mA for a 2N3904 or 2N2222, up to 600mA–800mA for medium-power types like the 2N2219) from the LED array to ground. When the GPIO pin goes LOW, zero base current flows, the transistor turns off completely, and the LEDs are dark. This circuit requires three components beyond the LEDs themselves: the NPN transistor, the base resistor, and the LED current-limiting resistors.

PWM dimming with NPN transistors: Instead of just switching LEDs on and off, you can smoothly dim them using pulse-width modulation. Connect the NPN circuit exactly as described above, but drive the base from an Arduino PWM-capable pin. The Arduino's analogWrite(pin, value) function generates a square wave at approximately 490Hz or 980Hz (depending on the pin), rapidly switching the transistor on and off. The duty cycle (percentage of time the transistor is on) determines the perceived LED brightness: 0% duty = fully off, 50% duty = half brightness, 100% duty = full brightness. The switching happens far too fast for the human eye to detect, so the LEDs appear to dim smoothly. PWM dimming through a transistor preserves the LED's color temperature across the entire dimming range — unlike analog dimming (reducing current), which shifts the LED color as the drive current decreases. This is critical for projects where color consistency matters at different brightness levels, such as automotive instrument cluster backlighting and film set practical lighting.

Darlington pairs for higher current: A single general-purpose NPN transistor handles up to about 200mA of collector current, which covers most small LED arrays. But what if you need to switch 500mA, 1A, or more? A darlington pair connects two NPN transistors in cascade: the emitter of the first transistor feeds the base of the second. The combined current gain is the product of the two individual gains — typically 10,000 or more — meaning a tiny base current (microamps) can switch a very large load current. You can build a discrete darlington pair from two individual NPN transistors, or use a dedicated darlington array IC like the ULN2003 (7 channels) or ULN2803 (8 channels). These ICs integrate the darlington transistors, base resistors, and flyback diodes in a single DIP package, making them extremely convenient for switching multiple LED groups, relays, or motors from microcontroller outputs. A single ULN2003 can control seven independent LED channels, each capable of sinking up to 500mA.

Common NPN transistor part numbers: The 2N3904 is the most popular general-purpose NPN transistor in hobby electronics — rated for 200mA collector current and 40V, with a typical current gain of 100–300. It handles the vast majority of LED switching tasks. The 2N2222 is the other classic general-purpose NPN, with similar ratings and slightly different packaging options (the 2N2222A comes in both TO-92 plastic and TO-18 metal can packages). For European-sourced designs, the BC547 and BC548 are equivalent general-purpose NPNs. For higher-current applications, the 2N2219 and TIP31 (NPN power transistor in TO-220 package) handle up to 800mA and 3A respectively. The complementary PNP pair for the 2N3904 is the 2N3906.

Applications: NPN transistors appear in Arduino and ESP32 LED projects (switching LED arrays, RGB LED mixing, PWM dimming), model railroad layouts (DCC decoder-driven building lights, crossing signal control, block detection indicator circuits, semaphore signal animation), automotive LED conversions (switching 12V LED arrays from dashboard dimmer circuits), guitar pedal builds (LED status indicator switching, audio signal amplification and clipping stages), escape room and Halloween props (sensor-triggered LED effects controlled by microcontrollers), holiday lighting displays (sequencing and fading large LED arrays), and arcade cabinet projects (button illumination control, marquee LED sequencing). Pair NPN transistors with current-limiting resistors for the LEDs (use our LED Resistor Calculator), component LEDs for the emitters, and decoupling capacitors on any microcontrollers. If your power source is AC, convert to DC first with a bridge rectifier and smoothing capacitor.

Frequently Asked Questions

The 2N3904 is the most popular choice for Arduino LED switching. It handles up to 200mA collector current (enough for about 10 standard 20mA LEDs), operates at up to 40V, and is driven easily from a 5V or 3.3V GPIO pin through a 1KΩ base resistor. The 2N2222 is equally suitable with similar specifications. For loads above 200mA, use a darlington pair or a medium-power transistor like the 2N2219.
For most Arduino LED switching circuits, a 1KΩ base resistor works well. From a 5V GPIO pin with a 0.7V base-emitter drop, a 1KΩ resistor passes about 4.3mA of base current. With a typical current gain (hFE) of 200, that can switch up to 860mA of collector current — far more than the 200mA limit of a 2N3904. This overdrive ensures the transistor is fully saturated (minimum VCE drop). For 3.3V logic (ESP32), 1KΩ still works well, providing about 2.6mA of base current.
It depends on the transistor’s maximum collector current. A 2N3904 or 2N2222 handles up to 200mA, which can switch up to 10 standard 20mA LEDs wired in parallel (each with its own current-limiting resistor). For more than 10 LEDs, use a darlington array IC like the ULN2003 (500mA per channel) or a power transistor. Always wire parallel LEDs with individual resistors per LED — never share one resistor across parallel LEDs, as current distribution will be uneven.
Both are general-purpose NPN transistors with similar ratings and either one works for standard LED switching. The 2N3904 has a slightly lower maximum collector current (200mA vs. 800mA for the 2N2222A), lower power dissipation (625mW vs. 1.5W), and is optimized for small-signal and low-power switching. The 2N2222 handles higher current and power, making it better for medium-load switching. For a basic LED array drawing under 200mA, either transistor works identically. The 2N3904 is typically cheaper and more widely available in TO-92 packages.
Yes. The beauty of transistor switching is that the load voltage and the control voltage are independent. A 5V Arduino GPIO pin (through a 1KΩ base resistor) can switch a 12V LED array through an NPN transistor, as long as the Arduino and the 12V supply share a common ground. The LED array connects from the 12V positive rail through current-limiting resistors to the transistor’s collector, and the emitter goes to the shared ground. The transistor’s VCEO rating (40V for a 2N3904) must exceed the supply voltage.
The ULN2003 is a darlington transistor array IC containing seven independent NPN darlington pairs with built-in base resistors and flyback diodes, all in one 16-pin DIP package. Each channel can sink up to 500mA. Use it when you need to switch multiple LED groups (up to seven independent channels) from microcontroller outputs without wiring individual transistors and base resistors for each channel. It is also commonly used to drive stepper motors, relays, and solenoids. The ULN2803 is the 8-channel version in an 18-pin package.