# Tag Archives: led Sept. 22, 2009 - Waiting on parts to come in can be boring so I went on a dig through my parts bin and found this LED still in its original packaging. While the packaging leaves a lot to be desired, I actually found the datasheet on RS’ website. I played with this LED and some 1k resistors on a breadboard, and now I’m going to make a night light that changes colors. The original program that I wrote lasts about 15 minutes, and it cycles through all of the colors [edit – at least I thought it would). It uses a rough PWM method that I wrote to fade in and out.

After a little math work I decided on using 20mA for all of my colors. They are rated for 30 to 50 mA depending on the color, but with this I can use the output pins on my PIC12F675. This saves a lot of transistors for another project.

# LED: How to…

The LED is an amazing invention. In this tutorial, I will explain how to design a circuit using a voltage source, a resistor, and an LED.

The first step in designing a circuit with an LED is to know the characteristics of the LED being used. Most LEDs have some form of a datasheet. The most important information is forward voltage and forward current. The maximum of these values is also very important.

For this illustration we will assume that our red LED has a forward voltage (Vf) of 1.7 volts and a forward current (If) of 20 milliamps. The maximum Vf is 2.2 volts and the maximum If is 150 milliamps. The safe power dissipation for our LED is 100 milliwatts. Our voltage source will be a 9 volt battery. This concludes all of our known values.

The unknown values that we want to find include: the resistor value, power dissipated by the resistor, and power dissipated by the LED.

The resistance can be calculated using the formula: (Vsource – Vf(LED))/If(LED) where the voltages are in volts and the current is expressed in amps. This formula is a modified version of Ohm’s law, where resistance = voltage / current, only we are taking into account the voltage drop of the LED to find how much voltage we need to be dropped by the current limiting resistor.

For our circuit: (9v – 1.7v)/.02A (20mA) = 7.3v/.02A = 365 ohms. You might be able to get a 365 ohm resistor, but a common value in my collection is 390 ohms.

Our actual forward current can be calculated as (9v – 1.7v)/390 ohms = 18.7mA. The voltage dropped by the current limiting resistor is I*R. 18.7mA * 390 ohms = 7.293 volts, which rounds up nicely to 7.3V. We already knew this because of the previous calculation though. This only confirms our suspicions.

The power dissipated by our LED is I*Vf(LED). 18.7mA * 1.7V = 31.79mW. This falls safely into the maximum dissipation of 100mW noted on the datasheet. We could have possibly chosen a smaller value resistor and still be within this region.

Finally, we chose to use a 1/4 watt resistor. To find the power dissipated by the resistor we multiply the voltage drop of the resistor by the current in the circuit. P=IV(resistor). The power dissipated by the resistor = 18.7mA * 7.3V = 136.51mW. This is less than 250mW so we are still in the safe region for this resistor.

What would happen if we had chosen a 330 ohm resistor?

If = (9v – 1.7v)/330 ohms = 22.12mA
V(resistor) = 22.12mA * 330 ohms = 7.3V (we knew this)
P(LED) = 22.12mA * 1.7V = 37.6mW (this is safe)
P(resistor) = 22.12mA * 7.3V = 161.5mW (this is safe)

The maximum power dissipation is the most important value to watch. Exceeding this shortens the life of a LED. The only time you could meet the If(MAX) and not damage the LED is if you used PWM. If you were to use this LED at If(MAX) of 150mA, the LED would have to dissipate 255mW of heat. This is 2.5 times the LED’s normal dissipation. Death of the LED will follow closely.

# POV: Persistence of Vision with a PIC16F690  Over the past two days my wife and child have been sick so I’ve had lots of home time to work on this project. It’s pretty amazing to me that I just started this PIC16F690 POV project less than two days ago, and I already have it finished and working. I worked pretty hard to get the C files completed for this. I also drew a board with Eagle, but I just used some scrap perfboard. Nothing in the world beats point to point soldering. It was actually pretty easy since there isn’t really much to solder in this project.

# POV: Persistence of Vision with a Picaxe 18X This is a project that I finished around March 2008 which was well before the birth of http://Tech-tut.com. I read the first issue of Make magazine and saw a POV by a guy named Bunnie Huang (Make volume 1 Page 34-37, 186-189). This thing is really cool looking, but is way above a beginner’s head. Actually, this was when I started with the Picaxe. This was my first big project. Since then, most of this project has been lost, but I happened to find the program and the file containing the letters and numbers so I could copy and paste whatever words I wanted. I am including all this here. I’ll use my multimeter to make a new schematic. Nothing beats a little reverse engineering. Also, I may design a POV in C so that we can cater to the beginners and the advanced, but only time will tell. As for now, please enjoy the Tech-Tut POV.