Sub topic 13
How much current a pin and the board can supply
This chapter assumes you know Ohm's law, the difference between a pin sourcing and sinking current, and how the Uno gets power from USB, the barrel jack, or VIN. Here you will learn the current limits at three levels: a single I/O pin, the microcontroller as a whole, and the board's power supply. You will also learn how to size resistors and when to stop driving a load from a pin.
Three separate limits
An Uno R3 has three current limits that people often confuse:
- Per pin: how much one digital pin can source or sink.
- Per chip: how much all pins together can source or sink through the ATmega328P.
- Per supply: how much the 5V and 3.3V pins can deliver to external parts.
Exceeding any one of them can cause unstable behavior, resets, or permanent damage. The limits do not add up. A load that is fine for one limit can break another.
The per-pin limit
The ATmega328P datasheet gives an absolute maximum of 40 mA per I/O pin. This is the damage threshold, not a design target. The conventional working limit is 20 mA per pin. At that current the output voltage stays close to its nominal levels. Above it, a HIGH pin sags noticeably below 5V and a LOW pin rises above 0V.
Pins can both source and sink current:
- Sourcing: the pin is HIGH and current flows out of it, through the load, to GND.
- Sinking: the pin is LOW and current flows into it from the load, which is connected to 5V.
The same 20 mA guideline applies in both directions.
The per-chip limit
The microcontroller's supply and ground pins also have a ceiling. The datasheet lists 200 mA as the absolute maximum through its VCC and GND pins. All current from the I/O pins ultimately passes through these pins. It does not matter how many pins share the load.
This means you cannot drive 14 digital pins at 20 mA each. That would be 280 mA, which is over budget. A practical rule is to keep the combined I/O current well under 150 mA. The datasheet also restricts current within groups of pins that share an internal port, so avoid putting all of your heavy loads on neighboring pins.
The per-supply limit
The pins marked 5V and 3.3V are outputs from the board's power circuitry. They are not I/O pins, and their limits depend on how the board is powered.
| Source | Where the current comes from | Practical limit |
|---|---|---|
| 5V pin, powered by USB | The computer's USB port, through a resettable fuse | About 500 mA total, shared with the board itself |
| 5V pin, powered by barrel jack or VIN | The onboard 5V regulator | Roughly 400 to 800 mA, set by heat |
| 3.3V pin | A separate 3.3V regulator | 50 mA |
The board itself draws roughly 40 to 50 mA, including the microcontroller and power LED. Subtract that from the budget before you connect anything.
The USB limit is 500 mA for a standard port, and some ports provide less. The Uno includes a resettable fuse that opens at about 500 mA. If you draw too much, the board may reset or disconnect from the computer.
Why the regulator limit depends on input voltage
A linear regulator turns the excess input voltage into heat. The power it dissipates is:
P = (Vin - 5V) × IAt 12V input and 300 mA of load, the regulator dissipates (12 − 5) × 0.3 = 2.1 W. That is more than the small regulator package can shed, and it will overheat and shut down. At 7V input the same load dissipates only 0.6 W. If you need more current from the 5V pin, use a lower input voltage in the 7 to 9V range. The better fix is to power high-current parts from their own supply.
Sizing an LED resistor
An LED has a roughly fixed forward voltage, and a resistor sets the current. The formula is:
R = (Vsupply - Vforward) / IFor a red LED with a forward voltage of about 2.0V, a 5V pin, and a target of 10 mA:
R = (5 - 2.0) / 0.010 = 300 ohmsRound up to the nearest standard value you have, such as 330 Ω. The actual current is then (5 − 2.0) / 330 ≈ 9 mA. A 220 Ω resistor gives about 13.6 mA. That is still within the pin limit and is brighter. Without any resistor, the LED tries to draw far more than the pin can provide, and either the LED or the pin fails.
Adding up a power budget
Suppose you power the Uno from USB and connect four red LEDs, each at 10 mA, plus a sensor that draws 30 mA from the 5V pin.
- Board: about 50 mA
- LEDs: 4 × 10 = 40 mA, drawn from the I/O pins and so also from the 5V supply
- Sensor: 30 mA
The total is about 120 mA. This is well below the 500 mA USB limit and the 200 mA chip limit, and each pin stays at 10 mA. The design is safe.
Driving heavier loads with a transistor
A relay coil, a small motor, or a buzzer often needs more than 20 mA. The pin should not power it directly. Instead, the pin controls a transistor, and the transistor switches current from a stronger source. A logic-level N-channel MOSFET or an NPN transistor with a base resistor both work.
The sketch below drives a transistor input on pin 7 and a single LED on pin 8. The LED gets a resistor and the transistor drives the heavier load.
const int ledPin = 8; // LED with a 330 ohm resistor to GND
const int loadPin = 7; // drives a transistor base or MOSFET gate
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(loadPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH); // about 9 mA from the pin
digitalWrite(loadPin, HIGH); // only a few mA into the transistor
delay(1000);
digitalWrite(ledPin, LOW);
digitalWrite(loadPin, LOW);
delay(1000);
}For an NPN transistor, a 1 kΩ resistor between pin 7 and the base draws (5 − 0.7) / 1000 ≈ 4 mA from the pin. If the load is a motor or relay coil, add a flyback diode across it. The diode absorbs the voltage spike when the coil switches off, which would otherwise damage the transistor and the pin.
Common mistakes
- No resistor on an LED. The most common way to damage a pin.
- Powering a motor from the 5V pin. Surges cause resets and USB disconnects.
- Reading the 3.3V pin as a general supply. It provides only 50 mA.
- Shorting a pin to GND or 5V while it is set as an output. This pulls far beyond 40 mA.
- Forgetting the shared ground. An external supply needs a common GND with the Arduino, or the signal has no return path.
- Using a high input voltage. Feeding 12V to VIN and drawing current from 5V makes the regulator hot.
You can test for a supply problem with a simple symptom check. If the board resets when a load turns on, or if the Serial Monitor connection drops, suspect a supply that is overloaded rather than a code bug.
Exercise
You power an Uno from USB and want to light 8 red LEDs (forward voltage 2.0V) at the same time, each with its own resistor from a digital pin to GND. You choose 220 Ω resistors. Is the setup within limits? Show the per-pin current, the total, and your conclusion.
Show answer
Each LED draws (5 − 2.0) / 220 ≈ 13.6 mA, which is under the 20 mA per-pin guideline. The total is 8 × 13.6 ≈ 109 mA, which is under the 200 mA chip limit. Adding the board's own 50 mA gives about 159 mA, well within the 500 mA USB limit. The setup is within limits, though the chip total of 109 mA is above half the 200 mA ceiling. If you added more LEDs, raise the resistor value to lower the current per LED.
Exercise
A 12V adapter feeds the barrel jack, and you draw 250 mA from the 5V pin. How much power does the regulator dissipate, and what is one way to reduce it?
Show answer
The regulator dissipates (12 − 5) × 0.25 = 1.75 W, which is enough to overheat it. You can reduce it by lowering the input voltage to about 7 to 9V, or by powering the 250 mA load from a separate 5V supply so the board's regulator does not carry it.