Basic LED setup

Thread Starter

Jean-Jacquesss

Joined Nov 8, 2021
5
Hello,
I just started learning electronics and for my first setup, I built the classic setup: resistor + LED.

I choosed a red LED and this is the datasheet:
1636398058527.png
As I understand it the important parts are: If = 20mA and Vf = 2V.

Then I calculated the resistance I needed with a formula I've seen a lot on internet : R = (Vsupply - Vled) / I
I use a 3.3V raspberry py pin for my supply so have : R = (3.3 - 2) / 0.020 = 1.3/0.020 = 65 Ohm.
I should use a 65 Ohm resistance but I don't have one, so I used a 100 Ohm resistance.

Here is the complete setup: 254348311_279421564106450_6458193137555612612_n.jpg

But when I measure the differents value, here is what I have:
Current in the circuit: 7.2mA
Voltage drop across the LED: 2.53V

So in reality the tension applied to my LED is too high and could damage it but it is consuming less current that announced in the datasheet.
I really don't understand where i screwed up in my calculations, someone could help me figure out why the setup behave like this ?
 

Thread Starter

Jean-Jacquesss

Joined Nov 8, 2021
5
Thanks for your response, you'r right corrected myself. It is 7.2mA.
Welcome to AAC.

Your measurement is wrong. You can't have 7.2A through that LED, the RPi couldn't supply it and if it did the LED would blink once and smoke.
Thanks for your response, you'r right, I corrected myself. It is 7.2mA.
 

SamR

Joined Mar 19, 2019
5,031
Welcome to AAC! I don't put much trust in either chinese datasheets or products. Most grab box LEDs are happy with anything 20mA and lower. The correct Ohm's Law formula is V=I*R, so to solve for R=V/I then 3.3V /20mA(max) = 165Ω
Notes on LEDs (gizmology.net)

Notice that I ignored the voltage drop across the LED.
 
Last edited:

Thread Starter

Jean-Jacquesss

Joined Nov 8, 2021
5
Welcome to AAC! I don't put much trust in either chinese datasheets or products. Most grab box LEDs are happy with anything 20mA and lower. The correct Ohm's Law formula is V=I*R, so to solve for R=V/I then 3.3V /20mA(max) = 165Ω
Notes on LEDs (gizmology.net)
Thanks for your reply. I have to admit that I'm a bit confused because i've viewed the formula i used all across internet.
And even on led's calculator site the number I got seem to correspond to their value.1636402918743.png

Could you explain to me why I'm wrong and why the formula R = (Vsupply - Vled) / I doesn't apply here?
 

ElectricSpidey

Joined Dec 2, 2017
2,758
The LED @ 2.53 is out of spec, but nothing to worry about, just use that number instead of 2 when you use the calculator.

And...as you push more towards an actual current of 20mA that voltage will rise a bit.

If you want the current closer to 20mA just use a 50ohm resistor and don't worry about it.
 

SamR

Joined Mar 19, 2019
5,031
All I did was the down and dirty omitting the Vled which may or may not be 2V. Look at the "Notes on LEDs" site I linked. 3.3V is a standard albeit a bit low for most folks breadboarding circuits which doesn't leave much overhead for LEDs. It all depends on the brightness of the LED and if it suits your intended purpose.
 

Thread Starter

Jean-Jacquesss

Joined Nov 8, 2021
5
@ElectricSpidey Thanks for your response, I'm not concerned about the life span of the LED but I just want to be sure to understand what happen befores going on more expensive stuff. Does it mean that the datasheet is false and/or the product doesn't respect what is written on the datasheet ?
 

SamR

Joined Mar 19, 2019
5,031
Chinese grab box parts are notoriously off spec. Copied from the link I posted.

"As a rule of thumb, different color LEDs require different forward voltages to operate - red LEDs take the least, and as the color moves up the color spectrum toward blue, the voltage requirement increases. Typically, a red LED requires about 2 volts, while blue LEDs require around 4 volts. Typical LEDs, however, require 20 to 30 mA of current, regardless of their voltage requirements. The table on the left shows how much current a typical red LED will draw at various voltages."

It doesn't mention white which is about the same as blue. Nor does it mention green or yellow. It's like the prism, as you move up the ROYGBIV the forward voltage drop increases.
 

ElectricSpidey

Joined Dec 2, 2017
2,758
@ElectricSpidey Thanks for your response, I'm not concerned about the life span of the LED but I just want to be sure to understand what happen befores going on more expensive stuff. Does it mean that the datasheet is false and/or the product doesn't respect what is written on the datasheet ?
It probably means the LEDs you received are not the same ones specced in the data sheet, or it's just out of spec, it's really hard to say.

2.53 seems a little high for a red LED especially @ only 7.2 mA. (but it's not impossible)
 

Jon Chandler

Joined Jun 12, 2008
1,029
The equation you used is completely correct. The LED and datasheet aren't quite in agreement but this can happen with some suppliers – they supply similar parts if they run out of a particular part.

With an LED, you control the current, and the voltage depends on the physics of the LED material. Nothing you can do will change the LED's forward voltage (Vf) other than changing the current.
 

BobTPH

Joined Jun 5, 2013
8,813
Is it possible you measured the voltage wrong? Like measuring across both the led and the resistor? The Pi will likely not put out 3.3V at 20mA. Microcontroller outpus often have a resistance of as much as 100Ω. Th drop at 7mA would be .72V so, the pin might actually read 3.3-.72 = 2.58V, which is close to what you measured.

Bob
 

SamR

Joined Mar 19, 2019
5,031
I don't think he was using a PI output pin but simply using it's 3.3V power supply output pin. Not sure what the PI's max mA output is from its power pin but it's more than enough for this.
 

BobTPH

Joined Jun 5, 2013
8,813
I use a 3.3V raspberry py pin for my supply
I interpreted this line to mean an output pin, but you may be right.

I do not believe that that LED would have a 2.5V drop at 7mA though. I still think it is a measurement error. On the breadboard photo you cannot see the LED leads, but it looks like there is a gpio pin going to the resistor.

TS: how about a schematic?

Bob
 

MisterBill2

Joined Jan 23, 2018
18,176
Keep in mind that an LED is a very non-linear device, and also that the LED looks rather white, not red, and that a typical white LED voltage is higher than 1.7 or 1.8 volts, usually closer to 2.5 volts. So you may have a white LED in a red plastic body.
ALSO, that resistor in the photo in post #1 does not look like 100 ohms, (brown, black, brown). So the meter may not be correct either.
 
Last edited:

Tonyr1084

Joined Sep 24, 2015
7,853
The equation you used is completely correct.
Something to share with you about parts out of China: They are often scavenged and resold as new products. Also, a factory in Zambonia (I hope there is no such place) makes LED's. Once an LED is made you can't go back and change anything about its characteristics or operating parameters. So Zambonia Electronics ends up with a bad batch of LED's that are out of spec. A total loss. Until someone comes along and says "I'll buy your entire stock of bad LED's for $100." Of course ZE is going to accept that offer. Now the kid who bought those "Out Of Specs" LED's posts them on the web as new (because they are new) LED's. You buy what you think is new and IN SPEC LED's only to discover they aren't. This sort of thing happens all the time with non-reputable sources.

Also, an LED will behave differently under different temperatures. Their Vf will change. As they heat up their Vf goes down. The end result is a runaway cascade failure. If the Vf drops then the current goes up, making more heat. More heat drops the Vf even further, increasing the current and - you guessed it - more heat. That's why a good manufacturer will tell you the Max current (30mA) AND the normal operating current (20mA). If you exceed 30mA you start shortening the life of the LED. 5mA over the max and you can shorten the life quite a bit. 10mA over and its life may be on the order of a few minutes. Or even just a few seconds. More than 40mA and it's likely you just turned your LED into a single use photo flash bulb. i.e. burn-out.
 

Jon Chandler

Joined Jun 12, 2008
1,029
Something to share with you about parts out of China: They are often scavenged and resold as new products. Also, a factory in Zambonia (I hope there is no such place) makes LED's. Once an LED is made you can't go back and change anything about its characteristics or operating parameters. So Zambonia Electronics ends up with a bad batch of LED's that are out of spec. A total loss. Until someone comes along and says "I'll buy your entire stock of bad LED's for $100." Of course ZE is going to accept that offer. Now the kid who bought those "Out Of Specs" LED's posts them on the web as new (because they are new) LED's. You buy what you think is new and IN SPEC LED's only to discover they aren't. This sort of thing happens all the time with non-reputable sources.

Also, an LED will behave differently under different temperatures. Their Vf will change. As they heat up their Vf goes down. The end result is a runaway cascade failure. If the Vf drops then the current goes up, making more heat. More heat drops the Vf even further, increasing the current and - you guessed it - more heat. That's why a good manufacturer will tell you the Max current (30mA) AND the normal operating current (20mA). If you exceed 30mA you start shortening the life of the LED. 5mA over the max and you can shorten the life quite a bit. 10mA over and its life may be on the order of a few minutes. Or even just a few seconds. More than 40mA and it's likely you just turned your LED into a single use photo flash bulb. i.e. burn-out.
Thank you for mansplaining to me. Totally unnecessary and straying from the essential topic at hand, but thanks anyway.

My statement was:

"The equation you used is completely correct."

This equation is 100% correct and to the point of the question. And knowing Vf, it will provide the correct results for current & resistance. The OP's concern was that he was afraid the equation, which he found in many places on internet, was wrong, or that there was some point he was missing. The answer to the original post was and still is the equation is correct and was/is being applied correctly.

As to why the LED's Vf doesn't match the data sheet, the answer is pretty simple – it's not the data sheet for the LED he has. Period. Why isn't it the right data sheet? Who cares. The question was about the equation for calculating LED current.
 

MrChips

Joined Oct 2, 2009
30,712
R = (Vs - Vf) / If
The equation is correct.

The problem is you don't know Vf and If.
The relationship between Vf and If is an exponential function and very dependent on temperature.
Even if the given datasheet is the correct one, the data stated are averaged from measuring hundreds of manufactured components. The DUT would not be the same.
 

Ya’akov

Joined Jan 27, 2019
9,070
Thank you for mansplaining to me. Totally unnecessary and straying from the essential topic at hand, but thanks anyway.
This response is really unnecessary. @Tonyr1084 was trying to provide information that some people don't know. You may know it, but you are not the only one who will read this thread.

It would have been sufficient to say something like "nonetheless, the equation is correct" if you needed to say something.
 

BobaMosfet

Joined Jul 1, 2009
2,110
Hello,
I just started learning electronics and for my first setup, I built the classic setup: resistor + LED.

I choosed a red LED and this is the datasheet:
View attachment 252188
As I understand it the important parts are: If = 20mA and Vf = 2V.

Then I calculated the resistance I needed with a formula I've seen a lot on internet : R = (Vsupply - Vled) / I
I use a 3.3V raspberry py pin for my supply so have : R = (3.3 - 2) / 0.020 = 1.3/0.020 = 65 Ohm.
I should use a 65 Ohm resistance but I don't have one, so I used a 100 Ohm resistance.

Here is the complete setup: View attachment 252190

But when I measure the differents value, here is what I have:
Current in the circuit: 7.2mA
Voltage drop across the LED: 2.53V

So in reality the tension applied to my LED is too high and could damage it but it is consuming less current that announced in the datasheet.
I really don't understand where i screwed up in my calculations, someone could help me figure out why the setup behave like this ?
Start here:

Title: Understanding Basic Electronics, 1st Ed.
Publisher: The American Radio Relay League
ISBN: 0-87259-398-3
 
Top