GrixSilva
Posts: 10
Joined: Thu Aug 15, 2019 11:42 pm

Hi!

I would like to connect a LED to my raspberry pi, So I made some research and I found out if I have a low voltage LED I should use a resistor,
So I have here some LEDs, with a voltage of 2,2 ... 2,5v,
and I've here some resistors, 10k, 1k and 220R
I would like to know wich resistor should I use to not blow up my led (or my board )

Another question...
I saw some videos where they use some LEDs with high voltage, like 12v so they don´t need a resistor... My question is, since the PI only gets 5v, using a 12v LED wouldn't cause problems such as low voltage warnings?

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

The GPIO outputs on the Pi use 3.3V. They wouldn't be able to drive a 12V LED properly.

For other LEDs you can work out a suitable resistor value based on the difference between the GPIO voltage and the LED voltage and the Current the LED will use. The GPIOs are best at under 12mA and the total draw from all of them shuldn't be more that 50mA.

To calculate the approximate resistor value you need the GPIO voltage Vgpio (3.3V), the Current I (say 5mA = 0.005A), and the LED voltage Vled (2.2V in your first example)

The formula is then (Vgpio - Vled) / I

(3.3 - 2.2) / 0.005 = 220

So your 220 Ohm resistors would be fine for those LEDs.

Imperf3kt
Posts: 2762
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

This may help understand the science behind it.
https://www.petervis.com/electronics/le ... lator.html

Typically, LEDs are in the 3v range, but using a lower voltage won't harm them.
Your common "12v LED" is typically just four LEDs in series.

It's a good idea to always make sure you know the forward voltage.
This explains how to find that on unmarked LEDs
https://www.instructables.com/id/Determ ... s-of-LEDs/
55:55:44:44:4C
52:4C:52:42:41

GrixSilva
Posts: 10
Joined: Thu Aug 15, 2019 11:42 pm

When you said:
rpdom wrote:
Sun Sep 08, 2019 10:00 pm
the Current I (say 5mA = 0.005A),
This 5mA is the corrent provided by the PI or the forward current of the LED?

Burngate
Posts: 6002
Joined: Thu Sep 29, 2011 4:34 pm
Contact: Website

That current is provided by the Pi, and it's value - 5mA - was decided by rpdom.
To make sure that was the current, he calculated the correct resistance to put in series.

If he'd wanted more current - say 10mA - he'd have put 0.01 into his equation instead of 0.005, and out would have popped 110 ohms for the resistance.

If you then found a 110 ohm resistor and used that instead of 220 ohms, then hey presto, the LED would be (about) twice as bright!

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

GrixSilva wrote:
Mon Sep 09, 2019 10:21 am
When you said:
rpdom wrote:
Sun Sep 08, 2019 10:00 pm
the Current I (say 5mA = 0.005A),
This 5mA is the corrent provided by the PI or the forward current of the LED?
The listed forward current of the LED is a recommended value. Usually you can run them much lower that that as long as the voltage is correct.

In the example I gave, the GPIO will be providing 5mA and the forward current of the LED will also be 5mA (even if it is rated higher).