Can someone explain why LED lights need resistors when connecting to pi. The raspberry Pi is either providing 3.3v or 5v depending on if it's connected to power pins or gpio pins. Your set up would depend on the LED(Cathode or Anode). If the LED supports up to 5 volts why do u need a resistor? Previously I hooked up an Ultrasonic Senor. The pi's general gpio pins only support 3.3v. Therefore needed to hook a resistor from senors trig pin to pi general gpio(input). This is because the Ultrasonic Senor needs 5v to operate. If I am sending a 3.3v signal from pi to LED light then why does it need a resistor before goes to ground?
Asked
Active
Viewed 1,588 times
1
-
1Oh does it have something to do with current? – sirshakir Feb 20 '19 at 16:53
-
how is the ultrasonic sensor related to your question? – jsotola Feb 21 '19 at 02:11
-
Diode does not behave linearly (Ohms law). At 1V it is >100MegaOhm, at 1.7V (varies) it is effectively 0ohm short circuit (not quite but for purposes of burning a GPIO it is close enough) and gets even lower as voltage increases. There are equations to determine the equivalent resistance, but you can see how when you turn on a diode by increasing the voltage applied, at some point it becomes a short circuit. One typically uses a resistor to limit short circuit current per ohms law. But other things are possible including fast PWM taking advantage of the intrinsic capacitance if a diode. – crasic Feb 21 '19 at 18:27
1 Answers
3
A LED only needs between 1.6 V and 3.6V. If you supply a higher voltage the current would increase more than it is good for the LED.
Every Diode (and also an LED) is not linear, that means if the voltage is to high the current would be higher than
- the current that can be supplied by the Raspberry PI (which could damage the PI)
- the current allowed for the LED (which could damage the LED)
For a more in-depth background look at https://www.electronics-tutorials.ws/diode/diode_8.html

Uwe Plonus
- 232
- 2
- 9
-
-
This answer is misleading. LED forward voltage drop depends on LED material and doping and ranges from ~1.3V (infra-red) to ~3.6V (blue) - more for same exotic types. See https://en.wikipedia.org/wiki/LED_circuit – Milliways Feb 21 '19 at 05:16
-
@Milliways I added a link where the forward voltage is also listed. – Uwe Plonus Feb 21 '19 at 17:20
-
I'd go stronger than @Milliways. This answer is blatantly wrong in multiple respects, including: 1. What Milliways said, 2. LEDs do NOT require a resistor in general (constant current sources, internally limited currents sources, for example, require no resistor). – Brick Feb 21 '19 at 19:22
-
@Brick: The question is clearly related to connecting a raspberry and how to connect a LED to an IO pin. I gave a practical answer. I know that I can drive a LED with a constant current source. In practice you will not use a constant current source but use a resistor to limit the current through a diode (and I talk about any diode, not only LED) because the cost and effort to create a constant current source is in most cases overengineering. I know that there are use cases (like creating high precise current or voltage sources) where a constant current is needed. – Uwe Plonus Feb 22 '19 at 17:05
-
@Brick: But in this case you should thoroughly select the diode and create the characteristic curve of the diode by yourself because the tolerance of the generic curve of the manufacturer is either not precise enough or you pay much more for this diode than for a simple LED. So I know that a constant current source can be used for LEDs but this is not what the original questioneer asked for. You are free to answer such a question with the physical background, but you did not do this and instead only comment that my answer is wrong! – Uwe Plonus Feb 22 '19 at 17:10
-
In addition to noting this answer is wrong, I flagged it duplicate. Hence it's not appropriate for me to provide a second answer. Regarding the rest of your rant, it's not about what you know but what an average reader who lands on this page (presumably because they don't know what you appear to know) will take from the question and answer. – Brick Feb 22 '19 at 17:12