# 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.

# An Interrupt Using an Input Pin on a PIC16F690 CCS C

This is just a short post on how I used an interrupt to make my Pickit 2 cycle through the LEDs. This is a very simple program, and sadly I tried this once before and it didn’t work. I did a little research and found that I didn’t enable the correct interrupts.  This experiment is just one of a few that may need to take place to design my POV for my CCS compiler. I have a Picaxe POV, but I want high brightness LEDs and it to be in C. I like projects, and this one (POV)  is going to be a little bit different than the Picaxe one. Enjoy the journey in developing my next toy.