Arduino Mega 2560 Current Sourcing

Hi there,

I’m working on a project that involves powering some LEDs and relays. I’m trying to find out how much current the Arduino Mega can source to ensure that I don’t go over the current rating. On the Arduino Mega page, it says that there is a 40mA rating per digital I/O per pin. Is it true that each pin can actually source 40mA, or is it just the maximum a single pin can source. I believe it is the latter.

Is there any documentation out there that explains the current limitations in more detail?

The best documentation is the rule of thumb: max 20mA for an output pin. The 40mA for a single output pin is possible (in theory), but the output voltage will be a lot lower than 5V. At 20mA the output is already lowered to 4.5V (according to the datasheet).

For the total maximum, see the datasheet, section 31, page 367 : DC Current VCC and GND Pins ..... 200.0mA That is 9 output pins, each with a led of 20mA. The extra 20mA is used by the chip itself.

Mega can have 800mA total, 200mA per Vcc pin. VOH can be as low as 4.2V with Vcc = 5V and 20mA of source current out. VOL can be as high as 0.9V with VCC = 5V and 20mA of sink current in.

Current must be spread across the ports per the notes in the Electrical Characteristics:

  1. Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:

ATmega640/1280/2560: 1.)The sum of all IOL, for ports J0-J7, A0-A7, G2 should not exceed 200 mA. 2.)The sum of all IOL, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200 mA. 3.)The sum of all IOL, for ports G3-G4, B0-B7, H0-B7 should not exceed 200 mA. 4.)The sum of all IOL, for ports E0-E7, G5 should not exceed 100 mA. 5.)The sum of all IOL, for ports F0-F7, K0-K7 should not exceed 100 mA. If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test condition. 4. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:

ATmega640/1280/2560: 1)The sum of all IOH, for ports J0-J7, G2, A0-A7 should not exceed 200 mA. 2)The sum of all IOH, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200 mA. 3)The sum of all IOH, for ports G3-G4, B0-B7, H0-H7 should not exceed 200 mA. 4)The sum of all IOH, for ports E0-E7, G5 should not exceed 100 mA. 5)The sum of all IOH, for ports F0-F7, K0-K7 should not exceed 100 mA. If IOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition.

CrossRoads, thanks for the correction.
200mA per VCC/GND pin is 800mA total. At 5V that is 4 Watt ! That chip can not get rid of 4 Watt heat without heatsink.
For leds, those 595 shift registers that can drive leds is better, or even the old darlington driver like the ULN2803.

That's what the data sheet shows. The reverse polarity diode is rated for 1A. The 5V regulator is rated for 800mA (at lower Vin, like 7.5V. Doubtful that 9V, 12V would source that without overheating).