What's the max current an AVR can take?

Go To Last Post
24 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

For example, ATMEGA8? In general, AVR can take up to 50mA?

I see the ATMEGA88-20PU spec. It says:

"“ Active Mode:
250 μA at 1 MHz, 1.8V
15 μA at 32 kHz, 1.8V (including Oscillator)

So with 20Mhz, it can draw (or needs) at the max of 250uA * 16 = 4000uA = 4mA?

In general, how much current a micro-controller takes?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

unebonnevie wrote:
In general, how much current a micro-controller takes?

There exist no "general" value.
Simple get the value for your chip from the data sheet.

E.g. for ATmega88:
Figure 29-2. Active Supply Current vs. Frequency (1 - 24 MHz)

Peter

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Figure 29-2. Active Supply Current vs. Frequency (1 - 24 MHz)

Ok, great, for the ATMEGA8, that goes about 25mA at 5.0V with 20Mhz.

I am trying to understand here.

1. Obviously, supplying 50mA would blow the ATMEGA8.

Thanks

Last Edited: Mon. Feb 15, 2010 - 09:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Obviously, supplying 50mA would blow the ATMEGA8.

Do you understand what the heck are you talking about?

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MBedder wrote:
Quote:
Obviously, supplying 50mA would blow the ATMEGA8.

Do you understand what the heck are you talking about?

Yes, I am trying to make a breakout board of a DC-to-DC converter to 5V/50mA using the MC34063A, but I guess 5V/25mA is good enough.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know it's not PC to use this description in the States but here we'd say "current sucks not blows" ;-) The point being that the amount of current consumed is a function of the applied voltage and the resistance of the device. The lower the resistance the higher the current - the ultimate being at 0 resistance when current is in theory infinite and that's when the sparks and smoke fly (assuming the PSU can service the request)

You may want to find some Electronics 101 articles somewhere and get a feeling for how current and voltage relate and what Mr Ohm had to say on the subject, V=IR or I=V/R and all that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
I know it's not PC to use this description in the States but here we'd say "current sucks not blows" ;-) The point being that the amount of current consumed is a function of the applied voltage and the resistance of the device. The lower the resistance the higher the current - the ultimate being at 0 resistance when current is in theory infinite and that's when the sparks and smoke fly (assuming the PSU can service the request)

You may want to find some Electronics 101 articles somewhere and get a feeling for how current and voltage relate and what Mr Ohm had to say on the subject, V=IR or I=V/R and all that.

Thank you. I got the V = IR. my original question was trying to find out what's the max tolerance of current that an ATMEGA8 (in this case) would allow, so that I can make the breakout board (mentioned) without killing my ATMEGA8.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look at the text at the END of DC Electrical Characteristics for your processor. It will tell you the maximum safe current sum for all of the I/O pins, combined. Add that to the current taken by the bare processor and you should have a realistic maximum.

You also need to understand that the power supply does NOT force a particular current through the load. That is determined by the load, itself. You can connect it to a 3.3V, 5A supply and if the load only takes 50mA, then only 50mA will flow.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not to hijack the post, but I have a stupid question. If I have all o/p ports of an AVR supplying their max rated current (40 mA?) to a load, will the AVR draw/suck proportionally higher current? I guess there are transistor current amplifiers/buffers that will amplify the current inside the chip, but would this worst case scenario load the supply?

How about an effect on the junction temperature of the AVR? I understand that they have tested and characterized the AVR with worst case conditions, but what would the effect be with the worst case current sourcing of the AVR?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

will amplify the current inside the chip

How does that work then?

If V=5.0, I=0.04 then R=V/I=125. So if you connect 125 Ohm resistors to each IO pin then drive the output to the opposite rail 40mA will flow through each pin. I think that the AVR datasheets say that the overall current sourcing/sinking capacity of an AVR is something like 200-300mA so if you have more than about 5-10 pins setup in this way the cumulative current drain from Vcc will exceed this figure and you still have problems. I think it's been suggested (though I'm no electronic engineer that you help things by making half source and half sink but maybe this is just an old wive's tale?).

By the way I don't think there's that many that can source/sink 40mA per pin - it's usually more like 20mA and some only 10mA

EDIT: mega16 says 40mA per pin, 200mA for entire (PDIP) device.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

npat_avr wrote:
I guess there are transistor current amplifiers/buffers that will amplify the current inside the chip...
CMOS amplifiers and buffers, yes. In the static case, those amplifiers tend to take no current, thus the sum of the output current is what the chip will source/sink for a given condition.

For the dynamic case, you can end up with much higher peak currents. Those will tend to be limited by the inductance on the power supply and ground lines, including the bond wires inside the package.

Most datasheets I have seen spec only static current.

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
Look at the text at the END of DC Electrical Characteristics for your processor. It will tell you the maximum safe current sum for all of the I/O pins, combined. Add that to the current taken by the bare processor and you should have a realistic maximum.

You also need to understand that the power supply does NOT force a particular current through the load. That is determined by the load, itself. You can connect it to a 3.3V, 5A supply and if the load only takes 50mA, then only 50mA will flow.

Jim

Jim, those are very helpful facts, especially point #2. And a good confirmation to avoid disaster.

Look at the ATMEGA168's spec, for example, per your suggestion (learning new things about reading the specs every day :-), below are the numbers for the ATMEGA168. That confirms your saying! (Looks like 200mA max for all the IO pins for the ATMEGA168 and 40mA for a pin.)

One more dumb question (because I am not a hardware guy :-). So, saying my breakout board can supply 3V/50mA. Given what you said and the below info for the ATMEGA168, at most, 40mA will be drawn per pin. I really don't need a resistor to limit the current? And say I have a bunch of IO pins, say 10, sourcing some current, that would max out at 200mA. Would my 3V/50mA power source be able to be drawn that much, that is, 200mA? My power source is a 3V (2xAAA batteries) that is pumped up to 5V/50mA via the MC33063A IC. So, I take the answer is "Yes" but the batteries will be drain quickly, b/c of heavy usage, just like the use of electricity at one's home.

THANK YOU!

Absolute Maximum Ratings

Maximum Operating Voltage ............................................ 6.0V
DC Current per I/O Pin ............................................... 40.0 mA
DC Current VCC and GND Pins................................ 200.0 mA

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Most 50mA power supplies would have serious problems if the load tried to draw 200mA. Most supplies will go into some sort of "overload" condition, which usually means that the supply voltage will drop below its standard value. This is known as "current limiting". If this is designed into the supply, then the output voltage will drop until the current is no greater than the maximum allowed. This is often present in linear voltage regulators (7805, for example).

A basic switcher, on the other hand, may have more serious problems. In some cases, the switch will only deliver so much current. In some cases, the inductor will saturate and things will start to get hot. In some cases, output filter electrolytic caps may start to get warm. Some switchers, especially "current mode" type, will have a more civilized current limit.

Most switchers designed for consumer use (the ubiquitous "wall wart", for example) will have to have some kind of current limit to meet CE or UL standards.

So, with a switcher, you should make some effort to insure that the maximum load current is not exceeded.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You should have a resistor to limit current, the 40mA means that if you hook up a load that will draw more than 40mA from the pin that you may fry the output components in the chip and ruin that pin. I would use a resistor to limit current and if you plan on running anything that draws more than 40mA on a pin use a transistor or two to switch a higher current/voltage source to the load.

A good way to test how much current you're using is to stick an ammeter (multimeter) between your power supply and microcontroller. This will show you exactly how many mA the CPU alone draws, then tell it to turn on loads on IO pins and observe how much power consumption increases, subtract from previous value to get the current on that particular pin. Then turn everything that you could possibly use on to see maximum power consumption.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A meter will only measure average current. If there are occasional peaks that rise above the average (for example, multiplexed LEDs), the power supply may respond to the peak and current limit. This can cause no end of grief.

I also would avoid the series current limit resistor in your main supply line. That can also cause big problems AND the micro's supply voltage WILL vary with the load current - that is not a Good Thing. Much better to use a supply with an internal current limit if you are concerned about this.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I apologize if the following questions are obtuse, but for some reason I am having trouble getting my head around this...

clawson wrote:
If V=5.0, I=0.04 then R=V/I=125. So if you connect 125 Ohm resistors to each IO pin then drive the output to the opposite rail 40mA will flow through each pin.

If I connect an IO pin as input and connect the pin directly to GND, the the pin will source current. What would be the current? Would it be the 40mA per IO pin referenced on page 242 of the ATMega date sheet, under Absolute Maximum Ratings? Do I need a protective resistor connected between the IO pin and GND to limit the current?

Also, when I connect a VCC equal to 5volts to VCC, what current is drawn by the AVR? Is to the 300mA (DC Current VCC and GND Pins) referenced on page 242 of the ATMega date sheet, under Absolute Maximum Ratings; or the 15mA (Active 8 MHz, VCC = 5V) or 7mA (Idle 8 MHz, VCC = 5V)referenced on page 243?

Thanks for your patience.

Russ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

If I connect an IO pin as input and connect the pin directly to GND, the the pin will source current.

Do you mean "configure an I/O pin as input"?

Then No. Unless you enable the internal pullup resistor.

Quote:

Also, when I connect a VCC equal to 5volts to VCC, what current is drawn by the AVR? Is to the 300mA (DC Current VCC and GND Pins) referenced on page 242 of the ATMega date sheet, under Absolute Maximum Ratings; or the 15mA (Active 8 MHz, VCC = 5V) or 7mA (Idle 8 MHz, VCC = 5V)referenced on page 243?

Short answer: probably neither. Given the tones of Russ' and une's question(s), it seems that you don't realize that you can hook the AVR Vcc to a power supply capable of delivering 1234A at 5VDC, and the AVR will still draw what it does--a few mA. As noted by someone above, it isn't a bad idea to use a power supply that has current limiting when putting together an app for the first time. If something is cross-wired or mis-configured then the 1234A power supply may cause some spectacular effects.

Russ, your second answer is fairly close. Remember to monitor all Vcc pins. Remember that it is often most convenient to measure the input to the e.g. raw 12VDC into the 5V regulator, and then there will be regulator losses.

The AVR code will then draw in Active mode a few mA according to the datasheet chart for the main clock speed.

But there are often peripheral subsystems enabled--timers, ADC, etc. The datasheet will give a few ballpark numbers under certain conditions.

Then, if the AVR is sourcing current to I/O pins--e.g., you have several sourcing LEDs lit--that current will also be in the AVR draw.

I'm just a bit-pusher so the sparkies will have to answer this question, which was mentioned above:

Let's say I have my AVR in Active mode, and I measure a 10mA draw.

Then I activate 3 sourcing LEDs that draw 5mA each, and I measure 25mA.

Then I turn those off, and turn on three identical sinking LEDs. Measuring the AVR current, what value will I see?

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tha "Absolute Maximum Ratings" are not figures describing the limits of what the AVR can deliver ()in the sense that it will not ever deliver more than that), but what it can withstand delivering. Yes, you can get substantially more current than the Absolute Maximum Ratings figures - for a longer or shorter period. Yes, you need to take steps to limit the current.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Johan's point is a good one.

The Absolute Maximum Ratings are the values that should not be exceeded if you want your chip to keep working for a long time. Staying less than these will help keep the magic smoke in.

Now, you CAN do things that will cause these things to be exceeded. The numbers are not how much it can do, but what the max is that is good for it.
For example, if you ground all I/O pins, set them all to be outputs, and write logic high to all, then you may cause the numbers to be exceeded, to the detriment of the chip.

Its a bit like a speed limit. Having a 100km/hr sign on the road does not mean that your car is incapable of exceeding 100km/hr. You CAN exceed it. But, it may not be in your best interests to do so. Then, again, it might be very helpful in an emergency.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
Do you mean "configure an I/O pin as input"?

Yes, I am sorry this is what I had in mind.

theusch wrote:
Unless you enable the internal pullup resistor.

I should have known this...I cautioned you that my questions might be obtuse...:oops:

theusch wrote:
...it seems that you don't realize that you can hook the AVR Vcc to a power supply capable of delivering 1234A at 5VDC, and the AVR will still draw what it does--a few mA.

I figured that this was the case, since vcc is connected directly to the 5V rail and GND is connected directly to ground. I was trying to figure out what current it would in fact draw.

JohanEkdahl wrote:
Yes, you need to take steps to limit the current.

So if an IO pin is configured as output and set high and is then connected directly to GND, the AVR will draw more than the recommended maximum current, and a protective resistor should be used to limit the current?

As always, thanks to all for their patience.

Russ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

So if an IO pin is configured as output and set high and is then connected directly to GND, the AVR will draw more than the recommended maximum current, and a protective resistor should be used to limit the current?


Well, yes--if you actually intend to do that. Why would you want to do that?

I guess sourcing a big LED without current limiting is kind of like that, except for the Vf of the diode.

Other than that, I can't remember many/any series R on outputs. On inputs, for current-limiting of overvoltage spikes...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
Well, yes--if you actually intend to do that. Why would you want to do that?

I guess sourcing a big LED without current limiting is kind of like that, except for the Vf of the diode.

Other than that, I can't remember many/any series R on outputs. On inputs, for current-limiting of overvoltage spikes...


Yes, that was a bad example. A better example is the input configuration that you reference - and it is an actual example of a I situation that I have currently. I have a pin configured as input with its internal resistor enabled. I have the pin connected to a momentary switch that is normally connected to GND; when pressed, the switch goes high. I am using the switch to toggle an LED. I do not have a resistor in series with the pin.

My assumption had been that the AVR would only draw what current it drew and that the internal impedance of the pin would limit the current to an acceptable level. I see now that my assumption had been incorrect, and that I should have a protective resistor between the pin and the switch.

Thank you again for bearing with me and helping me slog thru this.

Russ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Go over to Atmels site and locate the STK500 documentation. Even if you don't own a STK500, the documentation will show you how both switches and LEDs are wired up on the STK500. Might give some inspiration.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you.

Russ