Monday, September 12, 2011

Electronics Part 2: Model Railroading Applications

So now that I've thoroughly confused you last week, let's clear it up a little this week and talk about something more familiar: model trains. Specifically, what on earth does last week's post have to do with model trains? Well....

Let's look at something I've been working on recently. Most of my locomotives don't have working headlights, and I want to fix that. I want LED headlights because they look great, but I can't afford the prices that some of these manufacturers charge. Instead I found a website that sells LEDs and other electronics cheap, but they aren't marketed for a specific purpose. Because of that, the manufacturers can't know what the applied voltage will be on the consumer end, and can't make a resistor recommendation to the customers, meaning I need to figure out what resistor size to get on my own. The manufacturer does, however, say that the LEDs use 2 volts and draws 20 milliamps, or 0.02 amps.

Let's set up the problem. We have a few knowns: First, we know that the LED takes 2 volts. Second, we know that the applied voltage is 12 volts. Because of this, we know that we need a resistor in series with that LED, and we know this resistor must use up 10 volts. We also know that the LED draws 0.02 amps, and because this is a series circuit, we know the resistor and power source current values are also 0.02 amps. So the two things we need to know are the resistance value and power consumption of the resistor so we get the right size. Let's draw a diagram:

What we need to know are the two unknown resistor values, which is easy to figure out. To find resistance, simply divide voltage by current, or 10 volts divided by 0.02 amps. This gives us a resistance value of 500 ohms. To find power usage, multiply voltage and current together for a power value of 0.2 watts. You should never buy a lower value resistor than you need, so if the value you need isn't available, get the next higher value. I bought 510 ohm resistors rated at 1/2 watt just to be on the safe side, and they work fine.

This circuit is great for a single ditch light. You will need two of these circuits, wired on separate functions, for a flashing ditch light effect. I will not get into the programming in this series, but I will cover it at some point. However, my locomotives have two headlight bulbs, one just above the other, and I need an LED in each one. I could use two of these circuits wired to the same function, but I think it is easier to run both LEDs off the same resistor. However, this changes the resistor value, so let's take a look at that circuit.

This is called a series-parallel circuit, because the two LEDs will be in parallel with each other but both in series with one resistor. This complicates the math a bit. Let's identify our known values and fill in a diagram, and I will walk you through the math. First, we know the source voltage is 12 volts. We are using the same LEDs, so we know they use 2 volts and draw 0.02 amps each. They are in parallel with each other, so the voltage stays the same, so the resistor still has to use 10 volts. However, the current is additive in a parallel circuit, so now we have 0.04 amps going through the resistor instead of 0.02. Let's draw a diagram:

This problem looks more complicated, but it's actually just as simple as the last one once you sill in the knowns. We are looking for the same values as last time, the resistance and power ratings of the resistor, and we will find them the same way. Let's divide 10 volts by 0.04 amps. This gives us a resistance value of 250 ohms. Multiplying our voltage and current together gives us a power usage of 0.4 watts. Again, we will use the next higher available value, so in this case I bought 270 ohm resistors rated at 1/2 watt and they worked just fine.

One last thing on my headlight project. My fictional railroad, the Merrimack & Souhegan Railroad, is a short line based in southern New Hampshire. Because the branch lines do not have turning facilities, and the locals are run as turns and in most cases with a single locomotive, this means that most road switchers on my layout will have to run long hood first pretty regularly. This means that they need ditch lights on both ends of the locomotive. In real life this is a common practice in New England. However, since each ditch light needs its own function, that means I need four functions to run the ditch lights. Since I also need two functions to run the headlights, this means I need either a six function decoder, which is expensive, or a separate function-only decoder in addition to the motor decoder, which is also expensive. In both cases, I also have some advanced programming to do so that the correct ditch lights come on at the correct time. I am no master at programming and I don't have the money to spend on expensive decoders, so I sat down to figure out a way to use a regular four function decoder to run all these lights. And guess what? I did. I found a way to simplify programming, save space under the shell, and save money all at the same time by using technology that's been around about as long as electricity: the electromagnetic relay.

But that is next week's topic!

No comments: