LED - resistor & current relations

I think it is because Arduino supplies voltage and current with PWM, which switches on and off the LED for very small durations. That might protect to LED to burn out. Since it is not a continuous current.

And i think the best explanation is mine :stuck_out_tongue_winking_eye:

and the gate in Arduino is probably acting as the current limiter -

Again what gate are you speaking of, there is no such 'gate' involved. Arduino output pins are fully saturated on or off when in their output mode.

Lefty

A regular led should not be powered more than 30ma or you willl get a shorter life,
An arduino pin can only provide 40ma max so the internal pin resistance is actually acting as a series limiting resistor, except the heat will destroy the internals of your arduino instead of being dissapated in a normal resistor
if you leave 10 leds like that, most likely they will all be out in a week
some leds actually do have internal resistors and are rated for 5v, most do not
I've tried the same to se how far I can push a 1w lled before it burns out
I got it to 1.81 amps(normally rated for 350ma) without it burning out, I had a cpu heatsink and fan on it to dissapate heat, and I thought wow it survived untouched and gave off the light of a 10w led
however when I attempted to use it at the rated power again you can tell it was damaged from the high current because it was half as bright as a fresh led
im sure a regular led can't withstand 1.8 amps but say you drive 80ma thru it, you will permanently damage it even tho you see it working
spec sheets are there with max operating values for a reason

winner10920:
A regular led should not be powered more than 30ma or you willl get a shorter life,
An arduino pin can only provide 40ma max

Not correct, an arduino output pin cannot limit it's output current to 40ma if the load resistance is such that more then that will flow. The 40ma specification is just a warning that pin damage is certain to follow if you attempt to cause the output current to exceed that amount by having a load resistance that is too small.

so the internal pin resistance is actually acting as a series limiting resistor, except the heat will destroy the internals of your arduino instead of being dissapated in a normal resistor
if you leave 10 leds like that, most likely they will all be out in a week
some leds actually do have internal resistors and are rated for 5v, most do not
I've tried the same to se how far I can push a 1w lled before it burns out
I got it to 1.81 amps(normally rated for 350ma) without it burning out, I had a cpu heatsink and fan on it to dissapate heat, and I thought wow it survived untouched and gave off the light of a 10w led
however when I attempted to use it at the rated power again you can tell it was damaged from the high current because it was half as bright as a fresh led
im sure a regular led can't withstand 1.8 amps but say you drive 80ma thru it, you will permanently damage it even tho you see it working
spec sheets are there with max operating values for a reason

I think it is because Arduino supplies voltage and current with PWM, which switches on and off the LED for very small durations. That might protect to LED to burn out. Since it is not a continuous current.

@cmd1024
Total and utter rubbish. You are fooling yourself and damaging your arduino.
I wrote a page for deluded folk like you:-
http://www.thebox.myzen.co.uk/Tutorial/LEDs.html

I read any information about them, it is written almost everywhere that series resistor is a must to use, otherwise LED will burn out instantly.

Please show us where you read this.

Here’s a commercial design that powers not a single LED, but up to 8+ LED’s from a single ATMega328P pin without any current limiting resistors whatsoever:

Buyers/prospects seem to be concerned with lack of standoffs/mounting holes and one guy is “shocked” with regards to the SPI SW interface implementation. Not a single comment about the basic electrical design or lack of current limiting resistors.

Assuming the SparkFun designer is ignorant to the popular opinion of this forum, how would you qualify this design in terms of ee? (Facts rather than name-calling and opinions would be refreshing).

BenF:
Here’s a commercial design that powers not a single LED, but up to 8+ LED’s from a single ATMega328P pin without any current limiting resistors whatsoever:

http://www.sparkfun.com/datasheets/Components/LED/7-Segment/SPI_to_4x7SD-v22.pdf

Buyers/prospects seem to be concerned with lack of standoffs/mounting holes and one guy is “shocked” with regards to the SPI SW interface implementation. Not a single comment about the basic electrical design or lack of current limiting resistors.

Assuming the SparkFun designer is ignorant to the popular opinion of this forum, how would you qualify this design in terms of ee? (Facts rather than name-calling and opinions would be refreshing).

Could you provide the actual sparkfun product link or number please?

Lefty

Can you imagine how tiny an AVR output driver is, and how quickly it heats up with the passage of excess current?
Can you guess what thermal shock does on such a tiny scale?

Yes, of course stuff works, and it may work in one particular device for quite a long time, but don't do it for large production runs, or even suspect that it will work even once in small runs.

Product link is here:

Hi Retrolefty,

Referring you to the ATMEGA48A/PA/88A/PA/168A/PA/328/P Manual -
Pg 77 - "Each output buffer has symmetrical drive characteristics with both high sink and sourcecapability. The pin driver is strong enough to drive LED displays directly.... All I/O pins have protection diodes to both VCC and Ground..."
Pg 318 - "If IIOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current
greater than the listed test condition"

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.

Of course - doing this is pushing the ATMega chip into extremely unsafe territory :slight_smile:

Not a single comment about the basic electrical design or lack of current limiting resistors.

Well that just shows you the knowledge level of those commenting.

Have you read that page I wrote?
Have you seen the results of the experiments I did?
You can get 250mA peak current out of an arduino pin, where the level where damage starts to be done is 40mA.
Or are you one of those people who don't believe that the data sheets should be taken seriously?

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.

They have now. ]:smiley: check again.

Grumpy_Mike:
They have now. ]:smiley: check again.

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.

BenF:

Grumpy_Mike:
They have now. ]:smiley: check again.

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.

Lefty

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.

  1. The can often stand much higher currents if they are pulsed.
  2. 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 :slight_smile:

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).

Sink resistance: 29 Ohms
Source resistance: 37 Ohms

  1. 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.

  2. 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.

  3. 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.

Use a resistor.