2020-11-13

Modelling with LEDs

Modern modeling uses Light Emitting Diodes (LEDs) extensively. This is because they offer numerous advantages over older technology, such as incandescent 💡 light bulbs:

  • They are small
  • They are cheap
  • They are long lasting
  • They use very little current
  • They do not get hot
  • They are available in many colors (including 'warm' and 'cool' white)
Unless you are trying to reproduce models as they were in days gone by, you are going to be using LEDs on your models. They are not difficult to use but one does need to learn a few simple rules to use them.

The aim of this page is to explain the theoretical side of what is needed to power LEDs, how to connect them and even how to produce good results in moving model trains. I will be starting off with some very fundamental principles and building up to powering LED strips from digital power. The actual installation of lights inside building is covered here, this is about what has to be installed.

LED packages

LEDs come in a variety of different forms and sizes (called packages in the electronics industry).

Through-hole

Typically round 2mm, 3mm, 4mm or 5mm. Rectangular and other shapes are also available.

3mm & 5MM LEDs
3mm & 5mm LEDs

 Surface mount (SMT)

These are even smaller than the through-hole packages and are usually soldered directly to circuit boards by machines. One can now also buy them with tiny wires already attached and these are ideal for model building.

The different sizes are expressed using a 4 digit code that is made up from the length and width of the LED in tenths of a millimeter. For example a 2835 is 2.8 mm by 3.5mm. 5050 is 5mm x 5mm. Note, however, that some LED sizes are expressed in thousandths of an inch instead, so a 0402 SMD LED is is 1mm x 0.5mm. It is so small, it represents an object 87mm x 43mm in HO scale! - smaller than a lightbulb.

0402 LED
An 0402 SMT LED with wires.

  Strips

White LEDs are also commonly found in long, flexible strips up to 5m (16') long. These are made using surface mount LEDs. They are pre wired and ready for use with 12V (sometimes 24V). One can cut them to small lengths, typically 5cm long. These are ideal for passenger car and station lighting. They often use 5050 or 3528 sized LEDs. They are available in various colors, including warm, and cool white.

LED strip

These strips come with a crummy adhesive backing that will not stick for long, and so should be ignored. They need to be attached with a quality double sided tape such as 3M VHB tape.

Multicolor neopixel etc.

There are components that comprise 3 (R,G, B) or 4 (RGB+W) LEDs which allows the color of individual LEDs in a string to be digitally controlled independently. These fall out of scope of these fundamental concepts.

Electricity fundamentals

In order to understand how to connect LEDs up we do need some very fundamental understanding of electricity. Specifically we need to know a little bit about voltage, current and resistance. It may aid the understanding of these concepts by thinking of electricity rather like water in a pipe. For this analogy:

  • Voltage (V) - think of the Voltage as the pressure/speed of the water in the pipe. Measured in Volts
  • Current (I) - think of the Amperage as the diameter of the pipe. Measured in Amperes (Amps, A or mA. 1A = 1000mA) 
  • Resistance (R) - think of resistance as obstructions to the flow of water in the pipe, such as blockages or mesh grates that slow the water down. Measured in Ohms (Ω)

These three things have a simple relationship between them: V = I x R (Ohm's Law) and this formula is used to calculate things in all circuits, but fear not, most of the calculations have all been done already.

Just like a pipe, where water can travel in both directions, so can electricity flow in either direction along a wire. If the pressure is higher at one end, water will flow to the other end. If the voltage is higher at one end of a wire, electricity will flow to the other end of the wire, so long as it can get out.

Like pipes, larger amounts of current (Amperes) need thicker wires.

Series and parallel

We will talk about connecting things in parallel or series, let's just make certain the difference is clear.

Series connection of two lights
Series connection

When items are connected in series it means that the current flows through them in series, i.e. one after the other. In this circuit, the current flows through both lights so they are both having the same amount of current pass through them.

two lights in parallel
Parallel connection

When items are connected in parallel, electrons flow through one or the other only. The voltage available from the battery here is available to both lights and so they both have the same voltage.

Sources of power for LEDs

Almost all the complexity of using LEDs stems from the various Voltages and types of electrical power available in the modelling environment. Electrical power is typically available in two forms:

  • Direct Current (DC). The direction of the electrical flow is one way only. There is a positive and a negative side of the power source, (such as a battery).

    12V DC voltage

  • Alternating Current (AC). The direction of the electrical flow keeps flipping. The positive and negative sides of the power source keep alternating. 

    16V AC

The voltage of AC current varies from positive to negative very rapidly, and it typically resembles a sine wave shape if one was to plot the voltage over time as shown above. The direction of the flow typically changes 50 or 60 times per second (Hz).

In the model train world we also have a very special variant of AC electricity available: the digital signal that exists in the tracks to power digital trains. This electricity is also AC, but the wave is not a sine wave, it is a square wave and it oscillates at a much higher frequency.

Square wave digital signal

 Electricity for LEDs

  • LEDs only use DC current
  • LEDs can only handle very small currents
  • LEDs only use very small voltages
  • LEDs cannot handle current flowing in the 'wrong' direction.

Imagine we take an old style circuit that uses an incandescent light bulb.

and we substitute an LED for the light bulb:


almost right away we get.... nothing more than a puff of smoke....

Even a small 9V battery will likely overpower the LED and it will burn out. LEDs typically can only handle up to about 20 to 30mA. So let's add something to slow the 'water' down, we add a resistor.



This circuit will work, and the LED will be lit until the voltage supplied by the battery gets too low.

Lesson #1: Always have a resistor in series with an LED circuit.

The LED 'uses' some of the voltage. A yellow one uses about 2V (called its Forward Voltage). 
The maximum current for such an LED is 20mA.
The smallest resistor that can be used (with 9V) is therefore (9V-2V)/0.020A= 350 Ohms

Using a 460Ω resistor, the LED will use: (9V-2V)/460Ω = 0.015 A = 15mA

In addition to too much current, LEDs can handle even less current going the wrong way. Wrong way current could happen if you connected the two wires to the power source (battery) the other way around. If we do that, the LED will burn out right away. So just as we do with water in a pipe, we add a valve. An electrical valve is called a diode.


The diode only lets electricity flow towards the side with the stripe on it. If we connect the battery the wrong way, nothing will flow through the circuit and the LED won't be destroyed.

Lesson #2: It is a good idea to include a diode in an LED circuit to prevent accidental destruction.

Note #1, an LED is a light emitting diode, it also only lets current pass through it safely in one direction, whereas a silicon diode can also withstand current flow in the wrong direction.

Note #2, the diode (such as a 1N4001) uses about 0.6 Volts, so now the LED is getting:

(9V - 2V - 0.6V)/460Ω = 0.014 A = 14mA

Note #3 The order of the components in the circuit does not matter at all. The resistor and diode can be anywhere.

Note #4 The polarity (direction) of all the diodes is critical. All diodes (including LEDs) have a mark on one side to indicate the negative end. The LEDs have a flat side and the silicon diode has a stripe on the negative side. SMT LEDs have some tiny mark such as a green dot.

Lesson #3: The polarity of LEDs and other diodes matters

Let's throw out the battery and hook things up to a 12V DC power supply.

12V DC power supply with LED and diode

Now, some good news, we can add multiple LEDs into a circuit without the circuit using more mA than a circuit with a single LED! Each LED uses up its Forward Voltage though, so a smaller resistor should be used.

12V DC with 4 LEDs

White LEDs are special

It is now time to mention that white (and blue) LEDs are a little bit different to all the other colors. Their forward Voltage (Vf) is higher, 2.6V to 3.2V. The good news is most do light up well below their specified Vf. They can also take up to 30mA instead of just 20mA.

This is also a good time to discuss the brightness of white LEDs. They are extremely bright, way too bright for most model lighting where they are inserted into buildings, trains, etc. Putting a white LED into a station hall running at 30mA would simulate a blinding arc lamp (think lighthouse) in real life! 

I find running LEDs at 5mA or less is bright enough for buildings and well below their maximum rating.

How many LEDs can we add?

So long as the sum of the voltages in the circuit does not exceed the Voltage available (12V), the string of LEDs will light up.

If we have 12 Volts available, each circuit can power 4 white LEDs. (4 x 2.8V plus 0.6V for the diode = 11.8V)

Here is a table showing the number of LEDs and the suggested resistance for some selected voltages:
table of resistor values

Note: the Ohm values in the tables above are the minimum resistance. Pick the next biggest size available. You can get a copy of the spreadsheet here.

The number of circuits that can be added to a power source depends on the Amps available.
If, for example, each circuit is using 15mA, and we have a 1.5A power supply, we can connect 100 such circuits to it. 1.5A = 1500mA. 1500mA/15mA = 100

A 30 Amp power supply can power 2000 such circuits. 30000/15 = 2000

How should I power the LEDs in my buildings, etc.?

I find that 12 Volts is an ideal voltage for lighting buildings etc. on the layout. Cheap 12V DC 30 Amp power supplies are readily available from Amazon for under $20. An old PC power supply also provides a 12V output.

I have some 16V AC power supplies, can I use those?

Yes, but let us look at what AC current looks like again:
If we fed this alternating current into our LED circuit with the diode it would work. (If no diode was included the negative voltage would destroy the LEDs.)

The diode prevents the electricity from flowing in one of the directions, so we would be using only some of the power, like this:
The LEDs would go on and off 50/60 times per second, and that is somewhat ok. This is called half rectified, since we have chopped off half of the wave form. When we look at the lights they seem to be on all the time. However there are some serious problems with this:
  1. If the illuminated object is moving, we will see the LEDs flickering because each time they go on they are in a new place, and we lose the effect of persistence of vision. If one moves one's head swiftly one can also perceive the lights flickering.
  2. If you attempt to make a video of the models, you will most likely get a nasty stroboscopic effect as the frame rate of the video interacts with the flashing LEDs
Fortunately there is an elegant solution, it uses 4 diodes arranged so that both halves of the sine wave get used. It is called a bridge rectifier. You can also buy them ready made.



The four diodes force the positive voltage to always go one way and the negative the other way so the LEDs are off for almost none of time. This is called full wave rectified power. The 'bumps' in the voltage is called 'ripple' and may still produce visible flicker.


There is a solution to this ripple also... we add what is called an electrolytic capacitor, which is like a very fast battery, it charges up very fast and then lets that charge out when the external voltage is below its charged voltage. Let's add the capacitor:



The capacitor has the effect of smoothing the ripples in the current, so the graph looks like this:

There are still a few bumps, but they are negligible for the purpose of lighting the LEDs.
The electrolytic capacitor is a 470 uF rated for 35 Volts.

Note that now that the bridge rectifier has been added, the diode we had before as a safety precaution is no longer needed since the rectifier will prevent current going the wong way. If you think you might connect the LEDs the wrong way, leave it in.

Important note: The polarity of the capacitor is also critical. One side of the capacitor is marked with a stripe showing the side that must be connected to the negative. If you connect it the wrong way it will explode. (The metal tops of the capacitors are even scored so the explosion is less violent!)

Lesson #4: Electrolytic capacitors must be connected with the stripe to negative.

Rectified voltage

In the example above, we started off with 16 Volts AC. We rectified and smoothed that to be a DC voltage. The voltage we have is however, not 16V DC but it is in fact 22.4V DC! This is because the peaks of the sine wave above 16V and below -16V are usually disregarded as they are so short. The rectifier and and capacitor have now made those voltages available all the time so we multiple the AC voltage by 1.4 to calculate the output voltage at 22.4 V DC.

So yes, using a 16VAC power supply can very much be used, but you should rectify and smooth the output and then use 22.4V as your input voltage in the calculations of resistors. Since the 22.4 Volt is so close to the common 25V rating of capacitors, it is suggested to use a 35V capacitor if you have enough space for it or a 25V capacitor if space is tight.

What about those cheap LED light strips?

Everything discussed so far is the same no matter what form the LEDs are, but the LEDs on the long strips are really a whole set of individual LED circuits connected in parallel. Each segment of the strip typically comprises 3 LEDs and their resistor like this:


These strips are designed for 12V DC power, but running them at 12 Volts produces too much light for model work. If we reduce the voltage so that they draw just 0.25mA per segment they make excellent lights.

Calculating the resistor to use when combined with these strips is a bit more complex than normal because the strip is multiple circuits connected in parallel. We first have to determine the value of the resistor in each subcircuit. That is usually easy as there should be a number printed on it - which can be read with a magnifying glass. A '241' means that the value is '24' followed by 1 zero = 240 Ohms. One can also simply measure them with a multimeter.

Now the forward voltage of an LED varies with the amount of current running through it, especially at very low currents, which is exactly how we want to run them. So (after much measuring and head scratching) I have concluded that there are two main approaches to determine the resistance needed. 

Method #1 Measure their voltage directly

Measure their voltage (with a meter) when they are running at the approximate current that you plan to use them. If you don't have a power supply that can supply a low voltage try using a 9V battery to do the measurement.

To measure the forward voltage of an LED, measure between the blue and the green dots with your voltmeter. To measure the size of the resistor you can measure between the blue and orange dots. The red line shows the path of the current from the +12V side through the LEDs and resistor to the negative side.

points to measure forward Voltage and resistance

measuring the forward voltage of an LED


I have found that a strip I have uses LEDs with a forward voltage of  about 2.52 V when they are at 0.25mA

We need to calculate the voltage drop that the segments (the circuit between the cut points, usually 3 LEDs in 5cm of strip) will have on the voltage available. Using the 2.52V value, three such LEDs will account for 2.52V x 3 = 7.56 V 

If we use a 12V supply, that means there are 12V - 7.56V = 4.44 Volts left to get rid of with a resistor. To determine the value of the resistor we also need to know how much current will be flowing through it. If we are aiming for 0.25mA each, we multiply that by the number of segments in the strip. Let's say your circuit will use 4 segments;  4 x 0.25mA = 1mA

  R = V / I   =   4.44V / 0.001 A  = 4440 Ohms

If you also add a diode to the strip to guard against accidental wiring mistakes, you should also subtract the 0.6V that it uses up. In that case we would have:

(12V - 7.56V - 0.6V )/ 0.001 = 3840 Ohms

So we can make one big formula that calculates the series resistor to connect to a strip of any length:

(Voltage available - (Vf * LEDs in each segment) - diode Vf) / (# segments * desired Amperage)

(12V - (2.52V *3) - 0.6V) / (4 * .00025A) =3840Ω

To make this easy, you can use the 'Strip' tab in the spreadsheet and just enter your desired mA, number of LEDs per segment, number of segments, etc. 

Method #2 A pragmatic and simple approach - trial and error

An alternative approach is to cut your LED strip to the desired length. (If you are going to be lighting a train, and each coach is long enough to take 4 segments, and you have 5 such coaches, cut off a strip that is 20 segments long and test that. Cut it into 5 pieces later.)

Add about 8 x 1k Ohm resistors (all in series) and connect it to the power source (see below for train lighting). If it is too bright, add more resistors (in series) until the lights are as dull as you want them. If they are too dark, remove resistors until they are bright enough, and you are done. If you want to change the resistance by 500 Ohms use two 1000 Ohm resistors in parallel.

This arrangement of 1000 Ohm resistors represents 4500 Ohms because two are in parallel to each other, halving their effective resistance.

Resistor rating
Note that the longer the strip of LEDs you use, the more current will be used by the strip and that current also flows through the resistor. Running current through a resistor converts some of it into heat. Resistors are rated by the heat that they can safely dissipate, usually 1/4 Watt (250mW) or 1/2 Watt (500mW). To calculate the wattage needed, we multiply Voltage by the current.

W = V * I =  (12V - 7.56V - 0.6V ) * (4 * 0.00025)  = 0.00384 W = 3.8mW

Since 3.8mW is smaller than 250mW, a 1/4 W resistor will be fine. The longer the LED strip, the more current will be going through the resistor so it will have a bigger need to dissipate heat. The 'Strip table' tab in the spreadsheet shows that you will need a 1/2W rated resistor when you get up to about 100 LED strip segments (5m). 1/2W resistors are only negligibly more expensive than 1/4W ones anyway.

These strips are ideal for lighting passenger cars which is discussed in detail in the next section.

How about lights inside passenger cars?

There are numerous off-the-shelf coach lighting products that use batteries or the track current. They can have a bewildering list of functions and the ability to switch them on and off digitally. Some can also simulate the flicker of fluorescent lights which can be nice for era III onwards. It is however far more economical to make up passenger coach lights using the LED strips. The estimated cost per coach is about 61c and 95c for the parts that handle the power for the whole train. If you wanted to power each coach independently, each would cost about $1.00 plus the cost of the power pickup. This approach also allows you to determine how much of your precious digital track current gets used. By minimizing the power used to trivial amounts, the need to be able to switch them off to save power goes away.
 
If you are running analog and have 16V AC power in the tracks you can treat the LEDs as we did above using 16V AC. If, however, you are running digital trains, then remember the 'shape' of the power available is not the same as sine wave AC.

Since this is AC current we have to rectify it. It is a special type of AC and its characteristics are not the same as sine wave AC.

The frequency of the digital signal is so high that we would not see any flicker, so one might be tempted to go with half wave rectification but that risks using only one half of the digital signal, which could become a problem for the digital consumers, such as locos. I therefore recommend doing full wave rectification.

Note: The peak voltage of square wave is not 22.4V as it was with 16V AC. The Uhlenbrock Intellibox™ in HO mode, puts out -20V to +20V. Other DCC controllers may use -14V to +14V. The way to find out what your system puts out is to measure it, after running it through a bridge rectifier. (Most meters do their voltage calculation of AC voltage assuming it is a sine wave and will not be able to measure the digital voltage properly, but will have no problem measuring the rectified DC.)

Measure the voltage like this:

Once you have rectified the digital track power to DC, the laws of physics inside the moving train are still the same as before. What is different though is that a moving train will sometimes lose power for a short moment when it goes through a turnout or encounters some dirty track (gasp). This can cause the lights of the train to blink off and it looks very unrealistic (and tells people you have some dirty track). Not good. We need to add some anti-flicker capability.

The good news is our old friend the electrolytic capacitor can be used to supply electricity to the circuit for short periods.


But, now another problem can arise. If you have lots of passenger coaches on the layout, when you first power up the digital controller, all these capacitors gobble up lots of current. This is called inrush current. If there is too much current being drawn from the track, the controller may think there is a short circuit and shut down.

So we have to slow the speed at which the capacitor charges up, by adding a resistor. But then it won't let the power out fast when we need it to discharge, so we also add a diode in parallel to the resistor like this:

Now, when the power comes on, electricity moves into the capacitor much slower. When there is an interruption of power, the power can stream out of the capacitor, through the diode, to the LEDs in the circuit.

We now have a pretty good circuit that is very cheap to build and we can light an entire passenger train with this power supply circuit. We can now rearrange the components into a more compact form and get into the specifications...
Components
  • D1, D2, D3, D4, D5, D6: 1N4001 silicon diodes.
  • R1: 1000 Ohm 1/4 Watt resistor
  • R2: <see below>
  • C1: 2200uF 35 Volt capacitor (or 25V if pushed for space) (When ordering, look for Aluminum Electrolytic capacitors - radially wired Eg Mouser part 598-228CKS035M.)
You can also replace D1, D2, D3 and D4 with an off-the-shelf rectifier. Almost any rectifier will do, as most can handle as much as 1A

Keep D6 with the LED part of the circuit since its purpose is only to guard against connecting the LED strips the wrong way.

The resistance of R2 depends on how many segments of LED strip will be powered by the circuit. (One segment is the shortest section that may be cut - usually 3 LEDs & 5cm long.)

Note that a train with coaches, each with lengths of LED strip connected together through the train, is electrically identical to a strip had you not cut it into separate lengths to go into each coach. So the calculations we do for a whole train are the same as powering a strip of the same length.

I have a spreadsheet that allows the nature of your track voltage and the characteristics of the LED strip to be customized, as well as how many segments you want to use. It then tells you the optimal size of R2. Pick a resistor closest in size to the suggested value.  If R2 is more than 500 Ohms, a 1/4 Watt rating is OK. Below 500 Ohms you should use a 1/2 Watt resistor. Here are some typical values for R2:


The bigger the capacitor, C1, the more charge it can hold and the longer the lights will stay on when power is interrupted. Bigger capacitors take up more space, so the selection of the capacitor you use may be governed by the largest space available to hide it. I suggest that if you have a long train, you place this circuitry in a baggage car where there is ample space. 2200uF is a lot and will handle a whole train.

Note, the two output wires that come from this power supply circuit and go to the LED strips along the train must not be connected to the track anywhere, not even to a common ground. You have to run both wires along the train, either through two-pole current conducting couplers, or physical wires.

Using a DC-DC converter instead of a big resistor.

There is yet another method of reducing the power inside a train. Instead of using a large resistor (R2 in the discussion above), one can use a DC-DC converter (aka buck converter), one can take the rectified and buffered current and feed it through the DC-DC converter and then out to the LED strip. The DC-DC converters have an adjusting screw that determines the output voltage, allowing one to bring the 18.5V down to whatever voltage is needed for the string. The voltage will vary based on the length of the string. This allows one to effectively adjust the brightness as desired.


The mini DC-DC converters are also relatively cheap, but one does need to get a good quality one, as poor quality ones with a cheap inductor tend to get hot (bad!) and use up more current than they should. The DROK (from Droking) converters ($8.99 for 5 from amazon.com) are good.


Pros & cons of using DC-DC converter over a resistor
  • Converter advantage
    • It will maintain the brightness of the LEDs when there is a power interruption since it will take the reduced input voltage and still maintain its output voltage until the input drops too low.
    • The ability to vary the voltage with an adjustment screw lets one alter the brightness or even adjust for a different length of LED strips without rewiring the circuit. Identical circuits can be made up for any length of LED strips.
    • The DROK converters have the ability to switch the output on and off. I have not tried this, but I think a digital decoder output could be used to switch the lights on and off without any load on the decoder.
  • Resistor advantage
    • Cheaper (by $1.75 per train)
    • Smaller
    • Does not have the (very small) overhead of about 0.85mA.
    • The lights will slowly dim and will stay lit even after the capacitor drops below the minimum voltage that the DC converter would need to keep the lights at normal brightness. This means they will stay on longer, but start dimming right away.
The Strip table tab of the spreadsheet shows the Voltages one would need for selected LED lengths, to achieve your selected brightness if using a DC-DC converted instead of a resistor.

Lighting approach

When lighting passenger coaches, you have to decide if you are going to add the circuitry to every coach, with each coach providing its own power from the track, or if you are going to have one circuit rectifying the current and preventing flicker, and then run wires down the train to each coach. Those decisions are governed by how you run your trains and if you have to separate the coaches from each other. You may also elect to run wires but have them pluggable. Having each coach have its own circuitry also adds the additional cost of the current pickup from the track and increased drag that that produces. You also have to find space to hide the capacitor.

I do not separate my passenger trains and they live on my layout permanently so I am going for one circuit per train.

Another approach used with 12V LED strips is to feed the power through two lengths of LED strip in series, feeding the negative of the first strip into the positive of the second strip. This approach will only work well if you have an even number of segments. If lighting a single coach, you have to have connections in the middle of the coach. If you split the two halves over two coaches, you cannot carry the current through to the next pair without an additional pair of wires, so I think there is little advantage over having a simple pair of wires running the length of the train, with a single strip in each coach.

When planning adding lights to trains that will be used on a digital system, do not be tempted to use multiple power pickups that are also connected electrically through the train. When the train spans more than one booster/power district it will short the two districts together.

Tail lights
If you are also adding tail lights to a train, those LEDs should be a separate circuit to the one that powers the lights that run the length of the train. This is because the tail lights will likely be two red LEDs (with a forward voltage of 2V each)  and will need their own resistor to govern the current for a 4V circuit. The tail light circuit can (and should) obtain its power from the rectified power circuit and thus is connected in parallel to the lights along the length of the train like this:

If the rectified track power is 18.6 V the calculation of the resistor (R3) is as follows:

R= V / I  = (18.6V - 0.6 - (2 * 2V)) / .010 A  = 1404 Ω

So a 1.5KΩ  1/4W resistor would be ideal and they would use about 9mA. If that is too bright for your liking, use a bigger resistor, 4K would give you a 3.5 mA circuit.

The safety diode (D7) can be left out if you are confident you won't get the wires switched.

The spreadsheet also has a tail light calculator at the bottom of the 'Strip' tab.

Cost of passenger train lighting

Here is a table showing the costs using either the resistor (R2) or DC-DC converter approach.

The most expensive part of the resistor approach circuit is the capacitor at 74c, but that can be brought down to 29c if you buy from AliExpress. The DC-DC converter adds $1.75 to the cost but does provide a lot of flexibility.

The good news is that if one chooses to power the whole train from one power handler you only need one capacitor or DC-DC converter.

table of component costs

As can be seen the incremental cost for 20cm of lighting (one long coach) is just 61c (including the double sided tape to mount it). A train with 5 passenger coaches and a power handler can be illuminated for under $4.00. Depending on how you decided to connect the coaches you may need to add the cost of small plugs, or current conducting couplers, and if there is no power pickup shoe in place, add that in too.

illuminated passenger car
A passenger car illuminated with LED strip


Summary steps for train lighting

If you don't want to bother getting to understand what is going on, you can try these simplified steps:
  1. Decide how many segments of LED strip will be in the train/coach
  2. Cut a length of that many segments
  3. Connect a bridge rectifier (or 4 diodes) to track power. (off)
  4. Connect 8 x 1k Ω resistors in series with the LED strip
  5. Make very sure that the positive output of the rectifier is connected to the 12+ side of the LED strip.
  6. Switch the track power on
  7. If the LEDS are too bright, add more resistors. If they are too dark, bridge over some resistors with a wire until they are the right brightness. (Don't make them too bright)
  8. Count the resistors that were in effect = how much resistance you want.
  9. Decide where you are going to hide the circuitry inside the train
  10. Wire up a capacitor, inrush resistor and diode as shown above and connect to the rectifier
  11. Connect wires from the track power pickups to the input of the rectifier
  12. If lighting more than one passenger coach, cut the strip to length for each car
  13. Connect strip to resistor calculated in step 8 to rectifier+capacitor circuit, attach wires at other end of strip to go to next coach.
  14. Install light strip in roof, run wires out past couplers to next car. (Cross the wires over the coupler to keep them from hanging too low.) Add plugs if you like.
  15. Test
  16. For subsequent passenger cars simply run the wires in, through the strip and out to the next car.
If using the DC-DC converter method, replace steps 4 to 8 with inserting the converter and adjusting the output voltage.

train with LED lights



Room Lighting with LEDs

Sometimes you may want to use LED strips to light the room, not simulating scale lights in the actual models. In this case, you may want to aim for maximum brightness and maybe also the ability to dim the lights to simulate dusk or dawn etc.

For this application you can feed the full 12V from a DC power supply into the LED strips.

I do not recommend the LED strips that can also be set to display different colors. They achieve this by placing red, green and blue LEDs in clusters all along the strip. When set to white and all three colors are on, you see different LEDs from different angles and so the strip takes on different colors depending on the angle you view it at. Stick with white strips.

Dimming

Some strips also come with a small cheap remote controller that lets you switch the lights on and off or dim the strip.

You can also add a pulse width dimmer to the power supply side of a plain LED strip. The pulse width dimmer does not vary the voltage, rather it switches the power on and off very rapidly and it varies the time that the power is on versus off to produce different intensities.

These dimmers cost about $3 and can handle up to 8 Amps!

I used such dimmers for controlling the lights in the ceiling of my layout room. Later I decided I wanted to control them from my layout software so that lighting effects could be synchronized with sounds etc, so I replaced them with a small processor that does something similar.

Where to order components

The two major mail order companies that serve the USA are mouser.com and digikey.com
You can also buy many items from amazon.com and eBay.com (especially the rolls of LED strips).
For extra savings one can also order from China via aliexpress.com - delivery takes a few weeks.

Electrical convention

By convention, we speak of electricity flowing from positive to negative. In reality though, the electrons move from negative to positive.

Disclaimer 

I am not an electronics expert nor professional engineer. I present this information based on my understanding of the concepts and cannot make any warranties or guarantees as to the suitability, completeness or accuracy of any of it. Use this information at your own risk. I am not responsible for any injuries, damages or losses of material, time, and tempers 😤 that may result from reading this content.

Soldering involves using a hot soldering iron and you may burn your fingers. I do not suggest you do so (or any other body parts) by publishing this content. Switch the iron off when leaving the workbench.

Connecting circuits, especially when including capacitors, may result in electrical shocks. Don't touch any circuit with any part of your body that you would not like to conduct electricity. ⭍

V= I * R also applies to mammalian tissue💀.

I hope it is illuminating 💡

Linking

Feel free to link to this page, the link is:

Acknowledgements

I would like to thank Erich Scherer for reviewing some of my circuits as well as suggestions for this page. Any errors are mine.

Richard Howell mentioned using DC-DC converters and Mario Puleo, Tiono, Thomas Smailus and others contributed to a useful discussion about DC-DC converters at the märklin-users forum

Ross Stewart corrected the 0402 size.

Some of the images were created using TINKERCAD