|A beginners guide
to using LEDs in DCC controlled model locomotives.
I'm hoping that this guide will be of interest to modellers without an electronics background, who would like to add or modify LED lighting in support of their hobby. The aim is to provide a basic understanding of the properties of LEDs, how to use them safely and to explain how a little simple arithmetic can be used to calculate the minimum value of the series resistor commonly used to set up their brightness.
LEDs Suitable for model rail applications:
LEDs are very efficient components compared to the bulbs which were previously used in model rail applications. For the same brightness, a LED requires a tiny fraction of the power absorbed by a bulb, which means the LED runs much cooler. LEDs can be made smaller than bulbs and have a large range of available colours, normally removing the need for colour filters. Bulbs have a finite lifetime and will need to be replaced several times within the typical lifetime of a model locomotive whereas, if operating within its specified limits, a LED will often outlast the model which accommodates it.
LEDs found in OO/HO gauge model locomotives come in various shapes, sizes and colours. However, they all operate in a generally similar manner.
The LED Circuit Diagram Symbol:
The LED is a two terminal device. It is a special type of diode, which only allows electrical current to flow through it in one direction.
When a current flows in this direction, light is emitted from the device. If the supply voltage is connected in the opposite direction, no current flows and no light is emitted.
The positive connection is also called the anode. The negative connection is also called the cathode. To illuminate the LED, current is made to flow from the positive connection to the negative connection. The amount of electrical current passing through the LED in this way, controls the brightness of the light produced. The current flowing through the LED must be controlled by the external electrical circuit (usually by means of a series connected resistor).
How to power your LED:
The LED needs to be incorporated into an electrical circuit that controls the amount of current flowing through the LED and never applies a high negative voltage to the device.
In DCC equipped locomotives, the LED is usually connected via a series resistor (which defines the current) and it is usually switched on and off by a function output on the DCC decoder (which only applies the correct polarity to the LED).
These diagrams show the series resistor placed on the negative (cathode) side of the LED(s).
but if preferred, the series resistor can alternatively be placed just as effectively on the positive (anode) side of the LED(s).
Twin LEDs can alternatively be connected in parallel with individual resistors.
The advantage is that any difference in light output can be adjusted by changing the individual resistor values
The drawback is that an extra resistor is needed
LED Properties useful to know:
The forward voltage that needs to be provided in order to illuminate the LED varies for different colour LEDs.
The highest forward voltage is found in white LEDs, with a figure of approximately 3 Volts.
Red, green and amber LEDs exhibit a figure closer to 2 Volts.
When the LED is connected with the correct polarity (forward biased) in series with a suitable resistor across a DC voltage. The voltage measured across the diode will always be in the region of the figures given above.
How to work out the minimum resistor value that can safely be used:
To establish the minimum resistor value, Ohm's law can be used. This relates the current through a resistor to the voltage across that resistor and can be expressed as V/I=R with V=Voltage in Volts, I=Current in Amps and R=Resistance in ohms.
The maximum current is part of the LED specification. Let's use a figure of 15mA (=0.015Amps) for this example, which would be safe for most modern LEDs (including 0805 chip types.)
The voltage across the resistor can be estimated as the decoder output voltage minus the forward voltage drop across the LED when it is on. The voltage at the output of most DCC decoders is approximately 14 Volts. The forward voltage drop across the LED can be found in the specification. For a white LED this is approximately 3 Volts. So the voltage across the resistor will be approximately 14 - 3 = 11 Volts.
So using Ohms law, with a Current of 0.01 Amps and a voltage of 11 Volts, V/I=R, so R=11/0.015 = 733 ohms.
Moving to the next highest standard value of resistor, a value of 820 ohms or higher can safely be used.
I usually use around 2k7 for headlights, 10k for rear lights and hazard lights and as much as 47k for directly viewed front marker lights.
The table below shows the forward current drawn by different colour LEDs with some typical series resistor values when operating from a 14 Volt DCC output.
The best way to identify the optimum resistor value for a specific application, is to equip yourself with a range of these low cost components and to try a few values, homing in on the effect you prefer.
Destroying a LED:
The two main causes of LED demise are as follows:
1) Too much forward current...... perhaps due to accidentally omitting the series resistor, using a series resistor with a value far too low or due to a failure in the current limiting circuit.
2) Wrong polarity........connecting the LED back-to-front to a voltage greater than around 5 Volts.
As long as care is taken to avoid subjecting your LED to the above, all should be well!
How to check the correct polarity for your LED:
The positive lead of a new LED is normally the longer lead. However, once the leads have been trimmed, or if you are using chip LEDs (with no leads) its not so easy to identify the polarity. The safest way is to make yourself a simple test circuit:
Connect your mystery LED as indicated and switch on. If the LED under test illuminates, then the positive lead is the one connected to the resistor. If the LED under test does not illuminate, swap its connections and it should then illuminate to confirm its polarity. The white LED in the test circuit ensures that even if the LED under test is connected the wrong way around, there is insufficient reverse voltage to damage it.
Using Isolating Diodes to drive LEDs from more than one function output:
It is often useful to be able to switch on a LED or group of LEDs from more than one decoder function output. An example is front marker lights, switched from either day or night headlight decoder outputs. The circuit diagram for such an arrangement is shown below:
Each function output is connected to the marker LED circuit via an isolating diode. Each isolating diode behaves in an approximately similar way to the LEDs except that no light is emitted.
The isolating diode will only conduct current in one direction. When the voltages applied to the diode enable it to conduct, a voltage of around 0.7 volts is dropped across the diode and the current is only limited by the external circuit. If the voltages applied to the diode are in the non-conducting direction, the diode acts as an extremely high resistance and is largely invisible to the other circuitry.
The diodes prevent one decoder function output from switching on the other function output's load. When the green output goes negative, the day headlight switches on and the isolating diode connected to the green wire becomes forward biased. (This means that the voltage across the diode is in the correct polarity to enable it to conduct current.) The marker light LEDs also switch on, with their operating current passing through the green side isolating diode. Because the purple function output is off, the voltage here is the same as the common positive. This reverse biases the purple side isolating diode, making it assume its high resistance state, which prevents the Night LED from coming on. If the green output is switched off and the purple output is switched on, the night headlight comes on and forward biases the purple side isolating diode, which allows the marker lights to switch on again. The reverse biased green side diode stops the day headlight also coming on. If both night and day headlights are switched on together, the marker lights also come on, with their current divided between both function outputs, but no damage is done.
Using a current source in place of a series resistor to drive your LED:
It is possible to control the current passing through the LED with a simple circuit that limits the current allowed to flow through the LED.
In the circuit above, a PNP transistor provides current to a pair of series LEDs via its collector lead. The voltage between the positive input and the base of the transistor is fixed at two diode drops (around 1.2 Volts). The transistor begins to pass current between its emitter and collector, into the LEDs when voltage between its base and emitter exceeds around 0.6 volts. However as soon as current flows, it also passes through the 56 ohm emitter resistor and this brings the voltage on the transistor emitter down until an equilibrium state is achieved with approximately 0.6 volts across the 56 ohm resistor. This corresponds to around 10mA of current, which also passes through the two series LEDs. Variation of the supply voltage between about 7 volts and the DCC supply volts (of 14 to 16 volts) has virtually no effect on the current through the LEDs, so their intensity remains constant.
If the lights in a model train passenger compartment flicker due to bad supply connections, the effect is very conspicuous and looks completely unrealistic.
This circuit concept can be particularly useful when using a "stay alive" capacitor to keep the LEDs illuminated despite power breaks due to dirty track.
In this circuit, a capacitor, resistor and a pair of diodes is used to provide about 1 second of continuous light from the LEDs even when the power is cut off. When the power is on, the capacitor charges up through the 220 ohm resistor to a voltage of around 14Volts. (The 220 ohms avoids placing too much load on the decoder). If the supply is briefly removed (due to a track break) the capacitor powers the circuit with no change in the LED intensity until the capacitor voltage discharges to less than 7 volts, which takes around 1 second.....plenty of time for most dirty track problems.