Page 1 of 1

Resistors and LEDs

Posted: Mon Aug 11, 2014 2:02 pm
by lawsie
Hello,

I have been playing around with LEDs just as we did in Picademy. We didn't use any resistors, but I have read other tutorials and sites which suggest you should definitely do this to prevent damage to your Pi/blowing up the LEDs.

I am using a breadboard to connect LEDs to the GPIO pins on the Pi.

1. What resistors should I be using?
2. How come we didn't use resistors in Picademy and it still worked - is it just because we only did it for a really short time, or is it not necessary for this particular case for some reason?
3. Does the resistor connect from the numbered row in the breadboard to the negative column?

Many thanks :)

Laura

Re: Resistors and LEDs

Posted: Mon Aug 11, 2014 2:13 pm
by mikronauts
Were you connecting directly to the Pi's pins?

Maybe you were using a breakout board or development board that already had current limiting resistors on it (like http://www.mikronauts.com/proto/schoolboard/ )

I'd recommend 470 ohm resistors to limit the current to the LED's as a good "generic" number.

It basically depends on the LED's you are using, the "forward voltage drop" and "maximum current" are the relevant pieces of information, along with 3.3v as the voltage from the Pi I/O's.

See http://en.wikipedia.org/wiki/LED_circuit

There is an on-line calculator at

http://led.linear1.org/1led.wiz

Enter 3.3v for source voltage, 1.7v for voltage drop, and 4mA for current... and you will get 470ohms as the desired resistor value

I chose 4mA as that is enough for efficient LED's, and the Pi is only rated to supply 50mA @ 3.3v

Hope this helps!

Re: Resistors and LEDs

Posted: Mon Aug 11, 2014 2:26 pm
by lawsie
Thanks - no we were not using any breakout board or indeed any breadboard at all, just wires and the LEDs.

The LEDs I am currently using are some dodgy cheap ones from Amazon. The specs say:
Forward Voltage : 2.0 - 2.2V
Max Continuous Forward Current : 20mA

http://www.amazon.co.uk/gp/product/B008 ... uctDetails

I plugged in those numbers and it suggested a 68ohm resistor but I have no idea whether that is sensible or not. :)

Re: Resistors and LEDs

Posted: Mon Aug 11, 2014 2:44 pm
by rpdom
You don't need to run the LEDs at the Max Forward Current, that's just the highest they can handle. 4 or 5mA should be enough to get them to light up well enough to see clearly.

3.3V - 2.0V = 1.3V

5mA = 0.005A

1.3V / 0.005A = 260 Ohms. The closest standard resistor to that is 270 Ohms, which is close enough :)

Re: Resistors and LEDs

Posted: Mon Aug 11, 2014 2:50 pm
by mikronauts
You were living dangerously, I would not recommend doing that again.

For those LED's, I'd use 270 ohm like rpdom suggested, or even 330 ohm resistors.
lawsie wrote:Thanks - no we were not using any breakout board or indeed any breadboard at all, just wires and the LEDs.

The LEDs I am currently using are some dodgy cheap ones from Amazon. The specs say:
Forward Voltage : 2.0 - 2.2V
Max Continuous Forward Current : 20mA

http://www.amazon.co.uk/gp/product/B008 ... uctDetails

I plugged in those numbers and it suggested a 68ohm resistor but I have no idea whether that is sensible or not. :)

Re: Resistors and LEDs

Posted: Mon Aug 11, 2014 3:08 pm
by lawsie

Re: Resistors and LEDs

Posted: Mon Aug 11, 2014 3:10 pm
by Ravenous
I think the other posters are right about the suggested resistor values - I would try 470, but anything from 330 to even 1K. In fact the Magpi magazine must have some articles showng this, somewhere in the back issues.
lawsie wrote:2. How come we didn't use resistors in Picademy and it still worked - is it just because we only did it for a really short time, or is it not necessary for this particular case for some reason?
As well as the other suggestions, I have seen LEDs for sale that work directly from 5V - they either have a resistor or some other current limiter built in. (I don't know which - never used them as of course they're more expensive than normal LEDs!) So maybe something like that was used. Or perhaps the resistors were built into the wires and shielded with heatshrink - they would be very thin and not obvious. (Actually that may be a good thing to do if building kits for kids, etc.)

Re: Resistors and LEDs

Posted: Mon Aug 11, 2014 3:17 pm
by gordon77
yes, they are OK

Re: Resistors and LEDs

Posted: Mon Aug 11, 2014 3:22 pm
by rpdom
Yes, those will do. The price is reasonable but you might be hit by postage.

Otherwise eBay is a good source of value resistors. Here's just one example http://www.ebay.co.uk/itm/271271896522

Don't buy from Maplin unless you are desperate. They now charge £0.36 each for resistors (slightly cheaper for any quantity orders). I remember when they used to be the cheapest place to go and basic resistors were £0.0025 each (2 for 0.5p)

Re: Resistors and LEDs

Posted: Mon Aug 11, 2014 4:03 pm
by lawsie
Many thanks for the kind help on this topic everybody - this is a fantastic forum :)

Re: Resistors and LEDs

Posted: Tue Aug 12, 2014 3:17 am
by simplesi
Certain people (who should know better) play fast and loose with using LEDs in circuits without resistors :)

I personally recommend the 5V LEDs from CPC that have built in resistors for primary pupils

http://cpc.farnell.com/jsp/search/brows ... 1%2B207975

The downside is that most LEDs don't have resistors built in so they'll need re-educating later on but it makes breadboard a LOT easier. :)

Simon

Re: Resistors and LEDs

Posted: Thu Dec 29, 2016 3:29 pm
by spagi
Hi all,
I was reading this post and I was wondering what kind of circuit I need for this and my Pi 3:
http://eud.dx.com/product/5-5-0-2cm-diy ... -844423756

It mentions the following specs:
Display method: 3 LEDs LGP; Connecting method: 2 wires; Input voltage: 3.0~3.5V; Input current: 15~20mA; Bright and even effect

I am wondering if this needs a resistor or not. It seems that there are 3 leds already in there in some sort of connection. I assume that the input voltage that it mentions is the diode forward voltage, so by using the calculator (source 3.5V, fw voltage 3V and current 15mA) I get a value of 39ohms. Am I doing this right? If I understand correctly, because of the 3 leds, it needs quite some current (thus small resistor) to work on the specified brightness.

Thank you in advance!

Re: Resistors and LEDs

Posted: Thu Dec 29, 2016 5:43 pm
by Burngate
spagi wrote:... I get a value of 39ohms. Am I doing this right?
Possibly.
But putting 39Ω in series with it shouldn't hurt.

There's not enough information to make anything but a wild guess, but ...

Blue LEDs have higher forward voltage than other colours, and three in series would have way more than 3-3.5v, so it's likely they're in parallel

If that's right, and it's happy with 3.0~3.5V and 15~20mA, it's possible that increasing the voltage by 0.5v increases the current by 5mA.
That could mean it has a resistance of (0.5/5=) 0.1k, or 100Ω, in series, or it could be that their figures are just estimates, so my calculation is just moonshine :)

If it does have 100Ω built in, then putting 39Ω also in series will just make it dimmer.
If it doesn't, then 39Ω in series will save it from distructtion.

Re: Resistors and LEDs

Posted: Thu Dec 29, 2016 9:36 pm
by spagi
Thanks for the reply! Indeed the specs are not very clear. I hope that when I receive it a more detailed code will help me find the exact specs.

I think the conclusion from what we know is that adding the resistor will only make it dimmer in worse case. Better safe than sorry I guess!

Re: Resistors and LEDs

Posted: Tue Jun 27, 2017 10:21 pm
by OutsourcedGuru
For those who want to exercise an LED on a Raspi and not have to color code a resistor, I've got a repository which will allow you to toggle the internal LED on the board itself. So, no breadboard, no resistor, no LED legs to figure out, no wires...

https://github.com/OutsourcedGuru/gpiozero-toggle-led