So how much power does my Mega 2560 really handle?
In my project, I don't think I am anywere near the max but I need to select a power module for this project.
The ATmega .pdf says:
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.
Does that mean worst case BS (before smoke) would have the mega drawing 400 mA?
and at what point does it need a heatsink?
The microcontroller itself draws a couple mA of power - that's usually not the issue. However, it CAN drive other parts of your circuit by sourcing or sinking current - the 200mA numbers you gave are the maximum values before the magic smoke escapes from the microcontroller. In this case, it's all about design - there is no valid reason for you to be sourcing/sinking anywhere near the maximum for the controller - it provides logic-level outputs, and is NOT designed to carry current. What you should do is calculate the theoretical current draw of your various electronic peripherals (LEDs, sensors, etc).
I would interpret the Absolute Maximum ratings:
DC Current per I/O Pin ............................................... 40.0 mA
DC Current VCC and GND Pins................................ 200.0 mA
as saying you get 800mA to play with as there are 4 Vcc and 4 Gnd pins, further limited by subgroups of pins for Sink (IOL) and Source (IOH) current:
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.
[looks like 800mA Total to me]
If IOL exceeds the test condition
[(20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient)],
VOL may exceed the related specification. Pins are not guaranteed to sink current greater
than the listed test condition.
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.
[looks like 800mA Total to me]
If IOH exceeds the test condition
[(20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient)],
VOH may exceed the related specification. Pins are not guaranteed to source current
greater than the listed test condition.
You need to further ensure the part temperature does not exceed 85C, above that current sink/source capability may degrade. Get yourself an infrared thermometer & see where it's running it.
'328 Absolute Max Ratings
DC Current per I/O Pin ............................................... 40.0 mA
DC Current VCC and GND Pins................................ 200.0 mA
1 VCC pin: Source 200mA
1 GND pins: Sink 400ma
Only the 32 pin surface mount packages have 2 VCC pins.
Although each I/O port can source more than the test conditions (20 mA at VCC = 5V, 10 mA at VCC = 3V) under steady state
conditions (non-transient), the following must be observed:
ATmega48A/48PA/88A/88PA/168A/168PA/328/328P:
1] The sum of all IOH, for ports C0 - C5, D0- D4, ADC7, RESET should not exceed 150 mA.
2] The sum of all IOH, for ports B0 - B5, D5 - D7, ADC6, XTAL1, XTAL2 should not exceed 150 mA.
If IIOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current
greater than the listed test condition.
Although each I/O port can sink more than the test conditions (20 mA at VCC = 5V, 10 mA at VCC = 3V) under steady state
conditions (non-transient), the following must be observed:
1] The sum of all IOL, for ports C0 - C5, ADC7, ADC6 should not exceed 100 mA.
2] The sum of all IOL, for ports B0 - B5, D5 - D7, XTAL1, XTAL2 should not exceed 100 mA.
3] The sum of all IOL, for ports D0 - D4, RESET 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.
Nice!! Thanks for helping us all with our homework
I will try to pull this together so there's both this detailed view and perhaps a newbie's "Do-Don't"..
I see way too much "40mA per pin" in discussions here and elsewhere... With so many direct LED applications, it seems lots of users are naive about this.
And this is one case where my favorite Buckminister Fuller, "Dare To Be Naive!" does not apply...
Wow, that worked out nicely Terry.
The following needs to be captured also; if you try to sink or source more than 20mA, the output levels may not go fully High or fully low:
If IOL exceeds the test condition [(20mA at VCC = 5V, 10mA at VCC = 3V)
under steady state conditions (non-transient)], VOL may exceed the related specification.
Pins are not guaranteed to sink current greater than the listed test condition.
If IOH exceeds the test condition [(20mA at VCC = 5V, 10mA at VCC = 3V)
under steady state conditions (non-transient)], VOH may exceed the related specification.
Pins are not guaranteed to source current greater than the listed test condition.
I wonder if there is a good place/way to get this information on the Playground.. This just comes up again and again every month almost...
Now I even understand it 8) I think the reason few people have major problems is that when "signals" are being driven to an IC device, the loading is typically very low, and when driving LEDs for visual or OptoIsolator functions, VoH or VoL are non-critical.
I used to drive LEDs directly from old IBM PC Printer ports Bits&Bytes in the Old Dayes and I never blew one up. But those probably had output transistors 100x the geometry of today and they were bipolar devices that got pulled out of saturation easily. Ho Humm...
You can try. I get the impression most noobs see something at places like instructables.com then find the forum & jump in without doing any reading in the Learning or Playground section.
And even if they did, there does not seem to be anything that pops out & says "Hey! You only get 20mA to play with from a pin - add current limit resistors on your I/O pins!"
Maybe we should edit the Top Level Hardware page to say that - most pages seem to concentrate on the software side of things, or libraries, classes, etc.
Yeah.. I'm thinking of pointing to it right at the beginning of "Interfacing with Hardware". I can't find anything right in the playground about this except an old NG specification...