electronics:leds

# Leds

## Physics

The second law of Kirchhoff states that the sum of voltages in a circuit is equal to the voltage of the source.

$E=∑(IR)$

Let's take an example:

We have a 3V source and three resistors of different resistance. The sum of voltage drops on each of them is equal to the source voltage.

$R1 + R2 + R3 = VCC1 => 0.25v + 1.25v + 1.5v = 3v$

Ohm's law states that the electric current that passes through a conductor between two points is directly proportional to the potential difference across the two points.

$I = \frac{U}{R}$

A diode is an electronic component that has a positive and a negative side and it basically allows the current to flow only in one direction, from positive to negative.

The LED is also a diode. When current is flowing through the LED, it lights up. So in order to light up a LED you need to put the high voltage at the anode and the low voltage at the cathode.

## Schematics

To light up a LED we need this circuit:

There’s only one tiny problem with this one: it is a short circuit. That means there is no resistance to limit the current because the diode doesn't have any resistance at all. It just allows the current to flow, remember? That can cause big problems (you can damage your Raspberry Pi, for example). To fix this, we need a resistor.

What value should my resistor have? (click for more details)

What value should my resistor have? (click for more details)

What value should my resistor have? (click for more details)

You can either use an online calculator or go the math way.

Using the second law of Kirchhoff we can calculate what value is needed.
Every LED needs a certain voltage and current to work properly. These can be found on your supplier's web site. Normally, a LED needs 2V and 20mA in order to light.

We know that U=IR and we want to know the value of the resistor so ⇒ R = U/I.

Let's take an example:

The supply source value is 3v and your led needs 2.0v and 20mA.

Using the second law of Kirchhoff we can say that the voltage drop on the resistor is 1V. And we also know that the led needs a 20mA (20mA = 0.02A). So we can state that:

R = (3 - 2) / (20 / 1000) = 500 ohms.

That's it! The resistor's value should be as close as possible to 500 ohms.