ambivalent
Posts: 18
Joined: Mon Jun 10, 2013 6:16 pm

GPIO Pin to LED

Thu Jun 13, 2013 2:10 pm

Hallo,

I was wondering if anything else is required to power an LED beyond setting the pin to output and high?
I have it set up exactly as it is pictured here: https://projects.drogon.net/wp-content/ ... ample2.jpg I'm fairly confident that the circuitry is correct, as I powered it from the 3.3v at Pin 1 prior.

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO Pin to LED

Thu Jun 13, 2013 2:43 pm

No.

Doesn't it light? Try switching the connections (LEDs are directional).

PiGraham
Posts: 3939
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: GPIO Pin to LED

Thu Jun 13, 2013 2:56 pm

You only need LED and resistor.
You can generally assume an LED will drop 2V.
The GPIO can drive max 16mA.
If you play safe and design for 10mA your resistor should drop 1.2V @ 10mA
R = 1.2/0.01 = 120R

If the resistor value is too high you won't see the LED light.
If it's too low you may blow your Pi.

Basics: Have you measured the voltage on the output when unconnected? Does it go to 3.3V?
Does the LED light if you connect it, with series resistor, direct to the 3.3V power rails?
Check the markings. Is the LED the right way round?
At 3.3V you can just try reversing the LED. At higher voltages watch the VR limit. You can blow LEDs quite easily

Grahameaston
Posts: 1
Joined: Sun Jun 02, 2013 5:06 pm

Re: GPIO Pin to LED

Thu Jun 13, 2013 3:42 pm

Hi
I am having the same problem . LED works coupled to the 3.3v supply and the program / file / script runs with no errors but the led will not light.
I have the correct GPIO module that I have downloaded and inserted the GPIO "cleanup to the pin I am using.

Any advice would be greatfully received

Graham

ambivalent
Posts: 18
Joined: Mon Jun 10, 2013 6:16 pm

Re: GPIO Pin to LED

Thu Jun 13, 2013 10:24 pm

It turns out it was my code. PIN 16 (the onboard LED) worked correctly, so I had (regrettably) assumed that other pins would work as well.

Return to “Bare metal, Assembly language”