nujabespi
Posts: 5
Joined: Thu May 15, 2014 9:39 am

Raspberry LED brightness problem.

Thu May 15, 2014 9:44 am

Hey there,

I have a problem with getting the maximum brightness out of my LED. I use python to program the LED.

When I put my ground cable and 3.3V on my breadboard, the LED's brightness is high .. BUT when I use ground and GPIO.input .. the LED's brightness is not as high (without resistors).

For my project I need a real good brightness of my LED. The brightness of the ground + 3.3V is perfect.


Here is the code I used (% is on 100):

import RPi.GPIO as GPIO

led_pin = 18

GPIO.setmode(GPIO.BCM)
GPIO.setup(led_pin, GPIO.OUT)

pwm_led = GPIO.PWM(led_pin, 500)
pwm_led.start(100)

while True:
duty_s = raw_input("Enter Brightness (0 to 100):")
duty = int(duty_s)
pwm_led.ChangeDutyCycle(duty)

User avatar
Burngate
Posts: 6313
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Raspberry LED brightness problem.

Thu May 15, 2014 11:35 am

nujabespi wrote:... (without resistors) ...
Not a good idea!

When you connect the LED to 3v3 directly, it will take whatever current the regulator can supply
The GPIOs can only supply a limited amount of current - as default, that's 8mA though it can be set to 16mA - before their voltage drops significantly.
Also, if you consistently take too much, you could burn out the driving circuitry in the SoC.

You should put in a series resistor to control the current. If you want more than a few mA, consider a transistor and a separate supply.

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: Raspberry LED brightness problem.

Thu May 15, 2014 11:42 am

If you want to drive this LED correctly, we need to know what it's rated forward voltage drop is, and what it's recommended running current is. If you can provide that information then we can come up with a suitable solution.
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

nujabespi
Posts: 5
Joined: Thu May 15, 2014 9:39 am

Re: Raspberry LED brightness problem.

Thu May 15, 2014 11:54 am

Thanks for your reply !

Well to give you guys more information about the actual situation .... :

For our project, we actually have 3 buttons with integrated LEDS. The buttons work fine, and also 2/3 leds shine bright.

Button 1: Has yellow LED, really weak brightness (It's yellow, ofcourse this isn't a strong color, but it still could shine brighter. <- This is the problem

Button 2: Has red LED, works fine.
Button 3: Has blue LED, works fine.

The specs of the yellow LED:

T10 LED 3.3V (LINK: http://www.arcadewinkel.nl/t10-led-3.3v-geel)

The button itself (with the integrated LED: http://www.arcadewinkel.nl/besturing/dr ... utton-geel)

I hope you guys can help me out ! :ugeek:

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: Raspberry LED brightness problem.

Thu May 15, 2014 12:01 pm

You're going to need more than a 3V3 supply to run the LED from then to have any hope of controlling the current through it. Assuming you want, say, 20mA for it, the following circuit would work just fine...

Image

Almost any NPN transistor with a gain of 100 or more would work in this circuit.
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

nujabespi
Posts: 5
Joined: Thu May 15, 2014 9:39 am

Re: Raspberry LED brightness problem.

Thu May 15, 2014 12:23 pm

Woah thanks !

Just a quick question to be sure i was clear about the problem,

We have 3 buttons, they are all the same as this one: http://www.arcadewinkel.nl/besturing/dr ... utton-geel (only the other 2 are different from color)

With the circuit provided, I should be OK ?

THANKS !!

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: Raspberry LED brightness problem.

Thu May 15, 2014 12:34 pm

If the LED wires come out separately from the switch contacts, yes. You may need to adjust the 82R position resistor values for each colour to achieve matching intensity though.
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Raspberry LED brightness problem.

Thu May 15, 2014 12:37 pm

Hi,
nujabespi wrote:For our project, we actually have 3 buttons with integrated LEDS.
Since these buttons/LEDs are specified for 3.3V, most likely they include limiting resistor...

By the way (& for your info): some LEDs contain embedded resistor, which is not visible and that LED looks like ordinary one.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: Raspberry LED brightness problem.

Thu May 15, 2014 12:46 pm

FLYFISH TECHNOLOGIES wrote:Since these buttons/LEDs are specified for 3.3V, most likely they include limiting resistor...
Maybe. Maybe not. I'd want confirmation either way before connecting one directly to a GPIO pin.
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Raspberry LED brightness problem.

Thu May 15, 2014 1:48 pm

Hi,
GTR2Fan wrote:
FLYFISH TECHNOLOGIES wrote:Since these buttons/LEDs are specified for 3.3V, most likely they include limiting resistor...
Maybe. Maybe not. I'd want confirmation either way before connecting one directly to a GPIO pin.
I mentioned limiting resistor... I haven't discussed what current it limits to. ;-)

To eliminate any potential doubts: if the LED can be connected directly to 3.3V, it does not mean that GPIO can supply it -> take a parallel case with motors: you don't want to connect 3.3V motor directly to GPIO output pin.
What you need to check is what is the current. Connect the LED to 3.3V (power rail) and measure the current...


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

Return to “Beginners”