Thursday, April 13, 2017

A Primer on LEDs - The What and the How Tutorial

LEDs, Resistors, Power Supply, & Breadboard
Where do you start with LEDs? I've always wanted to learn how to incorporate LEDs into props I make. It turns out, it's not difficult to get started.

You can get started with just batteries, but decide on an application. Is this going to be something that plugs into an outlet or will it be portable and battery powered? You can enhance portable props or make a lamp for your home.
I explore both options because I want to do both. LEDs require a direct current (DC) voltage. Batteries supply DC, but with a wall outlet you need a power supply converter. A power supply converts the 120 volt alternating current (AC) from your home to a DC voltage. The power supply I bought is rated at 5 volts, 2 amps.

Supplies:
I scavenged a power cord from my junk cart. It's easier to just use jumper wires for the breadboard. I tried to use some thin gauge wire I already had, but ended up making an Amazon order. It's important to color code your wires to keep circuits straight. While this is a simple project, you should still maintain good habits. Black or white as ground and red or orange as lead.
My scavenged wire was too large for the breadboard. I went and bought breadboard jumpers. I was determined to create light, and while I did, I also managed to burn up a red LED because I didn't use a resistor.

Tools:
A multi-meter is necessary to test voltage. Just because the power supply says 5 volts, doesn't mean it is exactly 5 volts. Since the resistor wired in line with the LEDs are based on calculations derived from that voltage, you need an exact number.

As far as whether you use a power supply or batteries, that just changes the required resistor that limits voltage to the LED. Without resistors you will exceed the maximum voltage an LED can handle and it will cease operating.
AA batteries are 1.5 volts which don't provide enough voltage to power the LEDs I purchased, you would need to wire them in series to reach 3 volts.

<image pos to neg of second battery>

LEDs
LED is short for light emitting diode. When voltage is applied to the leads, energy is released in the form of light. The advantages of LEDs are that they use less energy, last longer, are small, and switch faster.
The anode is the positive pin and the cathode is the negative pin. The anode should be the longer wire, typically, though this isn't always the case.
Inside the LED, the the smaller piece of metal is the anode.

Connecting the Power Supply
Starting with the power supply converter, I removed the female end of the power cord  and used a hobby knife to split the power cord jacket. Then wire strippers exposed the wire. I attached these wires to the power supply with the screw terminal. I plugged up the power supply and an LED light came on indicating it was getting power. I then tested the power supply with a voltmeter. My power supply tested right at 5 volts. This model does have an adjustment. Next connect the power supply to the breadboard.
Most power supplies would provide too much voltage to the LED, but AA batteries can be connected directly to most LEDs.
If you're using batteries, electrical tape wrapped end over end works to hold wires in place to the battery temporarily.

Resistors for the LEDs
The voltage of the power supply should be less than the LED rated voltage, if it's not you use a resistor to reduce voltage. If you don't you'll burn out your LED. You want a resistor at the correct rating or higher. The higher the resistor rating, the more voltage it reduces. The resistor should be wired in line of the cathode of the LED, and it's better to wire individual resistors for each LED.
Confirm the voltage of your power supply. If you didn't know the voltage range, start with the highest voltage setting on your multimeter. Since I knew my voltage should be around 5, I set the multimeter to 10 volts (the lowest setting).


To calculate the correct resistor for an LED, subtract the LED voltage from the power supply/battery voltage, then divide by the current. Most LEDs are 20mA, or .02A.


R[resistor] = (V1[power supply/battery voltage] - V2[LED voltage]) / I (current - .02A)

With one red 2 volt LED, R=(5-2)/.02.
That's a 150ohm resistor.

With (2) red LEDs wired in parallel that's (2) 150ohm resistors, 1 resistor for each LED.

With (2) red LEDs wired in series, R=(5-2-2)/.02
That's a 50ohm resistor.

You can wire resistors in series or parallel. In series, the resistance is added together. In parallel you should wire a resistor for each LED or you could add the individuals resistances together and divide by the total number of resistors.

If you don't know the rating of your resistor check this website. The stripes on resistors represent their capacity.

Breadboard
The breadboard is a quick way to wire up circuits with out having to solder or tape wires together. It provides flexibility so you can quickly change wiring configurations.
You wire your power supply to the outside columns and then connect jumper wires to power individual rows.
While my LEDS have a range rating, I picked the middle number which was nice and 'round.'

Voltage range of supplied LEDs: red, yellow 1.8-2.3v; blue, green, white 2.8-3.6v; 20mA. So that's 2 and 3 volts.

Plugging those numbers into our resistor calculation determines that we need a 150ohm resistor for the red & yellow and 100ohm resistors for blue, green, and white.
With a 9 volt battery, I need 350 and 300ohm resistors.
With  2 AA batteries I wouldn't need resistors for blue, green, and white, and would need a 50 ohm resistor for red and yellow.

Wiring Configurations
This is the difference between parallel and series. As circuits get more complicated, you may have multiple series circuits wired in parallel.


With a single LED, you need a 100ohm resistor. In parallel wiring, it's the same resistor needed. In series the voltage across the two LEDs is reduced so no resistor is required. Adding another LED to the series diagram would reduce the voltage so much that the LEDs wouldn't light up.

A single blue with a  150 ohm resistor:
The (1) blue LEDs to the left are wired in series. They effectively get 2.5 volts which is why they are dimmer than the (1) blue getting 3 volts.
A red with a 150ohm resistor to the left and (2) reds wired in series without a resistor to the right.

Once you've tested the circuit and it works, it's time for a permanent installation.

Future Projects
A switch would be placed in line with the power supply lead, depending on what you want to control. You can set it up to control individual lights with multiple switches or all of them with one switch. In this scenario, a switch would be placed on the positive lead from the power supply to the breadboard.

You can solder wires together and/or use hot glue depending on the installation. You want the wires securely connected, a loose wire will turn into an LED that doesn't light up.
Blogger Widget