M&K Junction Railroad

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

Sunday, November 20, 2011

Fun with LEDs II

This is a continuation of the original post "Fun with LEDs"

The original post was linked to a forum and I solicited and received feedback to simplify the photos of a simple LED setup, that is, without the alligator clips. So I put on my thinking cap and tried to come up with the simplest way to light up an LED. Here's what I came up with.

Take an LED (color of your choice), a resistor (any value around 300 ohms) and a 9 volt battery. Then do the following:

1) Cut the anode of the LED (positive terminal) off to about 1/4 to 3/8 inch long.
2) Now cut off one wire from the resistor to about 1/4 to 3/8 inch.
3) Overlap and solder the cut end of the resistor to the cut anode.
4) Cut the other wire coming out of the resistor to the same length as the cathode (the outer wire coming out of the LED).

What you have now should look like this:

Your resistor might not match the one that you see here; yours may be one of the little 'dog bones' rather than the old school resistor you see in the photo.


5) Spread the cathode and anode as you see in the picture.

You should now have a lit-up LED atop the battery like this:

The posters in the forum made a big deal about determining the proper value for the resistor. The calculated value for a resistor for 9V is 330 ohms; but if you know the resistor color code, the resistor that I used is 220 ohms (Red-Red-Brown). This resistor should be allowing 40 ma to pass; that's well above the published recommendations for most LEDs. It just illustrates that there is some latitude in the current that an LED can handle, but any time you go above 25 ma you are taking a risk.

Now that you can light-up an LED using DC of a known polarity and voltage what do you do if you want to light an LED with AC or DCC (DCC is a form of AC)? Or if you want to light an LED with DC that can change polarity each time direction is changed like an LED mounted in a caboose, passenger car or locomotive?

The simplest way is to add a rectifier to convert the AC, DCC or reversing DC to a constant and unchanging polarity DC for the LED. The process of "rectification" converts an AC signal which changes polarity many times a second to DC. Today's rectifiers are devices that combine four diodes in a 'bridge' arrangement that convert AC to DC. They will also take DC which switches polarity and convert it to constant polarity.

Bridge rectifiers come in a variety of shapes, sizes and capacity; see the photo below:

The little guy on the left is a 1 amp rectifier in a 'mini-dip' package; it's the one that we will be using. 1 amp is more than is necessary, but it's about as small as rectifiers come. Next to it is a button with four leads; this is a 1.4 amp bridge rectifier. This size/form factor could be used for our next design as well. To illustrate the other extreme in rectifiers, the rectifier on the right is a 35 amp unit used in the larger power supplies.

Here's a close up of the mini-dip rectifier:

You'll notice the two pins marked with a 'squiggle' (or tilde, ~ , if you prefer). These are the pins where the AC, DCC, or switching DC are applied. It does not matter which wire is applied to which pin. On the far side of the device, are two pins marked with a '-' and a '+'. These are the pins where the rectified, constant DC comes out.

This rectifier is All Electronics part number #FWB-11 (35 cents as of this writing). Other similar parts are: Digikey DF01MDI-ND (49 cents)and DB102-BPMS-ND (73 cents).

The first step in preparing the rectifier for use with the LED is to flatten out the pins as shown in the following picture:

Now take the diode/resistor assembly that you made above and solder the resistor side to the positive terminal and the cathode side to the negative terminal. What you wind up with is an assembly that looks like this:

If you have sharp eyes, you'll notice two things about this set-up. First I've changed the resistor to 1500 Ohms (Brown-Green-Red). Second, my soldering skills are poor; therefore if I can do it you can too.

I've changed the resistor because I'm going to run this circuit off of a higher voltage and I did not want to blow out the LED. 1500 Ohms is a lot better value to use for all-around use at track voltage or at DCC voltages. Again this is not critical, any value above about 680 Ohms should work. Ordinarily, I'd cover this circuit with heat-shrink tubing to insulate and protect the circuit, but I've left it exposed to show how it's constructed.

In the next photo, I'm running this circuit from 12V DC as you would if this were running off of DC track voltage:

To demonstrate that the rectifier will take care of polarity changes, in the next photo I've reversed the polarity of the incoming current:

You can see that the red and black wires have been interchanged. In the next photo, the circuit is running on DCC track output.

If you wanted to, you could replace the single LED with a series string of 2 or more LEDs, as was done in section 1. Since rectifiers are relatively expensive, this makes sense to do. Light an entire passenger car or structure from a single rectifier/resistor set-up.

Evans Designs makes a similar unit, with the heat-shrink tubing attached, in three sizes and several colors for $3.25 each. The Evans Designs LEDs have wire between the rectifier and the LED and wires for the incoming current; this makes them convenient to install. Evans Designs Universal LEDs Here's a photo a 3mm size LED running on 12V below:

From 2-Rail O Scale Railroading

Although these are somewhat more expensive than rolling your own, I use them extensively in locomotives and rolling stock.

To be continued...


  1. Wiring the LEDs in series has the same problem that wiring incandescent lamps has. If one fails then no light from any of them. I always wire in parallel if I need several LEDs powered from one source.

    If you want to exploit the directional nature of the LED many people will attach two LEDs in parallel but with the polarity reversed. When the current is reversed one LED will light in one direction, change the polarity the other LED will light. Many people use this principle for directional lighting. Or for an indication of DC track polarity.

    Many LEDs are rated for 100,000 hours, but this is not complete failure we expect from an incandescent fails, but for when the output drops in half.

  2. To illuminate a locomotive headlight operating on DC current, is it necessary to use a full wave bridge rectifier to protect the LED or would an in-line diode be sufficient? OR would a rectifier be necessary at all?

  3. I use full wave bridges on all LEDs exposed to variable voltage, like a locomotive headlight. It provides some extra protection against reverse voltage plus the light will illuminate in both directions. The series diode will work, but the headlight will be directional which is what you may want.

  4. Paul Berkow Jan 30, 2012 9:42 am
    Really great tutorial. Can't wait for the rest of it.

  5. The simplest way to light an LED with an AC power source is to attach a diode to one side of the LED and the appropriate resistor to the other side. You can power an LED like that with 120v AC. It's been done with a lot of appliances to indicate a "power on" light.

    1. You may be right. However, for safety reasons, I will not recommend that anyone attach anything directly to line voltage.

  6. Hi to all .

    I'm about to try to built my own circuit board as for an o scale or o guage locomotive .

    The circuit board is for iluminate my numbers boards as four so , i need four warm white leds (thoses
    are presently ready installed Inside my body shell now .)

    I'm interested to made a little circuit board that can feed all thoses four leds with an ANTI-FLICKERING
    and that never TURNING HOT to prevent my loco plastic body to melt or warped .

    My trains operate with vintage old lionel Big ZW 275 watts AC variable voltage from O to 21 volts .

    Any help or picture drawing even a little desing with electronic parts needed for my specific train will
    be realy appreciated in advance .

    Dan .