Electronics
How much current can an Arduino pin supply?
An Arduino Uno's output pin can supply about 20 mA safely. Its chip, the ATmega328P, is rated for an absolute maximum of 40 mA per pin, and running near that damages it. That's plenty for an LED and nowhere near enough for a motor, a relay coil or a string of lamps.
A pin is a tiny battery
Inside, an output pin is a switch between 5 V and 0 V, sitting behind about 25 Ω of its own resistance. HIGH connects your circuit to 5 V through that 25 Ω, so the current is set by Ohm's law around the loop:
A green LED (2.2 V) through 150 Ω:
That's under 20 mA, so the pin is safe. A red LED through 220 Ω draws about 12.5 mA.
Live experiment
How many LEDs can one pin take?
Pin 9 is HIGH, and you hang red LEDs on it, each behind its own 220 Ω, Pip first. Every LED's current comes through the one pin, so the total climbs: past the safe 20 mA at two, past 40 mA at five. Then let a MOSFET carry the LEDs.
“Digital output” is lesson 2 of 6 in The Core, Electronics World 8. Free with an account. Lessons unlock in order, so you’ll do the 50 before it first.
Every load on the pin adds up
Hang a second LED-and-resistor on the same pin and its current comes through the pin too: two red LEDs at 220 Ω each already pass 20 mA. The pin's 25 Ω also drops more voltage as the current rises, so HIGH sags below 5 V. At 40 mA it's lost a whole volt.
There's a chip-wide limit as well. The ATmega328P allows about 200 mA through all its pins together, so ten LEDs at 20 mA is the most it can drive at once, and the datasheet sets smaller limits for groups of pins.
Bigger loads: let a transistor carry it
For anything over 20 mA, the pin shouldn't supply the current at all. It should switch something that does:
- A logic-level MOSFET: the pin holds its gate at 5 V and supplies almost nothing; the load's current flows from the supply through the MOSFET
- An NPN transistor: the pin feeds its base a few milliamps through a resistor, about 1 kΩ, and the collector carries hundreds
- A relay module or a motor driver for mains loads and motors that run both ways
The code doesn't change: digitalWrite(9, HIGH) still turns the load on.
Sourcing and sinking
A pin can also sink current: wire the LED from 5 V, through its resistor, into the pin, and it lights when the pin goes LOW. The same 20 mA limit applies either way.
Free lesson
Now build it yourself
Each lesson comes in three short parts: see the idea, try it on a live board, then build it yourself, with quick checks as you go.
“Digital output” is lesson 2 of 6 in The Core, Electronics World 8. Free with an account. Lessons unlock in order, so you’ll do the 50 before it first.
Or start from the very first lesson, no account neededWork it out
Practice questions
Three quick questions from the lessons. Pick an answer to check it.
Show the answer
Answer: 20 mA. About 20 mA, plenty for an LED. Around 40 mA, a real pin is damaged.
- Why not “2 A”? 2 A is a hundred times too much. Around 40 mA already damages a pin.
- Why not “2 mA”? 2 mA is far below the limit. A pin can give about ten times that, enough for a bright LED.
Show the answer
Answer: a transistor switch. The pin only switches the transistor (World 5), and the transistor carries the motor's 200 mA from the supply. A bigger resistor would just starve the motor.
- Why not “two pins side by side”? Two pins give about 40 mA together at most, still far short of 200 mA.
- Why not “a bigger resistor”? A bigger resistor cuts the current for the pin and the motor alike, so the motor gets too little to run.
Show the answer
Answer: 40 mA: twice its safe limit. 5 V across the pin's own 25 Ω and the lamp's 100 Ω is 5 ÷ 125 = 40 mA, twice the 20 mA a pin should give and right at the 40 that damages it. Through a transistor, the pin gives only the base's 4 mA.
- Why not “500 mA”? 500 mA is more like a motor's current. The 100 Ω lamp plus the pin's 25 Ω allow only about 40 mA.
- Why not “20 mA, just right”? 20 mA is the safe limit, not what this lamp draws. With only 125 Ω in the loop, it takes 40 mA.
- Why not “4 mA”? 4 mA is what a transistor's base takes through 1 kΩ. Straight from the pin, the lamp gets 5 V ÷ 125 Ω = 40 mA.
“Digital output” is lesson 2 of 6 in The Core, Electronics World 8. Free with an account. Lessons unlock in order, so you’ll do the 50 before it first.
Questions people ask
What is the absolute maximum current for an Arduino Uno pin?
40 mA per pin, according to the ATmega328P's datasheet, and that's a damage limit, not a working one. Design for 20 mA or less. The whole chip is limited to about 200 mA across all its pins together.
Can I power a servo or a motor from an Arduino pin?
Not from a pin. A small motor wants hundreds of milliamps. Power it from a supply, through a transistor or MOSFET that the pin switches. A hobby servo is different: its signal wire takes almost no current, but its power wire still needs a proper 5 V supply.
Does an LED on an Arduino pin need a resistor?
Yes. Without one, only the pin's own resistance of about 25 Ω limits the current, and a red LED would try to draw around 100 mA, which can damage both the LED and the pin. 220 Ω gives about 12 mA.
Related topics
- What resistor does an LED need on an Arduino?220 Ω or 330 Ω? Work out the LED's current from a 5 V pin, colour by colour.
- How to switch a big load from an Arduino with a transistorThe pin turns the tap, the supply does the work: an NPN switch, its base resistor and the numbers.
- MOSFET as a switch, explainedA gate voltage, not a current, opens the channel: threshold, R_DS(on) and the flyback diode.
- Ohm's law explainedV = I × R: set any two of voltage, current and resistance and the third follows.