How many LEDs can one Arduino pin drive?
- 192parts on the bench
- 25boards running now
- 1.00xreal time, on every board
The short answer for an Arduino Uno is one or two ordinary LEDs per pin, each with its own resistor. The longer answer depends on three limits, not one: what a single pin can supply, what a group of pins can supply together, and what the whole chip can carry. This page goes through each with numbers measured on a simulated Uno, so you can see where a design stops being safe before you build it.
The circuit above is the level meter: a potentiometer on A0 and a ten-segment LED bar, one pin and one 220 ohm resistor per bar. Turn the knob all the way and ten pins are driving ten LEDs at once, which is where the chip-wide limits start to matter.
The numbers in the datasheet
The ATmega328P datasheet gives 40 milliamps per I/O pin as an absolute maximum. That is the point past which damage can happen, not a working figure. Its electrical tables are written at 20 milliamps per pin, and they only promise a HIGH output of at least 4.1 volts at that current. So 20 milliamps is the working limit most people use, and 10 to 15 is comfortable.
Two more limits catch people out. The VCC and GND pins of the whole chip are rated for 200 milliamps in total. And the pins are grouped: pins sourcing current, driving HIGH into a load, should not add up to more than 150 milliamps in each of two groups, which on an Uno are A0 to A5 with D0 to D4, and D5 to D13. Pins sinking current, pulling a load LOW, have three groups of 100 milliamps: A0 to A5, D0 to D4, and D5 to D13.
One pin, one LED
A pin is not a perfect 5 volt source. It has some resistance of its own, so its voltage drops as the load grows. Mokxi models an Uno pin as 5 volts behind about 30 ohms, which lands inside the datasheet’s guarantee. With one red LED and 220 ohms on pin 13, we measured 12.7 milliamps and the pin sat at 4.48 volts. That is a bright LED with plenty of margin.
The resistor sets the current. On the same pin, 150 ohms gave 17.3 milliamps, 330 ohms 9.0 and 1 k 3.3. An LED is clearly lit at 3 or 4 milliamps, so for indicators a larger resistor is often the better choice anyway.
Several LEDs on one pin
Now add LEDs, each with its own 220 ohm resistor, all on pin 13. Here is what the simulator measured. Two LEDs drew 22.9 milliamps in total, already past the 20 milliamp working figure. Three drew 31.3 and pulled the pin down to 3.94 volts. Four drew 38.2, just under the absolute maximum. Five drew 44.2, past it. Eight drew 57.6 and the pin sagged to 3.18 volts, with each LED getting 7.2 milliamps instead of 12.7, so every LED you add also dims the others.
The button below opens the four-LED version, blinking with the stock blink program. Add a fifth LED and resistor and watch the others dim. Mokxi does not burn out pins, so it will happily run eight; a real Uno pin would be well outside its rating.
Sharing one resistor between several LEDs does not get round the limit. We ran two, three and four LEDs in parallel after a single 220 ohm resistor: the total stayed at about 13 milliamps and was split between them, so each got dimmer. Worse, the simulated LEDs are identical, so they split it evenly; real LEDs are not, and the one with the lowest forward voltage takes most of the current. Give every LED its own resistor.
No resistor at all
An LED wired straight from a pin to ground has nothing to limit its current but the pin itself. In the simulator the pin collapsed to 2.57 volts and the LED drew about 81 milliamps, twice the absolute maximum. On a real board that is how LEDs and pins get damaged, sometimes at once and sometimes slowly. Mokxi reports the current and carries on, which makes it a safe place to see the mistake and a bad reason to try it on the bench.
Many pins at once
The level meter is the other half of the question. With the knob at the top, all ten bars are lit from pins 2 to 11. Each green bar on its 220 ohm resistor drew 8.7 milliamps, so the whole display takes 87 milliamps. Pins 2 to 4 are in one source group and supply 26 of that; pins 5 to 11 are in the other and supply 61. Both are well inside their 150 milliamp limits and the total is well inside 200, so this design is fine on a real Uno.
We swapped all ten resistors for 100 ohms and ran it again. Each bar then drew 15.9 milliamps, 159 in total, with 111 of it from pins 5 to 11. Every pin is still inside 20 and the chip inside 200, but the margin is mostly gone, and adding a buzzer or a second display on the same board would push it over. Budget the groups and the total, not just the pins.
Sinking works the same way. With an LED and resistor from 5 V to pin 13 and the pin driven LOW, one LED drew 13.3 milliamps and the pin sat at 0.39 volts; with four, the LOW rose to 1.16 volts.
When a pin is not enough
For more than a couple of LEDs, or anything bigger, the pin should switch something else that carries the current. With a 2N2222 transistor, a 1 k resistor from pin 13 to its base, and eight LEDs with their own 220 ohm resistors from 5 V to its collector, we measured 4.0 milliamps out of the pin and 117 milliamps through the LEDs, 14.6 each. With a 2N7000 MOSFET, gate straight to the pin, the same eight LEDs drew 111 milliamps and the pin supplied nothing once the gate had charged.
That current now comes from the 5 V supply rather than the chip, so the next limit is the supply. Over USB an Uno sits behind a resettable fuse of roughly 500 milliamps, shared with the board itself. Past a few hundred milliamps, use a separate supply with its ground joined to the Arduino’s.
For many LEDs rather than many milliamps, a 74HC595 shift register adds eight outputs on three pins, and a MAX7219 drives 64 LEDs with its own current limit. For LED strips, the WS2812 kind take their power from the supply and only a data signal from the pin.
Questions
How much current can an Arduino Uno pin supply?
Plan on 20 mA per pin at most, and 10 to 15 mA for comfort. The ATmega328P’s absolute maximum is 40 mA per pin and 200 mA for the whole chip.
Can I connect two LEDs to one Arduino pin?
Yes, each with its own resistor. Two red LEDs on 220 ohms measured 22.9 mA together; with 330 ohms each they stay comfortably under 20 mA.
Can I use one resistor for several LEDs?
It is not a good idea. The resistor sets the total current, the LEDs split it, and real LEDs split it unevenly, so one ends up brighter and working harder than the rest.
How do I drive more LEDs than a pin can handle?
Switch them with a transistor or a logic-level MOSFET, powered from the 5 V supply, or use a shift register or an LED driver chip for large numbers of LEDs.
Keep going
Where the facts on this page come from
Build this for real
Open the editor, change a value and watch the number move with it. Nothing to install, and no account needed.