Overcurrent on IO pins

I've read a lot of warnings here about damaging pins if you draw too much current.

I have experience with PIC chips, which can source 20mA per pin, and it's common practice to directly drive LEDs off the pins. They have internal current limiting protection. I've had projects running for years with an LED on hours at a time connected to a PIC pin with no resistor and never damaged an IO pin.

So wouldn't the arduino have similar protection? I realize since it can source 40 mA, I can't connect an LED directly to a pin, but doesn't it have an internal limit like the PIC? I'd expect that I would blow the LED but not damage the MCU.

You can find this info in datasheet, pages 72 and 304 for Atmega168, and pages 51 and 242 for Atmega8.

You can find this info in datasheet, pages 72 and 304 for Atmega168, and pages 51 and 242 for Atmega8.

What are you trying to accomplish here?

First, 304 doesn't say anything other than 40mA is the absolute max current for IO pins, and a general warning that exceeding any of the specs (such as operating voltage) may damage the chip.

Page 72 is the start of a 17 page section on all the I/O pins which delve into intricate details such as the control registers, signal timings. The closest I can find is protection diodes which look from the schematic like they're to protect the chip from signals that aren't between GND annd Vcc. Nothing about over current.

So, what is the purpose of your post?

The purpose of the post was to point you to where you could find the info you were looking for.

The poster may or may not know the answer.

I wonder this myself. According to this:

Found here: http://www.arduino.cc/en/Tutorial/Blink

no serial resistor is required. I connected it like that thinking that a serial resistor was included on the board, but there isn’t one (at least there isn’t on my diecimila). It hasn’t failed yet given many hours of use.

I’ve also heard of people connecting motors and other fairly high current devices direct to pins, but have not heard of I/O pins going faulty as a result.

It would be nice if someone who new the answer could post here and hopefully point to the paragraph or table in the datasheet which supports what they say.

Regards,

Mike

In my opinion , I didn't agree with direct LED connect example since the first times I use Arduino board.

because LEDs had various type / color , Vf voltage drop and current are depand on its type even on same bag may not treat 100%, just 99% that why some LEDs not equal brightness when parellel.

then wire LED direct to port shouldn't be the right way to do.. you may not explain how Ohm's Law V=IR right.. Just one R per LED is ok..

on some medical/high efficient grade LED, Vf just 2.2V. and very brightness even current 2 mA and rapid (flashing) blowout if connect direct to arduino port

and generic PIC Micro never said that it has current limit on pins but PIC Micro intrinsic had more "drive ability" and overloaded more..

yes, it's may run now but degraded on later days.

Real current-limit had present on some driver IC or some specialize Microcontroller only.. not PIC or AVR

What are you trying to accomplish here?

Hi, Oracle!

I was just trying to give you a hint about the only document I’ve found about Atmega (8 and 168) pins current limit. If you (or all post readers) find another (from Atmel only, please), let us know.

You said:

I’ve read a lot of warnings here about damaging pins if you draw too much current.

All I did was pointing you to the original source of the info you’ve read a lot, because I was not sure you’ve read the datasheet. I think it’s important to know where the information comes from.
I don’t know anything about PIC, but I’m curious, because you said:

I have experience with PIC chips… They have internal current limiting protection.

and Worapoht said:

and generic PIC Micro never said that it has current limit on pins
but PIC Micro intrinsic had more “drive ability” and overloaded more…

yes, it’s may run now but degraded on later days.

Real current-limit had present on some driver IC or some specialize Microcontroller only… not PIC or AVR

I think Atmega will not get easy damaged with a led over current, but only because the IC is not fragile. But I’m confused about the PIC protection. If it exists or not. I won’t search for this now, because I’m not planning on use PICs now. It’s just a curiosity.

I realize since it can source 40 mA, I can’t connect an LED directly to a pin, but doesn’t it have an internal limit like the PIC? I’d expect that I would blow the LED but not damage the MCU.

In the datasheet, I couldn’t find any information about over current protection (that doesn’t mean it doesn’t exist). And more: it only says:

…doesn’t say anything other than 40mA is the absolute max current for IO pins

…exceeding any of the specs (such as operating voltage) may damage the chip.

I understand this as: No, there is no over current protection. But this words are not in datasheet. It’s my opinion. And I understand it as it’s not a good idea to use a led without a current limiter resistor.

So, what is the purpose of your post?

Well, like I said, my post exists only to try to point you a direction, not to give a specific answer. We’re human. We can make mistakes. Sorry by the misunderstanding on my post (English is not my native language). I hope you forgive me.

BTW, let me ask you:
We know a led works with a specific voltage (less than 5v. from Arduino) and specific current (less than Atmega pin current limits), that makes necessary to use a current limiter resistor in series with the led to reduce the voltage between anode/cathode and limit the current (it’s the First Ohm Law - like Worapoht said). Arduino can be used in many creative ways (artistic, toys, engineering) - but electronics is an exact science (almost ;)). So, why do you want to work with a led without its resistor on Arduino pins?

What is the purpose of your post? Do you want to blow a led? :wink:

Best regards.
Adilson.

I've run LEDs directly off the ATmega168. I'm running LEDs off it now. I'm running an LCD backlight off it too. I've only fried one thing - a green LED. But that was me being stupid so I deserved it. Wasn't even attached to the ATmega.

No one ever gives a straight no BS answer on it because no one seems to know. I took a wild assed guess and picked the +5v and 20ma and chose a resistor based on that and plugging in the LED's voltage.

People don't give a straight answer on this because it isn't cut and dried. If you want to drive leds off your pins and don't mind the occasional blown led you can get away with it (I had a bicolor led hooked up like that yesterday) - but no one is going to encourage you to go this route when a 220 ohm resistor costs so little and helps so much when the stray wire drops over your unprotected led leads plugged straight into i/o pins - hmm, what was that flash? Do I smell something?

I HAVE blown individual outputs on a chip. Not an Arduino, specifically, admittedly, but I just thought I put my more-than-2-cents-expensive experience into this discussion.

And I'd like to underline what an earlier poster said about a "failed" pin not necessarily being obvious. It may just be degraded, and subsequent to abuse "sort of" work.

Why take the chance?

I was wondering about the same issue, whether the I/O pins could drive an LED directly without burning out. The Atmega168 data sheet has a couple of figures which show (for a 5V supply) how the I/O pin voltage changes depending on current and whether the pin is high (sourcing current) or low (sinking current):

One LED I have is an NTE30121 Super Bright LED, which has specs of 30ma max and Vf typical of 3.3V. I think that Fig. 181 above shows that this LED would be overdriven, but would be under about 60ma at 25 degrees C, depending on the actual Vf at the higher current.

In my case I wanted to drive a 5x7 LED matrix (LTP747) by applying an I/O pin low to one of the 7 rows and an I/O pin high to one of the 5 columns. In that case the current causes the high I/O pin to drop below 5v and the low I/O pin to rise above 0, with the LED taking up the resulting voltage drop.

The LTP747 specs show this Vf curve:

Trying different values of current shows that the operating current wiill be somewhere between 50-60ma at 25C. For example, at 60ma the source pin will drop to 3.3V and the sink pin will rise to 1.6 volts, leaving only 1.7V to drive the LED, right at the knee of the Vf curve.

The LTP747 LEDs are specced to handle 100ma max and 13 ma continuous. In my case I was only pulsing them briefly (~3% duty cycle), so that was in spec of the LEDs at least, if somewhatover spec on the Atmega168 I/O max current, but again not continuous. FWIW, bottom line it seems to work for me without any chip burnout problems so far.

If nothing else, these curves can help in determining what value of current-limiting resistor to use to get a desired current, accounting for actual pin voltages.

People don't give a straight answer on this because it isn't cut and dried. If you want to drive leds off your pins and don't mind the occasional blown led you can get away with it (I had a bicolor led hooked up like that yesterday) - but no one is going to encourage you to go this route when a 220 ohm resistor costs so little and helps so much when the stray wire drops over your unprotected led leads plugged straight into i/o pins - hmm, what was that flash? Do I smell something?

I've gathered from the rest of the thread that nobody seems to know, that first response just seemed like a smart-ass, 'don't be so lazy and go look here' where 'here' doesn't even have the answer.

I apologize for my reply to that response.

Anyway, I don't think it's so much the cost of a 220 ohm resistor as it is the simplicity of plugging a LED right into that convenient little socket on the board vs having to get out jumpers or a breadboard.

This is the best answer on the subject so far. I can probably work out what I need to know more precisely. Thanks.

I was wondering about the same issue, whether the I/O pins could drive an LED directly without burning out. The Atmega168 data sheet has a couple of figures which show (for a 5V supply) how the I/O pin voltage changes depending on current and whether the pin is high (sourcing current) or low (sinking current):

Oh, we're going to misunderstand the datasheet now. the graph that jmknapp show is "Pin Driver Strength".. That meaning this line is "Limitation" and allow chip working under this graph (SOA: Safe Operation Area). that's Hardware designer must be considering this..