Electronic – arduino – Determining current draw of arduino

arduinoatmega328pcurrentvoltage

I am trying to determine the correct batteries required for my Arduino (Atmega 328) project. I have components which have both voltage and current ratings. I am adding up all the maximum current specifications from the components to determine the ideal mAH.

I am currently stuck on the Atmega328 chip. I read the datasheet, but I cant seem to find the specific current draw of the chip. My understanding is that the operating voltage is ~5V, and the current draw of the chip would be ~40mA. But if I am using 6 pins (3 analog, 3 digital), assuming they all output 40mA at the same time (which is unlikely as the 3 analog pins take in x,y,z values from an accelerometer), would it be safe to assume the current draw of the chip would be 240 mA? (this sounds wrong)

Best Answer

The datasheet of a microcontroller tells you the current it uses internally. Only you can determine how much additional current there might be going into the power pin or out the ground pin due to other pins sinking or sourcing current.

From what you say, the micro itself can take up to 40 mA. I don't know that particular micro, but that's certainly plausible.

The datasheet is also telling you the maximum that output pins are allowed to source. This is of no use in a power calculation. You use this information during the design to make sure this limit is not exceeded. The actual current that the external circuit draws from a output pin is dependent on the external circuit. Consider the limiting case where a pin is left unconnected. Clearly no current is going out that pin.

For example, let's say you're lighting a LED directly from a digital output. The processor runs on 5 V, and you have a green LED to ground with 300 Ω resistor in series. The current going out of the pin when high will be about 10 mA. The fact that the output could have sourced up to 25 mA, for example, is irrelevant.