stingerssx
Posts: 18
Joined: Sat Jan 24, 2015 6:47 am

How to hook up a power LED?

Thu Feb 12, 2015 8:29 pm

So, I'm trying to put a Pi into an NES and I want to use the original power button and LED. I want to change out the red LED for a blue one. I have the blue one laying around, (meaning I don't remember where it came from) but it lights up with a 2032 button cell. So I'm under the impression that it's a 3.5v LED. I originally was wondering if I could just run it off the 5v power supply that I'm splicing in the button. But I'd rather run it off the GPIO if possible. I'm hoping that I could just hook it up to the ground and one of the 3.3v pins. Can I do this without any additional scripts?

jimallyn
Posts: 51
Joined: Wed Nov 12, 2014 9:13 am

Re: How to hook up a power LED?

Thu Feb 12, 2015 9:21 pm

You will definitely want to put a resistor in series with the LED. Otherwise, you could draw too much current from the GPIO and destroy the processor. If you don't have specs on the LED you want to use, you should start with a higher value resistor, then work down in value until the LED is as bright as you want it to be.
“So you say you love the poor? Name them.” - Gustavo Gutierrez

User avatar
mad-hatter
Posts: 419
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the UK seaside

Re: How to hook up a power LED?

Thu Feb 12, 2015 11:26 pm

Hello,

You shouldn't drive a led directly from a GPIO pin.
They can only supply a nominal 8ma. (maximum 16ma.) at 3.3Volts.
A blue led typically needs a voltage of about 3.3Volts, where as a red led
needs a voltage of about 1.8Volts. the typical current draw for a LED is about 20ma..
You will KILL the GPIO pin and maybe the Pi itself.
A LED must have a series resistor to limit the current drawn.
You should use some sort of driver that will take the current.

Regards

klricks
Posts: 6591
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How to hook up a power LED?

Fri Feb 13, 2015 12:02 am

mad-hatter wrote:Hello,

You shouldn't drive a led directly from a GPIO pin.
They can only supply a nominal 8ma. (maximum 16ma.) at 3.3Volts.
.....
...
You will KILL the GPIO pin and maybe the Pi itself.
A LED must have a series resistor to limit the current drawn.
You should use some sort of driver that will take the current.

Regards
I think the OP wants to connect to the 5V or 3V3 rails that are available on the 40 pin GPIO header which are not actually GPIO's.... so they don't have the same constraints.
IIWMIW use the 5V rail and appropriate resistor. But remember the LED will always be on as long as power is connected even when the RPi is shutdown.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

stingerssx
Posts: 18
Joined: Sat Jan 24, 2015 6:47 am

Re: How to hook up a power LED?

Fri Feb 13, 2015 1:49 am

Yeah, what I want is for the LED to be lit when ever the power button is on. Which would in turn send power to the Pi. Then when finished, I can shutdown the Pi, and turn off the power button. Then the LED can go off.

How would I know how much resistance to add? Trial and error?

User avatar
DougieLawson
Posts: 36130
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: How to hook up a power LED?

Fri Feb 13, 2015 1:55 am

stingerssx wrote:Yeah, what I want is for the LED to be lit when ever the power button is on. Which would in turn send power to the Pi. Then when finished, I can shutdown the Pi, and turn off the power button. Then the LED can go off.

How would I know how much resistance to add? Trial and error?
1. All of my raspberry pis already have a LED on the board that glows a pretty shade of red when the power is applied.
2. 560Ohm in series with the LED.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

stingerssx
Posts: 18
Joined: Sat Jan 24, 2015 6:47 am

Re: How to hook up a power LED?

Fri Feb 13, 2015 6:01 am

1. All of my raspberry pis already have a LED on the board that glows a pretty shade of red when the power is applied.
Mine too, but it'll be of little use when it's inside a closed NES. Also, I'm building this for my cousin, and he wants a blue LED instead of the original red that is in the NES.

2. 560Ohm in series with the LED.
Thank you. I'll see if I have any. If not, Radioshack is going out of business!

User avatar
DougieLawson
Posts: 36130
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: How to hook up a power LED?

Fri Feb 13, 2015 8:40 am

stingerssx wrote:
1. All of my raspberry pis already have a LED on the board that glows a pretty shade of red when the power is applied.
Mine too, but it'll be of little use when it's inside a closed NES. Also, I'm building this for my cousin, and he wants a blue LED instead of the original red that is in the NES.
Use an optical fibre or perspex tube as a light pipe.
https://www.youtube.com/watch?v=k5_AlNO7_m8

Blue LEDs may not run off a GPIO you need to check the forward voltage is under 3V3.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

stingerssx
Posts: 18
Joined: Sat Jan 24, 2015 6:47 am

Re: How to hook up a power LED?

Sat Feb 14, 2015 12:32 am

Good idea, not really too bright, but also not exactly what I'm going for.
As for fiber optics, the NES already uses it. Anyway, it's really easy to just replace the LED itself. And it looks more original.

stingerssx
Posts: 18
Joined: Sat Jan 24, 2015 6:47 am

Re: How to hook up a power LED?

Sun Feb 15, 2015 12:49 am

Well, thank you all. I ended up hooking it up to the 5v power instead. I didn't have the correct value resistor. I'm not sure what value it is. Orange, orange, red, gold I think. I can't really see it too well. Plus I'm a bit color blind as it is. But the LED isn't too bright, and I comes on when the button is pressed, and goes off when it's pressed again. Couldn't ask for more!

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

Re: How to hook up a power LED?

Sun Feb 15, 2015 9:47 am

Orange, orange, red would be 3K3, with the gold band being the tolerance (accuracy). Quite a high value for your LED.

If your LED had a 2.0V forward voltage, then the resistor would be dropping 3V, meaning 3/3300 = 0.0009A or 0.9mA. That would give you a very dim LED.

To work out a better resistor value, measure the voltage across the LED while it is on (with the resistor in place). It will probably be around 2V but you want to find out to the nearest 0.1V if you can. Then you decide how much current you want to give the LED. 20mA would be full brightness, 10mA quite bright, 5mA medium and less than that progressively dimmer.

Convert mA to A by dividing by 1000. (10mA = 0.010A).

Subtract the LED voltage (you measured) from the supply voltage (5V) to give the resistor voltage.

Divide the resistor voltage by the LED current and you get the "ideal" resistor value. Find a resistor that is fairly close to that value.

Example: 1.8V LED, 6ma.
LED current is 6/1000 = 0.006 A
Resistor voltage is 5.0 (supply) - 1.8 (LED) = 3.2 V
Resistor value = 3.2 / 0.006 = 533 Ohms.
Closest standard values to that are 470 Ohms or 560 Ohms. 470 will be slightly brighter at 6.8mA and 560 will be slightly dimmer at 5.7mA. You probably won't even notice though :)

stingerssx
Posts: 18
Joined: Sat Jan 24, 2015 6:47 am

Re: How to hook up a power LED?

Sun Feb 15, 2015 5:08 pm

Yeah, I know the value, I was just kidding. I looked up the resistor color code in my old electronics book. I wasn't kidding about not being able to see the colors though. It's an older resistor, so the orange actually could be red! But the resistor is just something I had lying around. I tried it, and it worked. I Did check the voltage, and it's at 3.2 volts. Close enough to 3.5 and that's not knowing the actual specs of the LED. Its also perfectly bright. Being a newer LED, it's brighter than the original. Perfect fit.

Return to “Beginners”