# LED Projects+Tutorial

Here I will try to help begginers with the most attractive electronic device the LED. :D

First of all the definition of a LED: An LED or Light Emitting Diode, is as Wikipedia expresses it, a semi-conductor light source. What it does is emit light when a certain voltage is applied.

Well but if you have to connect the LED to voltage then their has to be a positive and a negative on it. YES and let me tell you which is which:

Check the pictures below. There you will see that the positive is the side which isn´t flat. The negative is the flat side is its the shorter lead.

Now that you know how to connect it you need to know how to get your desired current.

This is pretty simple all you need to know is "Vs" stands for Voltage Supply, "VL" for LED voltage, "R" for Resistance and "I" for current.

Now going for the MATHSSS: R= (Vs-VL)/I ------- Resistance= (voltage supply-Led voltage)/current

For Example: Lets say you have a 9v battery and want to power a Red LED. A red LED need 2.2 volts at 20 Ma so calculate your resistor:

R= ( 9 - 2.2 ) / 0.02 = 340   you need a 340 ohms resistor

Now armed with the resistance formula nothing can stop you from lighting all the LEDs you want! :D

If you dont want to do maths or are unsure about your results check this site to calculate your resistors: http://ledcalculator.net/

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Quick Tip:

Blue LED= 3.5v   White LED=3.5v  Green LED= 2.2 or 3v (check which)  Red LED=2.2v   Yellow LED=2.2v  Flashing RGB LED:3v

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

YOU SHOULD DEFINETELY check out this link if you did or didn´t find what you searched for:

http://letsmakerobots.com/node/4948  I bet you learn something from it!

Thank you oddbot for this very well detailed tutorial :)

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Now lets move on to some simple projects:

LED Light:

Supplies: LED any color, resistor, power supply and a

Intructions:

2. Connect 1 lead of the resistor on + and the other on the positive side of the LED (the one that doesnt have a flat side)

3. Connect the negative side of the LED to the negative rail

4. ENJOY!

Now keep experimenting until you feel pretty confident about how to wire LEDs

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Let´s move onto some harder LED circuits:

A simple Dark activated LED flasher:

Supplies:

Transistors: 2n2907, 2n2222   Resistors: 1k, 2m   Capacitor: 1uF   an LED and a LDR (Light Dependant Resistor)

R1 & R2 stand for Resistor 1 & 2, Q1 stands for the LDR, C1 for Capacitor and Q2 and Q3 are the transistors.

The LED flashes when the LDR is iluminated, when the LDR is dark the LED is off,also the capacitor controls the flash rate.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Programmed Project:

In this one I´ll show you some basic PICAXE programming to make a LED flash without using a Capacitor like in the previous project

First of all you need a PICAXE IC, I am using a PIC 28x1 but I believe you can use others too the only thing diferent is the pinouts.

Supplies:

10k resistor, 1k resistor, PICAXE IC, Breadboard, a push button and Picaxe project board (you can also hook up the IC directly to the breadboard if you want to)

First lets go through the wiring:

1. Place the push button on the breadboard, half on each side (see picture)

2. Connect one lead of your 10k resistor to ground and the other to one pin of the button

3. Connect the voltage diagonaly to the pin of the button connected to ground

4. Place one lead of the 1k resistor on the same row the ground connected to the button is and the other lead connect it to Input 0 of the PICAXE

5. On the same row where you did the connection to the input 0 add 1 lead of a 330 ohm resistor and the other to the + led of the LED you want to use.

6. Connect the LED to ground.

7. Add this program to the programming editor:

main:
if pin0 = 1 then ledon `this tells the PIC to read pin0 and then go to ledon if it has voltage

if pin0 = 0 then ledoff `if pin0 has no voltage then go to ledoff

ledon: `high 2 gives pin 2 power to light the LED
high 2

pause 100 `this is the time before checking pin0 again, when button is kept pressed this regulates the flash rate

ledoff:`low 2 tells the PIC No power to pin 2
low 2

pause 100

goto main `after going to either ledoff or ledon this tells it to repeat

8. Once you added the program, keep the button pressed and see the LED flash :D

(such a big walthrough to see a LED flash...)

If you cant read the descriptions right click the image click see image and when you are on another page ctrl + it to zoom

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Youre still not convinced that LEDs ain´t fun? Then check out this posts:

The other use for LEDs (thanks to rik) :

http://letsmakerobots.com/node/3518

LEDs making your night a happy one (thanks to Geir Andersen) :  Variants of this project by inoblegnome and nuumio, thanks!:

http://letsmakerobots.com/node/19149 ( by nuumio)

LEDs keeping your feet safe at night (thanks to  isotope) :

http://letsmakerobots.com/node/18524

A pretty COOL synthesiser (thanks to Telefox) :

http://letsmakerobots.com/node/17166

## Comment viewing options

As far as I can tell your schematic is wrong. Your input is connected to the LED and not the switch. The schematic should probably be something like this

You are right I´m going to change as soon as I can, I would use your image but the PIC is Picaxe not Arduino.

Thanks

I just updated it please check it to see if you still find it wrong:

Well, your 10k resistor seems to be in the wrong place. It’s used for pull up or down right? Then it should be on the input line either going to 5V for pull up or to GND for pull down. Now it’s on the wrong side of the switch.

Sorry about the Arduino, but it’s the same deal.

Yes, again, but this time was a silly mistake because I am using this circuit for an alarm and I have the breadboard in fron tof me with the right wiring and I get it wrong? omg.

Well according to what I have now it should work as the 10k resistor pulls down to ground.

Thanks.

Now it seems correct. And thank you for the reference link.
That said you probably should have gone for nuumino’s version http://letsmakerobots.com/node/19149 or ignoblegnome’s http://letsmakerobots.com/node/22527 as their version is far better than mine.

Since you have made another tip on using LEDs I think we should cross link them. That way, when a newbie comes across either one he can benefit from both. My tip: http://letsmakerobots.com/node/4948

Definetely we should. So what do you think should I add your post to mine or add a link or the other way round?

For now I´ll just add a link and by the way, would you mind if I took you LED picture which shows the parts?

You will notice at the bottom of my tip I have added a link to your tip. This makes it easier for people to find the information they need.

The photo is from Wikepeda as I have stated in my tip. I have also linked to that page in my tip.

I added a link to yours near the middle of the page, if you skim the page youll see a part separated with ----- and the ledtters are bold :)