Basic LED setup

Tonyr1084

Joined Sep 24, 2015
7,852
This equation is 100% correct
I never disagreed with you. Rather, I recognized that it IS the correct process for calculating the necessary resistance. If I didn't say it before, Jon Chandler is correct.
Thank you for mansplaining to me.
Don't know why you seem to have taken offense at my comments. Rather than answering a question that has been correctly and thoroughly answered I chose to offer that additional bit of information that some may not know. I don't assume you know little to nothing, I assume you can relate to something I may say. If I say something incorrect - as has happened on this website more times than I care to recount - someone will correct me right away. And I don't even know what "Mansplaining" is.
 

Thread Starter

Jean-Jacquesss

Joined Nov 8, 2021
5
Thanks every body for all your answers.

I'm a bit confused. As I understand it, the voltage of the LED depend on the current in the circuit, and the current in the circuit depend on the voltage of the LED so it's like a snake biting its own tail.

So there is no way to calculate the resistance needed to have a wanted voltage drop across the LED without trial and error ?
 

MrChips

Joined Oct 2, 2009
30,706
Thanks every body for all your answers.

I'm a bit confused. As I understand it, the voltage of the LED depend on the current in the circuit, and the current in the circuit depend on the voltage of the LED so it's like a snake biting its own tail.

So there is no way to calculate the resistance needed to have a wanted voltage drop across the LED without trial and error ?
Yes and no.

Here is the I vs V characteristic of a typical LED.

1636485215122.png


What is a typical LED?

To solve for I and V you need to know the exponential equation, LED colour, and LED temperature.
Then you have to deal with variability from device to device.

Or you can make some assumptions and approximations. Don't assume a current. The current is changing faster than the voltage. Choose the voltage.
Assume that Vf for a red LED is 2V.
Choose the LED forward current you desire and calculate R = (Vs - Vf) / If
Build the circuit and measure Vf and If, to satisfy your curiosity.

If you make Vs very large then the circuit tends towards an ideal current source and that is your goal.
 

Audioguru again

Joined Oct 21, 2019
6,672
It is easy to calculate the resistor value for a name brand LED that was bought from a reputable distributor (not bought from ebay, AliExpress or Amazon) and driven from a known voltage (not on a breadboard that has wonky contacts and not from a processor). Most ordinary LEDs are very bright at 20mA and their datasheets have all the ratings at 20mA.

An LED part number has a datasheet with a range of forward voltage. A red one might be listed as 1.5V to 2.4V. Then calculate the resistor value for a 1.5V one so that the current will be 20mA or less if the LED forward voltage is higher than the minimum listed.
 

Attachments

BobTPH

Joined Jun 5, 2013
8,804
Can you show us how you measured the current and voltage. I still think your results are due to a measurement error. Don’t be insulted, it happens to everyone.

By the way, you cannot do the measurement correctly without two meters.

Bob
 
Last edited:

Audioguru again

Joined Oct 21, 2019
6,672
A current-measuring meter throws away some of the supply voltage which causes the current to be lower than you think.
It is more accurate to measure the voltage across the resistor then calculate the current.

The voltmeter should measure the voltage from the processor that feeds the resistor. Its "3.3V" might actually be 3V or a little less.
 

MisterBill2

Joined Jan 23, 2018
18,167
I still hold with my statement, post #15, that it looks more like a white LED, which often has a forward voltage of around 2.5 volts. No disrespect intended, and hopefully none perceived.
 

MisterBill2

Joined Jan 23, 2018
18,167
Thanks every body for all your answers.

I'm a bit confused. As I understand it, the voltage of the LED depend on the current in the circuit, and the current in the circuit depend on the voltage of the LED so it's like a snake biting its own tail.

So there is no way to calculate the resistance needed to have a wanted voltage drop across the LED without trial and error ?
The forward voltage across an LED depends mostly on the color, and only changes a small amount as the current varies. The curves in post #23 show that fairly well. Gross excessive current is different, but that will destroy tyhe LED fairly rapidly and so itis not part of the discussion..
Let me repeat: LEDs are very non-linear, just like most diodes. So ohms law does not apply
 

MrChips

Joined Oct 2, 2009
30,706
Just for fun I took a red LED out of my stock. No datasheet is available.

I applied 5V via a series resistor R to the LED.
I measured the diode forward voltage Vf.
I measured the voltage across the resistor and calculated the diode current If.
I repeated this for different values of R.

1636495579359.png


Then I plotted the data after fitting to an exponential curve (red line).

As an example, select a supply voltage on the x-axis, 5V.
Select a target current, example, 3mA.
The green horizontal line is the target current (3mA).
Draw a straight line from (0mA, 5V) point on the x-axis, through the intersection of the target current and the LED I-V curve. This is called the load line. The slope of this line is 1/R. The slope taken from the graph is 1/R = 5mA / 5V. Hence R = 5V / 5mA = 1kΩ.

This graphical method gives the same result as the equation
R = (Vs - Vf) / If

You use a guesstimated value of Vf and a target value of If.

Incidentally, this gives me a resistor R = (5V - 2V) / 3mA = 1kΩ.

As I already mentioned, you want the load line to be as horizontal as possible, i.e. if the slope = 1/R is low, R has to large. The way to achieve this is to increase Vs.

LED curve.jpg
 

BobTPH

Joined Jun 5, 2013
8,804
I still hold with my statement, post #15, that it looks more like a white LED, which often has a forward voltage of around 2.5 volts. No disrespect intended, and hopefully none perceived.
I am more inclined to trust the TS, who has seen it in person, than what is seen in a photograph. White LEDs tend to be quite bluish, not redish.

Bob

Bob
 

Tonyr1084

Joined Sep 24, 2015
7,852
MY "Clear White 5mm Super Bright" LED's have an average Vf of 2.97. Out of 100 LED's Max measured Vf (@5V, 20mA) 3.04Vf and a Min of 2.92; with a standard deviation of 0.03V.
 

Jon Chandler

Joined Jun 12, 2008
1,029
Since y'all have pretty much managed to obscure the original question.....

The Vf (forward voltage) of an LED can easily be determined using a constant current regulator like the LM317 version shown below.

Connect the LED in series with an ammeter to the constant current supply, and adjust the current to the desired level (or the brightness), starting with the current at the minimum level. When the current is adjusted as desired, read the voltage across the LED with a voltmeter. This will allow determining the required resistance for a resistor-regulated supply using the subject equation.

Note that Vf for a given LED at a given current will vary a little bit with temperature.

If desired, it's easy to generate a Vf vs current curve by measuring voltage at a few different currents and plotting the curve.e0d41196469033a584878bde3e08cccc672f299e.jpeg
 

MrChips

Joined Oct 2, 2009
30,706
No need to.
For a red LED, you just need to assume that Vf is going to be between 1.8V and 2.0V.
Use the largest resistance that will give you adequate brightness.
 

SamR

Joined Mar 19, 2019
5,031
@Jean-Jacquesss @Yaakov I am curious as to why you chose to use a 3.3V power pin instead of a 5V power pin for this? Used Arduino's for a few years and yet to start into PI's and don't think I have ever used a 3.3V power pin. Know it is there, and useful for when you might have a 3.3V device which I can't ever remember using. Usually, most of the devices I work with have a 5V or higher voltage requirement. Plus, 5V will give you a bit more overhead than 3.3V and I'm not trying to save energy experimenting. Know Yaakov has been using PI which is why I also directed this to him. Simply curious...
 

MisterBill2

Joined Jan 23, 2018
18,167
MY "Clear White 5mm Super Bright" LED's have an average Vf of 2.97. Out of 100 LED's Max measured Vf (@5V, 20mA) 3.04Vf and a Min of 2.92; with a standard deviation of 0.03V.
I have taken apart LED tubes and those LEDs tend to show about 2.6 volts at the low current I use for checking them. And so there is a spread..
 

jayanthd

Joined Jul 4, 2015
945
I have taken apart LED tubes and those LEDs tend to show about 2.6 volts at the low current I use for checking them. And so there is a spread..
Rseries = (Vs - Vled) / Iled

Vled = Vf

Vf is the forward Voltage drop and it is around 2.1V for standard red led like say it is 0.7V for a general purpose Si diode.
 

Jon Chandler

Joined Jun 12, 2008
1,029
@Jean-Jacquesss @Yaakov I am curious as to why you chose to use a 3.3V power pin instead of a 5V power pin for this? Used Arduino's for a few years and yet to start into PI's and don't think I have ever used a 3.3V power pin. Know it is there, and useful for when you might have a 3.3V device which I can't ever remember using. Usually, most of the devices I work with have a 5V or higher voltage requirement. Plus, 5V will give you a bit more overhead than 3.3V and I'm not trying to save energy experimenting. Know Yaakov has been using PI which is why I also directed this to him. Simply curious...
Raspberry Pi GPIO pins are NOT 5-volt tolerant, so connecting an LED tied to +5v will make the Pi unhappy.
 

old_beggar

Joined Jan 29, 2021
39
I think whoever said that the TS's LED looks like a white one in a red casing is right - it looks more like orange, unless it is being driven too hard. If you burn something out, you will eventually have to buy a new one, so IS important IMHO.

Personally, I would never drive anything at its limit (even if the datasheet specifies "continuous") - I would have gone for 10mA (=130 ohm, a value in the E24 series, which I assume the TS has, based on their photo...).

I wonder if it is not a good idea to pull too much current from the Pi (as per previous post)?

Maybe the TS would like to make a basic power supply for further experimentation? It could be from batteries, for safety, or mains (with the relevant skills). Perhaps he or she could let us know.
 

MisterBill2

Joined Jan 23, 2018
18,167
Rseries = (Vs - Vled) / Iled

Vled = Vf

Vf is the forward Voltage drop and it is around 2.1V for standard red led like say it is 0.7V for a general purpose Si diode.
I am doing the check using a regulated adjustable poer supply with the current display of my MM in series. Reading the voltage atthe supply with a second meter. So no series resistor needed for this check setup. I set the current by adjusting the voltage. Quite a handy scheme. These LEDs are arranged in series strings of 24 in each string, about 75 volts.
These are cool-white LEDs and at full output run a lot more that 20 milliamps. They are not RED.
 
Top