# May I power atmega32a-pu microcontroller from AA batteries?

I need to provide +-4.5V to the microcontroller. That would be fine by having 4x rechargable batteries, but how is it with current? On each AA battery is written min.2550mAh. I am not sure but I think that max what I can put to the microcontroller is around 500mA.

Could you please advice me how to do it? Should I use resistors? Am I right about the 500mA?

Depending on your clock speed, you can run as low as ~2V. The microcontroller will also use far less current at low clock speeds. See the datasheet for more exact numbers, there will be a chart for the clock speed and minimum required voltage to operate. The current consumed can be calculated per Megahertz, but may also not be linear. Higher clock speeds (16-20Mhz) will consume far more than 8Mhz, and the difference is not linear.

Your microcontroller will not consume more than ~50mA (this is what an Atmega328P at 16Mhz uses). If it's consuming 500mA you are doing something horribly wrong, and probably a short circuit somewhere.

If you put 2 AA batteries in series, run at 8Mhz internal clock, you should get about 300-500 hours of run time. This is about 2-3 weeks of constant operation, not considering any other circuit losses or silliness.

Also the capacity of a battery written in Amp-hours (or Milliamp-hours) does not really relate to it's ability to source current. Internal resistances and different battery chemistry will determine it's current output and how much the voltage sags under load too. For example I have a little 260mAh lithium ion 3.7V battery that can pump out 5 Amps if it wanted to - but this is not good for it ;)

Your AA batteries, and batteries like the standard 9V "transistor" battery have terrible current output capability which newcomers to Electrical Engineering often don't know. You would be lucky to get a few hundred milliamp out of a standard (NiMH) AA battery. More in parallel will give more current output, and more capacity, but obviously only as much voltage as a single one.

• Very nice answer for my further development I will keep it in mind. However the question was more targeted to, what if that ampers of batteries are higher, can it burn out the microcontroller? You have my +1 Commented Oct 29, 2014 at 21:19
• @OndrejTokar no, the microcontroller will only "pull" so much current as it needs. You can connect it to a 100A output supply if you wanted to, and it will be okay. Always check for maximum voltage ratings though, and like I said if you want battery operated devices think about lowing clock speed (make sure all features/functions still work!) to reduce overall current consumption Commented Oct 29, 2014 at 21:21
• Thank you so much for all the info! By the way I am looking for a tutor so if you are interested contact me on skype zatokar1, I will pay :). I have an interesting project and I am just a Java programmer ... and know nothing about this ;D Commented Oct 29, 2014 at 21:23
• @OndrejTokar no thanks, but good luck. :) I am too busy with my own crazy projects. Commented Oct 29, 2014 at 21:28
• @OndrejTokar LEDs, once given enough voltage, will have very low resistance, meaning they will draw as much current as they can (until they die!). The common thing to do is put a resistor to limit the current so that once the LED turns on, it is safe, and also has a calculate-able current going through it. If you have a 5V supply, and a 3V LED, the remaining 2V is lost over a resistor. Ohm's law tells us that V = IR. You might want 10milliamps so 2V = 0.01A * R, and R is calculated to be 200 Ohms. Easy! Commented Oct 29, 2014 at 21:32

The 2250 mAh rating of the batteries is a measure of the amount of energy they can store, not of the currrent that they can deliver.

The microcontroller will only draw as much current as it needs from the batteries - there is no need to add resistors, or otherwise limit the current supplied to the microcontroller (as long as the voltage is correct).

• Thats what I needed to know, so my microcontroller will not burn out while I am programming that? Thanks! Commented Oct 29, 2014 at 21:20

The microcontroller will consume only as much current as it needs. The "min.2550mAh" on the battery refers to its capacity, not its current. The "mAh" suffix stands for "milliamp hours". The label is claiming that the battery should be able to deliver 2.55 amps for one hour or 0.255 amps for ten hours or 0.0255 amps for 100 hours before it is exhausted.