# Electrickery/Projects/01 LED Light

Perhaps in school, you did an experiment with a battery and a light-bulb, to demonstrate the principle of an electric circuit.
Perhaps you didn't.
This is the very foundation of any electronic device - turning electrical energy into something else.
Instead of using a lightbulb, we use here a Light Emitting Diode. Diodes have the advantage of being smaller and cheaper than incandescent bulbs, and using considerably less energy to generate light.
Due to LEDs being somewhat sensitive to over-voltage (or, too much power being fed in), we must also use a resistor to reduce the voltage supply at the LED anode. This will be explained.

## Construction

This circuit can be wired up loosely, breadboarded, whatever. Construction is exceedingly simple.
* Hook up one side of the resistor (220Ω, or red-red-brown) to the anode (longer lead) on the LED.
* After you have made that connection, hook the cathode (shorter lead) of the LED to the negative (-) side of the power supply (usually black wire).
* To complete the circuit, hook up the remaining side of the resistor to the positive (+) side of the power supply (usually red wire).
If everything is working correctly, the LED should glow visibly.

## How it Works

Magic. Take a moment - reflect. You've just made electricity do something for you.
This is the simplest circuit possible, really. Energy leaves the power source, and lights an LED.
The resistor is present to protect the LED from drawing too much power, and thus burning itself out. It does this by restricting the flow of electrons. Unlike the LED, the resistor operates correctly in both directions.
The resistor value chosen is pretty much arbitrary, it should be safe for any LED that you put in this project. Once you work on bigger and better things, however, you'll need to use what is commonly known as Ohm's Law to calculate the resistor you need. The formula derived from Ohm's Law is V = (I × R) - V is voltage in Volts, I is current in Amperes, R is resistance value in Ohms(Ω)... however, in calculating the resistance necessary for a given LED, we modify the formula to be R = (V ÷ I) - the necessary resistor (R) is the value of the voltage drop desired (V) divided by the drawn current (I).
LEDs you purchase have two specifications - forward voltage (which will probably be between 1 and 3.5V), and current draw (which will be given in mA). Forward voltage refers to the difference in voltage between the anode and cathode. In order to ascertain the correct voltage drop for the above formula, we subtract this forward voltage from the voltage of the power supply - in this book, usually 5V.
Let's take a look at a LED with a forward voltage of 2.7V, and a current draw of 35mA. First, we need to convert the milliamperes to amperes, so that we can use our aforementioned formula. (35 ÷ 1000) gives us 0.035, and then we need to subtract the LED's forward voltage from the known power supply. (5 - 2.7) gives 2.3. Now that we have our current and voltage drop worked out, our formula looks like this: R = (2.3 ÷ 0.035) - telling us we need a 65.7143Ω resistor. Of course, this is absurd, so we simply choose the next-highest commonly available resistor, which should be 68Ω.

## Modifications

* Change the LED, using the formula set above to choose a new resistor.
* Interrupt the connection between the + side of the power supply and the resistor; replace it with a pair of leads. You now have a Continuity Checker, a tool to find short circuits in other projects.
* Is the 220Ω resistor the ideal choice for this project? Play around with other resistors, while keeping the same LED.