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 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.