My interpretation therefore is - the LED did not burn out within a few seconds as it would if connected to a ordinary 6V battery because the "Pin Driver" (as Amtel calls it) is not able to source current more than a certain maximum beyond its rated limit as indicated in the manual.
It might be your interpretation of the words but you would be very wrong.
Pins are not guaranteed to source current greater than the listed test condition"
The listed test conditions is 20mA.
The Pg 77 line has nothing to do with the point in question.
Not a single comment about the basic electrical design or lack of current limiting resistors.
That may be my opinion exactly, but that is not very useful for those who come here to learn, is it?
If you look at the VI curves (driver strength section) in the AtMega datasheet, the output stage drops about 0.6V when sourcing 20mA and slightly less when sinking. This suggests that for some combination of Vcc and LED forward voltage, the inherent current sink/source capability may be all that is needed to stay within safe operating limits. A discussion along what these operating conditions are would be much more informative than the typical opinionated posts on this topic.
That may be my opinion exactly, but that is not very useful for those who come here to learn, is it?
If you look at the VI curves (driver strength section) in the AtMega datasheet, the output stage drops about 0.6V when sourcing 20mA and slightly less when sinking. This suggests that for some combination of Vcc and LED forward voltage, the inherent current sink/source capability may be all that is needed to stay within safe operating limits. A discussion along what these operating conditions are would be much more informative than the typical opinionated posts on this topic.
What many of us try to do on this site when helping beginners is to give good fundamentally sound information. That tends to best help them with not only their specific problem or question at the time but is also fundamentally helpful for their learning growth. We use ohm's law to try and explain or demonstrate basic principles. So rather then trying to rely on some questionable practice, we try and give solutions that mimic good engineering practices. A good lesson is one that applies to many or any circuit example, rather then just relying on a one-off trick.
Driving LEDs from voltage sources without an specific means of controlling the current to a predictable value is just not following sound practices, rather it's relying on dynamic duty cycle or built in impedance to control current in a hard to predict manner. There are many circuits published on the web and even in printed manner that are just plain wrong or hinge on poor practices. I have no qualms with someone who wishes to abandon good practices for the sake of economy or just to prove they can get away with some short-cut, as long as they don't pass it on to others as example of proper design. They should expect to get some push-back from those that have equal or more knowledge and experience, even if they won't except such advice.
Given the choice to show a beginner how to do something cleaver Vs something fundamentally sound, I'll stick with the latter. So without measurement, how would you calculate the specific current that will flow through the LED segments? If the segments end up being too dim or too bright, what then? If you can't calculate it and therefore control it, you have failed to engineer the design, but rather just allowed circuit dynamics beyond your control to somehow manage to not burn out, at least initially. That is not engineering, that is just playing with stuff and finding out what smokes or not.
This suggests that for some combination of Vcc and LED forward voltage, the inherent current sink/source capability may be all that is needed to stay within safe operating limits
It might suggest this to you but you would be very wrong to come to this conclusion.
If you look at the experiments I did on this page:- http://www.thebox.myzen.co.uk/Tutorial/LEDs.html
You can see that I got currents out of an arduino pin in excess of 250mA. The maximum before damage is done to a pin is 40mA. So the pins do not operate within safe limits they are over 600% over the safe limit. That is not a good way to design a circuit. It might not lead to instant smoke and destruction of the but it will severely shorten the life and reliability of the product. The LED is not as vulnerable because of two things.
The can often stand much higher currents if they are pulsed.
The way an LED responds to excess current that is not strong enough to melt it is to reduce it's brightness. Abused LEDs do not shine as bright. Again it's lifetime is reduced. In fact the lifetime of an LED is defined as a half life, that is the time taken for the brightness to drop by half.
Abused components that are not abused enough to instantly kill them suffer internal damage that will shorten their life. However nothing can be learned about this from one or two isolated tests. You need to run many hundreds of such circuits to be able to quantify what the reduced life time is.
In one job I had as a designer of digital set to boxes, one team (not my team) had a design that involved a lot of LEDs and at the customers instance had made the LEDs as bright as possible but still keeping to the limits in the data sheet. There were about 17 LEDs in the product. The result was a 10% failure rate in boxes in the first year. Which when you are making one million boxes is 100,000 faulty units. So while you think you might get away with it, and indeed you might not notice it on one unit, on average the design is not repeatable especially if you put it on the net for other poor saps to copy.
Anyway what is so bad about using a resistor, they are very cheap to the point of almost insignificance. If you are afraid of them then maybe you should pick another hobby. If you still think they are unnecessary then you defiantly should pick another hobby.
Completely buy your point Mike... NOT suggesting using such an incredibly faulty circuit design for LEDs without current limiting resistors - just trying to figure out what happened -> ie. Why didn't something (Chip, LED, some interconnection...) burn out within a few seconds due to an uncontrolled current surge into the Amperes range - which would have happened if say the LED had instead been connected across terminals of a 6V battery with internal resistance typically couple of hundred milliohms.
Thanks for sharing your really interesting current stress-test results on Arduino pins - i'd have never dared trying out anything more than 30-40 milliAmps - so nice to know info
We know that we need to care for the AVR output pin current limit, the LED current limit and also to consider long term effects from abuse (rather than base our conclusion on a single limited scope test). This is a healthy base for discussion and a lot better than the opinionated “do as I say” posts. The question remains if we can design for these limits without a series resistor?
Looking at the Mega VI curves from the datasheet, we can extrapolate static on state resistance for the CMOS output stage high-side (source) and low-side (sink) respectively (5V @ 25C).
If we short an output pin to ground, max static current will be limited to about 135mA (5V / 37) through the high-side output FET. This is less than the 200mA rail max for the chip total and so it is to be expected that the IO pin will have time to burn out before the chip resets. This is why we need current limiting on the IO pin as the AtMega is not capable of restricting current to safe levels.
If we short a 5V power rail to an output low IO pin, about 172mA (5V / 29) will pass through the low-side output FET. This again is way above max and so current limiting is required.
If we short two output pins (one high and one low), current will pass through the high-side FET on one pin and the low-side FET on the other pin. In this case, max current is about 76mA (5V / (29 + 37)). This is less than the single pin sink/source cases, but still a guaranteed failure.
A LED follows a sharp VI knee- curve where current is allowed to flow freely above its forward voltage, but blocked below this same voltage. Because of this sharp knee-curve, we need to limit current as soon as we exceed the LED forward voltage. Typically, we add a series resistor in this case such that the voltage drop across this resistor plus the forward LED voltage drop match supply voltage for a given target current. The formula for this relationship is as follows:
I = (Vcc – Vf) / R
A broad spectrum (white) LED will have a typical Vf of 3.5V whereas a red LED will have a Vf of about 2V only. If we apply the above formula and substitute R with the AtMega output stage resistance, we can calculate Vcc so that current (I) stay within limits for a given LED forward voltage (Vf).
For a white LED and case 3 above, we would need to limit Vcc to about 4.72V for a target current of 20mA. Max current at 5V would be about 22.7mA for this LED without a series resistor.
For a red LED and case 1 above, Vcc would have to be as low as 2.74V for a current of 20mA. At 5V, current will exceed 80mA. At 3.3V, current is about 32 mA.
Does this mean we can eliminate current limiting series resistors for LED’s in general? No, we always need to consider current limiting. Output stage resistance however may be all that is required for some designs (such as white LED’s @5V or other LED’s at 3.3V). Is it not better to just always use an external series resistor? Well, that is for you to decide.
Looking at the Mega VI curves from the datasheet, we can extrapolate static on state resistance for the CMOS output stage high-side (source) and low-side (sink) respectively (5V @ 25C).
.......... If we short an output pin to ground, max static current will be limited to about 135mA (5V / 37) through the high-side output FET.
My experiments show that I was getting in excess of 250mA of current from one output pin with a resistor and LED connected. This shows that you can not extrapolate those curves.
Is it not better to just always use an external series resistor? Well, that is for you to decide.
No it is not, your solution seems to imply you have to drop the Vcc to match the LED, this will then stop the processor running at 16MHz. You also could not mix colours of LEDs. You will also make the processor incompatible with 5V inputs from other devices as well as the output drive incompatible.
Yes I suppose you have the choice like you have the choice of trying to cross an 8 lane highway while being blindfold. It is not impossible but is bloody stupid.
For ***k sake it is only a resistor what is the problem with using one?
Since theory isn't sufficient for some (that's fine -- some people prefer empirical proof), I offer up the following experience:
I connected an LCD backlight directly to an Arduino pin once, because I forgot the particular module I was using did not have a series resistor. My intention was to use PWM, but for testing, I used a digitalWrite(BACKLIGHT, HIGH).
That LCD no longer has a working backlight. $20 part broken within 5 minutes of taking it out of the anti-static bag.
I have also accidentally left an LED on a breadboard without a resistor, straight from a HIGH pin. It did not burn out, but seeing it lit unexpectedly, I removed power and corrected my dumb mistake. The LED and chip are fine, but then, it wasn't running but maybe 10 seconds.
As folks have said, different parts have different tolerances. If you go outside the rated specs, it may or may not work. And if it does work, it may not work for long. If it does work for a while, it may not work as well.