dman777
Posts: 5
Joined: Sat Mar 14, 2015 7:44 pm

LED for Pi 2 - 3.3v or 5v?

Sat Mar 14, 2015 7:46 pm

I want to use 2 led's for a Pi 2.... can I use 5v or does pi 2 only output 3.3v?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9653
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: LED for Pi 2 - 3.3v or 5v?

Sat Mar 14, 2015 8:12 pm

LED' are neither 3.3V or 5V, with the rare exception of LED's which have an internal series resistor calculated for 3.3V or 5V. A "5V LED" can still be connected directly to a GPIO, but its brightness will be diminished.


LED's are actually Diodes, so they need a certain voltage before they start to conduct, (the "forward voltage") this voltage mostly depends on the LED's light wavelength, with longer wavelengths (shifting to RED) associated with lower forward voltages (around 2V) and LED's with shorter wavelengths (shifting towards BLUE) having somewhat higher forward voltages (around 3V).

As DIODES they need a series resistor to actually limit the current flowing through them, typically from 1mA (high efficient) to 10mA (some older LEDs). To calculate the resistor voltage you take the feeding voltage, say 5V, and subtract the LED's forward voltage, so you get the voltage over the resistor. Then its just Ohms law, R=U/I (or R=V/I depending on which notation you use).

example a high efficiency RED LED on 5V. So:
V = 5V
V Forward = 2V
I = 1/1000 A = 1mA = 0.001A
thus R = (V - V Forward) / 0.001 = 3 /0.001 = 3000 Ohm, or 3K

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 4143
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: LED for Pi 2 - 3.3v or 5v?

Sat Mar 14, 2015 8:13 pm

dman777 wrote:I want to use 2 led's for a Pi 2.... can I use 5v or does pi 2 only output 3.3v?
The GPIOs on all Pis output 3.3V (logic level 1 or "high"). However you need to limit the current flowing through a LED with a resistor whether it's connected to a GPIO and 0V (active high) or a GPIO and 3.3V (active low), the "other way around" (remember, it's a Light Emitting Diode). FWIW, some typical resistor values etc. can be seen in this simple circuit used to monitor a Pis supply rails and the Rx & Tx (serial port) GPIOs:
http://www.cpmspectrepi.webspace.virgin ... ector.html
Trev.
Usually running Raspbian Jessie on up to 9 of 13 Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) and Stretch on my P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
pluggy
Posts: 3636
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: LED for Pi 2 - 3.3v or 5v?

Sun Mar 15, 2015 10:01 am

Just don't expect a blue or white LED to work at 3.3 volts.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 4143
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: LED for Pi 2 - 3.3v or 5v?

Sun Mar 15, 2015 12:04 pm

pluggy wrote:Just don't expect a blue or white LED to work at 3.3 volts.
Probably depends on the LED - I have some 3mm blue leds that are fine (see the link in my previous post). Tend to agree w.r.t. white LEDs but, then again, nokia-style lcd's with "white" backlights seem to work fine with 22ohms in series (from the 3.3V supply rail) or via a transistor buffer:
http://www.cpmspectrepi.webspace.virgin ... lcdV2.html
Trev.
Usually running Raspbian Jessie on up to 9 of 13 Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) and Stretch on my P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9653
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: LED for Pi 2 - 3.3v or 5v?

Sun Mar 15, 2015 12:10 pm

"white" leds, are simply blue leds, with a dot of (yellow) phosphorous that converts blue light to yellow light, to fill in the colour spectrum (real white leds do not exist, but sometimes three (RGB) leds are used to produce "white")
blue leds have a typical forward voltage of 3V, so yes, they can be used with a 3V3 source, but as the series resistor only has 0.3V to "work with", any variation on the 3V3 voltage will cause an uncommonly large current variation, thus the led might not give out a stable light intensity.

boyoh
Posts: 1045
Joined: Fri Nov 23, 2012 3:30 pm

Re: LED for Pi 2 - 3.3v or 5v?

Sun Mar 15, 2015 4:22 pm

A standard red led will give a good light with 1.8/ 2v
dropped across it. and a current of 0.01ma ( 10ma )

GPIO o/p 3.3V+------------( 130R )-----(a led k )-----0v-

5v+--------( 300R )-----------( a led k )------------------0v-

3.3v - 2v = 1.3v / 0.01ma = 130r

5v - 2v = 3v / 0.01ma = 300r
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

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

Re: LED for Pi 2 - 3.3v or 5v?

Sun Mar 15, 2015 6:01 pm

boyoh wrote:A standard red led will give a good light with 1.8/ 2v
dropped across it. and a current of 0.01ma ( 10ma )

GPIO o/p 3.3V+------------( 130R )-----(a led k )-----0v-

5v+--------( 300R )-----------( a led k )------------------0v-

3.3v - 2v = 1.3v / 0.01ma = 130r

5v - 2v = 3v / 0.01ma = 300r
I think you may have put m's where you didn't mean to?

boyoh
Posts: 1045
Joined: Fri Nov 23, 2012 3:30 pm

Re: LED for Pi 2 - 3.3v or 5v?

Sun Mar 15, 2015 10:17 pm

Burngate wrote:
boyoh wrote:A standard red led will give a good light with 1.8/ 2v
dropped across it. and a current of 0.01ma ( 10ma )

GPIO o/p 3.3V+------------( 130R )-----(a led k )-----0v-

5v+--------( 300R )-----------( a led k )------------------0v-

3.3v - 2v = 1.3v / 0.01ma = 130r

5v - 2v = 3v / 0.01ma = 300r
I think you may have put m's where you didn't mean to?
Thanks for correcting me, I've lost count
the times I made the same mistake
My regards to Burngate.

BoyOh
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 53 guests