1
\$\begingroup\$

I'm new to electronics, so I thought I'd start simple and just connect an LED to the GPIO on the raspberry pi, to pin 1 (3.3v) and the ground pin. But I'm having trouble calculating the resistor I need. On many websites it says the resisitor I need is about \$300\Omega\$, such as this one here, but none of the websites explain how to get to this value. I did physics at school and used the formula \$V=IR\$, and know that current is the same in all places in a series circuit.

The LED I have didnt come with any data, but looking on the Internet it suggest that the voltage drop across green LEDs is about 2.2v, and the max current is 20mA.

So the resistor will have a drop of 1.1v (the 3.3v from the source minus the 2.2v dropped across the LED), and the current through it should be 0.02A, so I did:

$$R=\frac{V}{I}$$ $$R=\frac{1.1}{0.02}=55\Omega$$

which is nothing like the \$300\Omega\$? what am I doing wrong or misunderstanding?

\$\endgroup\$
1

1 Answer 1

1
\$\begingroup\$

As the question does not specify type of LED is to be used, here are some guidelines that work in general:

Forward voltage of LED, Vf differs by color. Look up the typical voltage for your LED from this Wikipedia link. Green is listed as 1.9 to 4.0 Volts, but they most commonly come in two types: Around 2.1-2.2 Volts, and around 3.2 to 3.6 Volts, depending on junction chemistry.

LED types:

  • High intensity "power" or "Illumination" LEDs, most typically white or warm-white, can often be rated for 100 to 500 mA, even more, and they look pretty massive, often flat and square with 5 to 10 mm sides, sometimes 4 pins or contacts instead of 2, sometimes with a thermal pad at the bottom.
  • "Normal" indicator type through-hole LEDs are usually 3 or 5 mm and rounded, typically rated for 20 mA
  • Some very small (0402 and smaller) SMD LEDs are rated for just 5 mA.
  • Infrared LEDs are often rated for much higher (2x to 10x) the current of the above variants.

Nominal current of typical indicator LEDs is generally 20 mA, but they illuminate almost equally well (to the eye) at less than half that value, so let's stay with 5 mA for now.

So, for green, let is stay with the stated 2.2 Volts. If it were a 3.4 Volt LED it would not light at all, or very dimly, from the 3.3 Volt supply, so you'd know.

Of the source Voltage, this Vf will be dropped across the LED at nominal current. Hence, the limiting resistor must drop the difference.

Hence:

R = (V - Vf) / I
= (3.3 - 2.2) / 0.005
= 220 Ohms

This is a standard E12 series resistor value, so we're good.

Using the values mentioned in the question, we get:

R' = (3.3 - 2.2) / 0.02
= 55 Ohms

Nearest standard E12 series resistor value = 56 Ohms, so use that.

You are not misunderstanding anything except a possible calculation on the basis of less than 5 mA drive current, and a possible Vf calculation for standard red LEDs.

\$\endgroup\$
8
  • \$\begingroup\$ I said green, but what do you mean type? it is 5mm? and you got values like the one I got, why does everyone else get values in the order of 300 ohms? \$\endgroup\$
    – Jonathan.
    Commented Jul 20, 2013 at 17:01
  • \$\begingroup\$ Fixed. See additions to answer. \$\endgroup\$ Commented Jul 20, 2013 at 17:16
  • 1
    \$\begingroup\$ @Jonathan.: The 300 ohms is probably based on a 5 volt supply, and 10 mA LED current. The maximum current rating for typical LEDs is 20 mA, but they can be used at any current less than that. I usually aim for 10 mA, as most LEDs are bright enough at that current. I would only use the maximum current if I really needed the maximum brightness. \$\endgroup\$ Commented Jul 20, 2013 at 17:18
  • \$\begingroup\$ I agree with @PeterBennett - Sometimes 20 mA indicator LEDs can be painfully bright. I've always preferred 5 to 10 mA. 5mA is my standard for SMD designs, that way I am unlikely to ruin even the most low-current LED. \$\endgroup\$ Commented Jul 20, 2013 at 17:21
  • \$\begingroup\$ thanks that helps a lot!, if I were to connect the LED without a resistor, where would the other 1.1v drop come from? \$\endgroup\$
    – Jonathan.
    Commented Jul 20, 2013 at 17:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.