Articles - Electronics: LEDs
01/27/2019

How To Connect LEDs

External Reference:
A standard, 3mm or 5mm, one-color LED (Light Emitting Diode) has two leads. Typically, one is longer than the other. The longer one is the anode, the other is the cathode. The anode (the longer lead) should be connected to the positive lead of the circuit, and the cathode should be connected to the negative or ground lead. If both of the LED's leads are the same length (which sometimes happens if the LED is removed from a circuit or the leads shortened to make it fit), then look for a flat side at the bottom of the LED's case. Look at the LED straight on from the top and you'll see one edge is not round but flat. The lead nearest the flat edge is the cathode, or negative lead.

How To Insert LEDs Into a Circuit

Never connect an LED directly to a power supply; it will self-destruct. Always have a resistor in the path so that the current through the LED can be controlled. This resistor is called a "current-limiting" resistor. An LED by itself will happily take whatever current the circuit has to offer; until it self-destructs. This happens in a matter of a second or less!

How To Calculate The Current-limiting Resistance

External Reference:
Because of the current-limiting resistor, you can control the amount of current the LED is allowed (call it "portion-control"; we want our LED to be on a steady diet so that it doesn't starve and doesn't overeat). The side-effect of controlling the amount of current going through an LED is that the amount of light it emits can be controlled. The less current, the dimmer the light. The more current, the brighter the light. Again, too much of a good thing here, i.e. current, and the LED will blow. Sometimes an application calls for a very bright scenario, and sometimes you want a dimmer LED.
External Reference:
If you have done anything relating to electronics, you will be familiar with Ohm's Law. Ohm's Law states that voltage is equal to current times resistance (V = I * R), where V is voltage (in volts), I is current (in amps), and R is resistance (in ohms). We will use this Law to calculate the size resistor we need for a certain brightness.
When you buy a new LED, the manufacturer will provide some key information about the LED on the package or in electronic format via a PDF file on their web site. Different from a regular diode, an LED can have completely different parameters based on its light color. Different chemical components are used to produce the white, gold, yellow, red, green, blue, etc. colors that are currently available. These have different parameters in normal operation. So, be sure to read the information about the specific LED you are about to use.
External Reference:
Below is an example of a simple circuit that lights up an LED when its power source is plugged in. Let's assume that the LED "consumes" 3.4 volts from the circuit to run it (should be stated on the package, usually as "typical forward voltage"). Let's also say that the LED's maximum current is 20mA (i.e. 0.020A), which is generally stated on the package as well. Finally, we assume we have a standard 12-volt power supply which we wish to use to run our LED. To prevent the LED from burning out or aging rapidly, we are only going to provide it with 10mA of current (0.010A), which is a good, safe number to shoot for initially. In the formula below, Vps is the voltage of the power supply, and Vdrop is the LED's rated voltage drop. So, connecting a 860ohm resistor between the positive lead of the power supply and the positive (anode) lead of the LED will allow 10mA of current to run through the LED. You will want to find a resistor whose value matches that calculated number as close as possible. You can experiment with smaller and larger values to achieve the desired brightness (i.e. raise or lower the current from the initial 10mA starting point).

Since resistors come only in certain values, remember that you can put two or more smaller-valued resistors in series (back-to-back) to come up with the desired total amount. Conversely, if you hook two same-valued resistors' leads together, i.e. in parallel, then you wind up with an effective resistance of half that. So, as an example, let's say you have two 1,000 ohm resistors in your parts box. If you connect their leads together, you wind up with an effective resistance of 500 ohm presented to the circuit. The external link above-right shows examples of how to calculate total resistance if the resistors' values are not the same. Use either of these tools to get you the resistance that you calculated for your LED.
LEDs
External Reference:
This is a somewhat dated paragraph since it seems that most manufacturers are now using LEDs as standard equipment for new locomotives. However, you may have some older engines that still use miniature lightbulbs. When those burn out, or when otherwise desired, you can replace them with an LED and resistor combination. Simply use the maximum track voltage and the desired current through the LED to determine which resistor to use. Even though your new engine may have an LED for its headlights (and/or ditch lights), it may not be of the color that you desire. Again, you can replace them. Just make sure that you adjust the resistor if the LED has significantly different specs than the one you are replacing. The photo shows three N-scale Kato E8 engines with different 3mm LEDs. The one in the center came from Richmond Controls, while the outer two are Kato factory stock LEDs from two different runs that they did.
LEDs

SMD

External Reference:
Since about 2010 I have been using SMD (Surface Mount Device) LEDs. These are very, very small LEDs, but have an incredible brightness. These can also be had in various colors, but some research and experimentation may be required. I bought my first batch from Ngineering, because the company has already figured out which ones are best for scale locomotive use. However, if you are going to convert a lot of engines (and, in my case, structures), you may want to look at other bulk-purchase solutions, because they can be quite a bit cheaper that way.
LEDs
I built this S-scale kit of a PRR RS-1. I put these SMD LEDs in the headlights of the engine, as well as under the roof to light up the interior. This is a black-n-white photo I took of the model on my layout, but it clearly shows the LEDs in action.
LEDs
External Reference:
Here's the cab roof before assembly. I glued the SMD LED to the roof after soldering magnet wires to the LED (not a trivial task). However, the wiring is very well hidden on the inside of the cab.
LEDs
I've also been using these SMD LEDs on structures. This one shows one glued inside the lamp fixture of the an S-scale building. The lamp fixture is from Ngineering.
LEDs
There are two LEDs on the inside of the building to show off the interior detailing, and there are also three LEDs on the outside. The photo was taken with the full layout lighting turned on.
LEDs
As stated above, the Ngineering LEDs are, relatively speaking, quite expensive, so I went online and bought a bulk set of 30 SMD 0603 LEDs. These are even more tiny than the Ngineering ones. I also found the datasheet of those LEDs online. In addition to the key numbers discussed above, the other thing you need to know about the LED is which side is the cathode and which side is the anode. The datasheet will tell you that. Most of the information in a datasheet can be ignored, because it is usually intended for use in a factory where they buy reels that have 4,000 LEDs on them to automatically insert these LEDs into a circuit board, for example.
LEDs
Here is an extreme close-up of two of these 0603 LEDs. The one at the top shows the arrow direction, on the bottom of the LED, of the intended flow of current through the diode. The other LED shows the front-facing side. Again, these are incredibly tiny and require great care when handled; from a distance they may appear as a spec of dust.
LEDs
To actually prepare to solder them, I applied a section of double-sided tape to a metal weight. I then used a pair of tweezers to put the LEDs, face down, onto the tape. I could then quickly apply a small amount of solder to the pads on the left and right side of the LEDs. You can then solder a magnet wire to them, or apply them directly to a circuit board.
LEDs
Here I soldered one of them to a piece of printed-circuit board strip from Clover House (commonly used for ties or throwbars in N-scale). Of course, there was a slit cut in the PC tie material to separate the left and right pads of the LED. A current-limiting resistor is visible in the photo as well. I didn't have an SMD version of the resistor in the value required for this application, otherwise I would have preferred using it instead. You can see how ginormous a 1/8-watt resistor is compared to the LED.
LEDs