# mega total current

Curious if the mega can have all digital pins on at once without problems, 40mA x 54 pins 2.16 amps. I realize it exceeds the USB limit but with a wall transformer? Not planning such an event but curious if there is a limit. Thx

You can have ALL the output pins active at once with no problem BUT just having a pin high doesn't automatically mean that it's driving that 40ma. That's up to your attached circuit.

If you're driving an opto issolator through a resistor, it's quite likely you'll only be pushing out about 5-10ma. Even the average LED only requires something around 20ma.

So it's quite feasible to have EVERY digital output high and still not exceed the 200ma limit for the whole chip. (at least I think that's quoted in the datasheet but haven't checked).

Mega has an 800mA current limit total, not 200mA. The 800mA has to be spread across the IO ports per Notes 3 and 4 under Table 30.1 of the datasheet:

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

and

``````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. Pinsare not guaranteed to source current
greater than the listed test condition.
``````

Thanks to both of you for the response. Datasheets are not my strong suit. I’m using several darlington arrays with stepper motors and with them all (four unipolar, so 16 i/o pins) going it appears to be drawing 500mA through the ground connection of the arduino. (it’s not running the motors they have separate power source. I keep reading you don’t have to put resistors on the connections to the processor but it seems like they should not need that much current just to do the switching. Thx again. Cap

You don't draw current through ground.

If you're using darlington arrays, the current being drawn from the I/0 pins will be minimal. Assuming your motors are getting their power from an alternate power source, you'll be fine.

Right don't draw current from ground, sorry for the error. I will recheck, and measure the current though it.

PS I thought that the negative (ground) has the "extra" electrons and they flow ("bump along") from the neg to pos, but I understand there is convention to follow.

OK In your view of the world. How much current would be drawn through Ground in this simple circuit.

Okay, I'll try. I leave out the kettle, that is AC. 3.33 amps from ground through 12v 40W bulb, 0 amps through the led. An F I presume? Here is return quiz question, a typical lightening strike from cloud to ground or is it ground to cloud, which way does current flow?

PS I did not yet get the stepper motor - darlington circuit checked yet, lots of wires, I'm connecting them with .1" pin and socket connectors (don't know the terminology)

You should power the Darlington's externally, not through the Arduino. If you're using 28xx chips (like 2803), the protection diodes are built-in, otherwise you need them.

capricorn: Okay, I'll try. I leave out the kettle, that is AC.

That would be a kid game. Help is not a contest. Feed AC to a pin and say goodbye to the MCU.

Thanks Smoky, I apologize Ken, my ego still has the upper hand, I really don't know which way current flows. They are ULN2803, if I was half as smart as I thought I was I'd be able to post a sketch of the circuit, but it's stranded on my harddrive. Cap

capricorn:
Thanks Smoky, I apologize Ken, my ego still has the upper hand, I really don’t know which way current flows. They are ULN2803, if I was half as smart as I thought I was I’d be able to post a sketch of the circuit, but it’s stranded on my harddrive. Cap

No worries.

So you’re using Darlington Pairs? In this case, maybe this rough sketch will be more relevant to you. It’s only showing three outputs but you should get the idea. You have no worries about the power being used by your arduino. Either from the pins or the GND.

As far as I've seen you treat current as flowing from + to ground/-.

There can be discussion about flow of electrons and holes but when you calculate values, it's + to -.

I could not recreate the current measurement, I must have been measuring the motor current, because now I measure 10 mA or so through the arduino pins, which is good. I have them all hooked up and troubleshot the couple of errors, so they all run. Seems there is not enough power to run all six motors at once though, but I will work on it (there are 3 ULN2803's so each motor has it's own set of 4 pins). I think it may be my power supply but will check it through. How do you post a pdf, insert image asks for a URL? Thanks, Cap