M&K Junction Railroad

M&K Junction Railroad
Another train of eastbound coal crosses the Cheat River

Tuesday, November 8, 2011

Fun with LEDs

The following is an unfinished chapter in an e-book that I intend to write about practical projects for model railroaders. I'm publishing it now because on one of the forums the participants asked for an LED primer. Stay tuned for the complete chapter:

Fun with LEDs
Text and Photos (c) 2011 T. Terrance

Light Emitting Diodes (LED) are ubiquitous in the modern world. They have all but replaced the miniature incandescent lamp. In the hobby of Model Railroading it is hardly any different. Most recent locomotives come equipped with LEDs for lights; as do some signals, accessories and structures. LEDs are available in a wide range of colors and sizes. If you are planning to illuminate anything on your railroad, you might want to consider LEDs. This chapter will give you the knowledge to do so. If you are an old hand with LEDs you may want to skip what follows.

An LED is simply a small chip of semiconductor material that can emit light. It does this very efficiently and therefore uses very little current and emits little heat. The chip is encapsulated in a dome-like housing with a flange made of clear or translucent epoxy resin. Two leads protrude from the housing, a positive one called the anode and a negative one called the cathode. The following figures shows a typical LED, and the arrangement of its internal components and its schematic symbol (don’t worry, you don’t really need to know the latter two).





Schematic diagram of an LED:




The epoxy covering can be clear (sometimes referred to as “water clear”) or in one of many colors: red, green, yellow, blue and white being the most common; but amber, orange, pink, violet, warm white as well as invisible infrared and ultraviolet are available. The covering can be frosted (called diffused). The color of the LED is inherent in the chip, not in the coloring of the epoxy. The brightness of LEDs is usually measured in millicandellas; the more millicandellas the brighter the LED is.

Specialty LEDs that flash, flicker and alternate between colors are also available (more on those in another chapter).

LEDs come in a variety of sizes and shapes but in this chapter we will concentrate on the 5mm round (T 1 3/4 size), 3mm round (T1 size), 2mm round and square (T ¾ size) and below as the most useful for model railroads. These are readily available sizes. We will talk about “chip” LEDs in another chapter.

Nowadays LEDs are commodity items and many times you do not know who the manufacturer is; as in the LEDs bought from Radio Shack (no, Radio Shack does not manufacture them). This chapter will use commodity LEDs except where a special characteristic is required, then I will call out a manufacture’s part number and a supplier.

Enough of this background information, let’s get down to what makes LEDs different from regular bulbs.

1. LED’s must be powered with DC; bulbs don’t care.
2. LEDs must be hooked up properly to the positive and negative voltage; bulbs don’t care.
3. LEDs are sensitive to current and will fail rapidly and suddenly above a certain current.
4. Strings of multiple bulbs should be wired in parallel, stings of LEDs should be wired in series.
5. Regular bulbs get brighter with higher voltage until they burn out; LEDs get brighter with more current up until the current where they fail.
6. LEDs can last in excess of 50,000 hours.
7. LEDs can be switched on and off repeatedly without decreasing their life.
8. Small LEDs do not generate significant heat.

Items 1 - 4 are the key characteristics for working with LEDs. 5, 6 and 7 are nice to know, but do not affect how you work with LEDs. If you are lighting a wood or cardboard structure, knowing 8 comes in handy.

Characteristic 1 – LEDs must be powered by DC because they are a semiconductor device and not a glowing filament. There are ways to power an LED from AC with the addition of external components, but they have the net effect of rectifying the AC to DC for the LED. Remember, DCC is a form of AC so an LED cannot be connected directly to a DCC track output either.

Characteristic 2 – LEDs must be connected correctly to the positive and negative voltage to work properly. Not only to work properly, but even to survive. If an LED is hooked up backwards, and the voltage is high enough (say, above 6V) failure of the LED can be instantaneous. The following figure shows how to identify the anode (positive terminal) and cathode (negative terminal) of a typical LED.




The cathode (negative) is the shorter wire and the epoxy housing has a flat edge on the flange next to the cathode (rarely it’s not a flat edge but a notch in the flange). The longer wire is the anode (positive). The flat in the flange allows you to identify the cathode even after the leads are cut short to install the LED. But you cannot just hook up a battery to the LED which brings us to...

Characteristic 3 – LEDs are sensitive to current and will fail above a certain current. OK, we have to talk about some theory here. When a diode, any diode including LEDs, is hooked up with the positive terminal attached to positive voltage and the negative supplied with negative voltage a current will flow through the diode. That’s what diodes are designed to do, they are a one-way valve for electricity. A diode will allow a LOT of current to flow, in fact, it appears as almost a dead short. Some diodes can handle large currents, as in the diodes used in rectifiers. The small LEDs we are dealing with here, however, can only pass a very small amount of current without burning up; typically 20-25 milliamps (25 thousandths of an amp). If you just hook up an LED to a voltage source a LOT of current will flow and the LED's life will be VERY short indeed.

To prevent burnout we need to limit the current flowing through the LED to a safe level. This is accomplished with a resistor. A resistor, as the name implies, restricts (resists) the flow of current. A resistor in a series circuit (i.e. in line with) with another device will limit the current flow through the device. To choose the value of the resistor we use one of the fundamental relations in electronics – Ohms Law.

V/I = R

In the equation above, I have written Ohms Law to find the resistance (R) for a voltage (V) and current (I). For example, if we are using 12 V, and desire a current of 25 milliamps (0.025 amps) then...

12/0.025 = 480

So a resistor of 480 Ohms will result in a current or 25 milliamps (ma) at 12V.

If you don’t care for the math, or just want a quick reference, here is a table of common values to produce 25 ma.

Voltage

Calculated Resistor

Value (Ohms)

Nearest “Standard”

Resistor Value




3 V/3.3V

120

150

5/6V

240

270

9V

360

390

12V

480

470

15/16V

640

680

18V

720

1000

24V

960

1000




The calculated resistor values are not readily available as ‘standard’ resistor values, so column 3 has the closest resistor that you are liable to find in an electronics store. In almost all cases the resistance value is higher, therefore the current will be lower; but this will not significantly effect the output of the LED. If this table is still too much to comprehend, use this rule of thumb: for most model railroad applications use a 680 ohm resistor – you won’t be too far off.

Drawings of small resistors and the resistor’s schematic symbol are reproduced below.






Notice the color stripes on the resistors. They tell you the value of the resistor. Rather than go into a tutorial on the resistor color code, I will call out the stripes on any resistors that we will use. If you are interested in the resistor color code you can look it up using on-line resources. Here’s a particularly good resource that has tables of resistor values and their corresponding color codes: Resistor Col
or Charts

Now we can begin lighting up some LEDs. We’ll build the following test circuit using an LED (any color will do), a 270 Ohm resistor (Radio Shack 271-1112 or similar), a 5-6VDC power source (5V power supply, 6V battery pack, or power pack track output [DC] set for 6V) and 3 alligator-clip test leads. The 270 Ohm resistor will have red-violet-brown stripes on it, in that order.

A schematic diagram of the circuit would look like this;



The end of the LED symbol with the vertical bar indicates the cathode (negative) end; and the side with the arrow head indicates the anode (positive) end. The circuit operates because electricity flows from the positive voltage (V+) through the resistor, which limits the current, thence through the LED causing it to illuminate and returns to the source of the electricity through the negative return line.

Here is a picture of the circuit laid out on my workbench.



Power is coming in from a 5V power source located off-camera to the left; red is positive. Next it’s connected to the resistor, which can be connected from either end, as it has no polarity. The positive current is then connected to the anode lead under the LED at the right. The black alligator-clip test lead is clipped on to the cathode of the LED (the one next to the flat). Thereupon it returns to the negative terminal of the power source. As you can see, the LED lights up

If your eyes are really sharp, you’ll notice that the color code on the resistor is red-red-brown, which makes it a 220 ohm resistor; since this is a 5V source, the current should be about 23 ma, so it’s safe.

This circuit, or one like it, can be used to illuminate structures, street lamps, car headlights, any stationary object where you can be sure what the polarity of the current is.

What if you need the light of more than 1 LED? LEDs can be connected in series strings, as shown in the next photo.



Power still comes in from the left on the red and black wires. But the circuit has been reworked to connect the cathode of the first LED to the anode of the next and so on, cathode to anode, until the last cathode is connected back to the power source. The single resistor limits the current flowing through the entire string.

The schematic diagram for this circuit looks like this:



This brings us around to characteristic 4 from the list at the beginning of this chapter.

Characteristic 4 – LEDs should be wired in series. When you wire bulbs, they are wired in parallel, that is, one wire from each bulb is connected to the positive and the other wire is connected to the negative. In this way, if any bulb burns out all of the rest stay lit. LEDs could be wired in this way, but each LED would require its own resistor to limit the current. Since LEDs with the proper current limit are unlikely to burn out, there is no reason not to wire them in series and use a single resistor for the whole string. That’s what I did above.

However, to pull off this trick we have to make an adjustment in the circuit. Each LED uses a little of the electricity as it passes through the device and this use of electricity results in a voltage drop. The voltage drop is about 2V for each LED; a little more for white LEDs and a little less for other colors, but 2V is a good approximation when you do not have the specific parameters of the LED. Therefore the string of LEDs in the photo above is not running on 5V, 5V would not be ‘strong’ enough to cause current to flow if each LED used 2V (4 x 2V = 8V drop). So I upped the voltage on the circuit to 12V.


Continued in Fun with LEDs II




6 comments:

  1. cool! thanks for this one! at least i get a guide of how to do the leds. railroading

    ReplyDelete
  2. Excellent stuff. I was listening to a podcast today that was talking about the requirements of LEDs. Nice that you put up that exact info. Also saw a reference in the Model Rail Radio list about a possible book of electronic projects for model railroaders like this. I for one would be in the market for that book!

    ReplyDelete
  3. Great Information. I was wondering about LED's and their useage on my model railroad. You explained it very clearly.

    ReplyDelete
  4. One thing about using resistors as voltage dropping components to power lights (be they incandescent or LED's) that really bugs me is the ignorance about POWER. For instance, if you use a 12 volt supply to power a single LED, that means that, using your example of 2 volt drop across the LED means 10 volts is dropping across the resistor. In round figures, 25 mA is going through the string which means that 10 x 25 = 250 milliwatts (or a quarter of a watt) is being disspated in the resistor. If you have used a 1/4 watt resistor, it can get very HOT. NEVER neglect the power calculations!

    ReplyDelete
  5. I have had this in my address book for quite a long time, just came upon it again. Great information. Ray Puls

    ReplyDelete