robonerd137
Posts: 1
Joined: Mon Jul 01, 2013 7:07 pm

Hi...

i am trying to understand basic electronics so i don't need to only copy projects i see on the internet, but also be able to create my own.
So, my problem is that i am trying to figure out how to find the right Resistor to use with LEDs.

I know about the Ohm's Law: V=IR and i though i should be able to use it to find the R value.
But my problem is that i have the LEDs for reaaaaaaally long time and i have no idea about any of it's values.

I have read often that a average LED takes about 20mA current.
So it would make something like:
V = I R
R = V / I
R = 5 / 0.020
R = 250 Ohm

right?

But what if i don't know the I from the LED, how can i find that out?

R = (Es - Eled) / Iled

Es - source voltage (V)
Eled - voltage drop across the LED (V),
Iled - current through the LED (A)

Would it be better to use this formula?

Thanks...
=)

rpdom
Posts: 15353
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

### Re: Simple question about resistors

The second formula is correct. The voltage across the resistor is the supply voltage minus the voltage across the LED. So V in your V = IR should be (Vsupply - Vled).

Using a 5V supply (do remember that the Pi uses 3.3V for the GPIOs, not 5V!) and a 20mA 2V red LED as an example.

Vsupply = 5
Vled = 2
I = 0.02 (20 mA)

V = IR or V/I =R

(5 - 2) / 0.02 = R

3 / 0.02 = R

150 = R

For 3.3V it would be (3.3 - 2)/0.02 or 65 ohms, but you don't want to be taking that much current from a gpio. Most LEDs will work down to around 5mA (especially the low current ones), so 150 ohms would give about 8.7mA on a 3.3V supply.