The Rusty Spike

A Railroad Fan's Website


In Lieu of a Breadboard: PCB LED Test Harness

PCB LED Test BoardHere is a project idea for some of you. If you are anything like me and you are experimenting with an Arduino or TI Launchpad for the purposes of your model railroad, then you likely find yourself adding and removing LEDs and associated resistors to/from breadboards over and over again. So it dawned on me: Why not solder some LEDs and appropriate resistors for a 3.3V source onto a spare PCB project board and slap some headers on there? Well, since I was waiting for some parts for other MSP430 projects, I did just that!


Read More


Basic Electricity 101: DC Circuit Analysis

Now assuming that you read through Section 1, we are going to continue on trucking through Basic DC theory and apply even more realistic real world examples. Lets get it on.

Section 2.1: Series Resistive Circuits.

ALL elements comprising a circuit have resistance. Period. ALL elements of a circuit that consume power have resistance. And since resistance is the thing that converts current to heat, we need to make sure we know how to calculate where our resistence in our circuit is. Too much current flowing through a too thin a wire (thin wire has higher resistance per foot) could generate enough heat in the wire to melt it. Thankfully, working with resistance values in circuitry is not all too difficult.

To add resistances in series with each other, just add them together:

Rt = R1 + R2 + R3 + … R x

Example #2.1:


A grain of wheat bulb is rated for 40mA at 14V and you want to put three of them in series but have these questions:

  1. What is the internal resistance of each bulb?
  2. What is the rated Wattage (brightness) for each bulb?
  3. What Wattage will each bulb actually be operating at?
  4. What is overall current draw off my battery?

Lets field the first question first:

R = E / I     Ohm’s Law solved for Resistance

R = 14V / 0.040A     Value substitution

R = 350Ω     Answer in Ohms

Okay, so the light bulb has an ideal resistance of 350Ω, now we solve for the rated wattage for that bulb:

P = I * E     Power Eqn

P = 0.040A * 14V     Value substitution

P = 560mW     Answer in Watts.

Actual Wattage for the bulbs in the circuit isn’t a 1 step solution. We need Voltage applied to each bulb and current run through the bulb, which may or may not be rated voltage and current. First thing’s first, we need to solve for overall circuit parameters:

Since we know the ideal resistances of the bulbs, add them together:

Rt = R1 + R2 + R3     Series addition of Resistance

Rt = 350Ω + 350Ω + 350Ω     Value substitution

Rt = 1050Ω     Answer in Ohms

Now total circuit current(Q#4):

I = E / R     Ohm’s Law solved for Current

I = 12V / 1050Ω     Value substitution

I = 11.4mA     Answer in milliAmps

We have all the data we need to move on to Q#3, but lets calculate the voltage drop across one of the bulbs for practice:

E = I * R     Ohm’s Law solved for Voltage

E = 11.4mA * 350Ω     Value substitution

E = 4.0V     Answer in Volts

Alright, lets update our schematic with all these fancy numbers!


Okay, lets calculate the ACTUAL Wattage the bulbs will be at:

P = I * E     Power Eqn

P = 11.4mA * 4V     Value substitution (remember, its the voltage applied to the bulb, not the overall circuit voltage!)

P = 45.6mW     Answer in Watts.

Rated at 560mW, but glowing at 45.6mW…. that’s only 8% brightness! Yuck!

Section 2.2: Parallel Resistive Circuits.

Parallel Resistances are a tid bit more annoying to add together:

Rt = 1 / ((1 / R1) + (1 / R2) + (1 / R3) + … (1 / Rx))

Example #2.2:


Okay, the series arrangement of your bulbs just didn’t work the way you wanted, so now you are going to try them in Parallel but still have these questions:

  1. What Wattage will each bulb actually be operating at?
  2. What is overall current draw off my battery?

Actual Wattage for the bulbs in the circuit still isn’t a 1 step solution. We need Voltage applied to each bulb and current run through the bulb, which may or may not be rated voltage and current. First thing’s first, we need to solve for overall circuit parameters:

Since we know the ideal resistances of the bulbs, add them together:

Rt = 1 / ((1 / R1) + (1 / R2) + (1 / R3))     Series addition of Resistance

Rt = 1 / ((1 / 350Ω) + (1 / 350Ω) + (1 / 350Ω))     Value substitution

Rt = 116.7Ω     Answer in Ohms

Now total circuit current(Q#2):

I = E / R     Ohm’s Law solved for Current

I = 12V / 116.7Ω     Value substitution

I = 102.9mA     Answer in milliAmps

Here we need to take a small break and talk about how current reacts in branches of a circuit. Quite Simply, it acts much like water flowing through a piping system. On our schematic, I have labeled 3 junctions where current splits (A, B and C). Now we know that 102.9mA is flowing into junction A from the battery, but we dont know how much is flowing out of the other two branches. We DO know that the current flowing out the other two branches of the junction MUST equal what is flowing into the junction(just like water flowing through a Tee in a piping system). This is where we do individual circuit branch calculations. Lucky for us, all of our branches are the same so we only have to do it once! We need to figure out how much current is flowing through Bulb A (the leftmost one):

I = E / R     Ohm’s Law solved for Current

I = 12V / 350Ω     Value substitution

I = 34.3mA     Answer in milliAmps

Well you may have noticed that 34.3mA is 1/3 of our total circuit current of 102.9mA. Logically following, if full circuit current is flowing into junction A from the battery and 1/3 of it is flowing out the branch that contains Bulb A, then 2/3 of the current must be continuing on to junction B.

One thing to note is that the voltage is not divided at the junctions. Since voltage doesn’t ‘flow’ it can’t be split up in this fashion. Each branch of this circuit has the full 12V applied across it.

Alright, lets update our schematic with all these fancy numbers!


Okay, lets calculate the ACTUAL Wattage the bulbs will be at:

P = I * E     Power Eqn

P = 34.3mA * 12V     Value substitution

P = 411mW     Answer in Watts.

411mW is still not the rated 560mw, but its nearly 75% of rated wattage and that will be much MUCH brighter than 8% of rated wattage! The reason we will not be able to reach rated Wattage with any circuit configuration is because we are using a 12V source when the bulb is rated for a 14V source. In all actuality, manufacturers do this on purpose for exactly the case we have been calculating with. We are running our bulb at 25% less that maximum and we are likely to see 2x-3x longer bulb life because of it.

Pro/Con breakdown of our Series and Parallel examples:

Series Pro:

  • Lower overall current draw
  • Lower overall heat.
  • Simpler wiring.

Series Con:

  • Difficult to get individual loads up to ratings.
  • If one bulb goes out, all bulbs go out.(Google for
    “troubleshooting those damned Christmas lights”)

Parallel Pro:

  • All branches receive full circuit voltage and therefore can
    pull maximum available current
  • System Resillience. If one branch fails open (Not shorted)
    then all other branches remain operational.

Parallel Con:

  • Can quickly lead to incredibly complex wiring.
  • Current load can reach levels that may be dangerous for the
    gauge wiring you are using. In our example, the wires running from the
    battery would probably have to be of larger size than that of and
    individual branch.

Section 2.3: Diodes and Light Emitting Diodes (LEDs)

Alright, now on to a subject that I think is probably the most beneficial to the average model railroader: Diodes. A diode is nothing but a solid state device that allows current to flow through it in one direction but not the other. If a diode has the voltage applied to it in the proper polarity, then it is said to be forward biased. If a diode has the voltage applied to it incorrectly, then it is said to be reversed biased.

This is the schematic symbol for a diode:


The arrow represents the direction that the diode will allow current to flow, in this case left to right.

A reverse biased diode will not allow current to flow through it. Like all things electrical, this too has its limits. I had a Navy Chief tell me once, “Son, if you put enough voltage on anything, it’ll conduct. Bricks. Wood. Cats. All conductors when matched against 1 million volts (lightning).” Following true to the statement, a diode has a limit of reversed biasing voltage that it can handle before it breaks down and fails. Oddly enough, this can be VERY useful. A Zenier diode actually is designed to work this way. Zenier diodes are the key part of voltage regulators, but we will talk about them much later.

A forward biased diode conducts with very little resistance. Due to the way it is built, diodes almost always drops 0.7 – 0.9 volts. This is key to understanding how they affect a circuit and can also be a very useful feature (great for current detectors)!

Example #2.3:


In the given circuit, calculate how much current will the 10W bulb draw.

Alright, just looking at the circuit we can see that the only other component is a diode. Tracing around the circuit from the battery, we can see that if the diode drops the 0.7V – 0.9V it is supposed to, then the light drops the remaining 11.3 – 11.1. Lets assume worst case senario and the diode frops 0.9V. First things first, we need to solve for the internal resistance of that light bulb:

P = (E)2 / R     Power Eqn

R = (E)2 / P     Solve for Resistance

R = (12)2 / 10W     Value substitution

R = 14.4Ω     Answer in Ohms.

Now that we know the resistance of the light, we can solve for amp draw of the light: (remember, the light is only being exposed to 11.1V due to the 0.9V dropped by the diode.)

I = E / R     Ohm’s Law solved for Current

I = 11.1V / 14.4Ω     Value substitution

I = 771mA     Answer in milliAmps

Well lets hit the power and see if we are right:


172 microAmps!?!?! Oh wait, look at the diode. Its in backwards! Lets fix that and try again:


Well lets hit the power (again) and see if we are right:


Pretty close! Looks like this diode is dropping 0.827V instead of our assumed 0.9V and that is what caused out amperage to be off ever so slightly… but we still sucessfully illustrated how a diode functions in a dc circuit!

Example #2.4:

In this example, we explore the use of a variant of the diode, the Light Emitting Diode (LED). Functionally the same when it comes to the current flow stand point, but the amount of current that can flow through it while forward-biased is now severly llimited. A diode as described in example 2.3 can easily handle up to 2 or more amps, whereas the average LED is rated for 20mA max. That being said, one must take care to keep LED current below its limits as they are not as forgiving of overcurrent situations as light bulbs are.

Notice that the schematic symbol for the diode has changed. Two little arrows are added to symbolize light being emitted, hence, Light Emitting Diode.

Take a look at these two diagrams. Can you figure out why the first one doesn’t work, but the second one does?


I hope its pretty obvious as I tried this trick on you once already. The diode is installed backwards in the first one, but correct in the second. Lets try to recreate the numbers that the multimeters in the second picture are giving us. We need to treat the LED as if it doesnt have any resistance and ‘throttle’ current flow with a dropping resistor. Our target current flow is 20mA and we are assuming that the LED will drop 0.75V:

R = E / I     Ohm’s Law solved for Resistance

R = 11.25V / 20mA     Value substitution

R = 562.5Ω     Answer in Ohms

562.5Ω is what we need to have exactly 20mA flowing through the LED. Now LEDs are typically very bright and we also don’t like running our lights and LEDs at 100% anyways, so lets pick 660Ω resistance. (Besides, I couldn’t find any other resistor closer to 562.5Ω 🙂 )

I = E / R     Ohm’s Law solved for Current

I = 11.25V / 660Ω     Value substitution

I = 17.05mA     Answer in milliAmps

Look at that, nailed the calculation. Good job! Personally, on my layout I use 1,000Ω (or 1kΩ) resistors because it makes the math easier(12V/1,000Ω = 12mA) and keeps the LEDs at a good brightness.

Example #2.5:

Lets revisit our old friend from the DC Cab Bus days: the DPDT toggle switch. For those of you know familiar with our friend, DPDT stands for Double Pole Double Throw. 2 seperate circuits, 2 positions each. When wired a specific way, a DPDT switch can take normal 12V DC and reverse the polarity of it and was used very extensively in pre-DCC Loopback control.

Take a look at these illustrations and keep your eye on the voltmeters on either side of the DPDT as it throws:



Voltage polarity on the battery side of the switch remains constant where as voltage polarity on the other side of the switch is variable.

Now when I was wiring up my 2 light signals on my very first layout (I was 10), I said to myself, “Man, running 4 wires to each signal from my power pack is really annoying, plus all the toggle switches are putting a hole in my allowance! There has got to be a better way!” A week later it hit me, why not use a modified version of the loopback control DPDT theory:



With the switch in the control panel reversing the polarity, I can consolidate down to two wires and instead of two resistors, I only need one! Not to mention the mess of wires I helped to eliminate on the back of the signal itself. Basicly solder the opposite leads of the LEDs to each other and then I only have to run 2 wires down the mast. If it is a metal mast then you can solder one set to the mast and only have to run ONE wire down the mast. It was then when I knew that LEDs rock.

Now, granted, a sophisticated layout will not drive their signals with DPDTs, but rather with automatic circuitry, so I have devised a circuit that I call a Red Stable LED Amp (RSLA), that can take a simple on/off signal (One wire digital On/Off) from just about anything and drive a two LED config like the one above. (I’ll will post this simple circuit later)

Well I thank you all for your attention! I do not know at this time what section 3 will cover and I hope that I will get a responce either via email or Model Railroader Magazine Forums as to what else people would like to see explained. If you have any comments or improvement ideas please don’t hesitate to use the webmaster mailto at the bottom of the page.


Basic Electricity 101: American Wire Gauge Chart

gauge Diameter Inches X-Section (in2) Diameter mm X-Section (mm2) Ohms per 1000 ft Ohms per km Maximum amps for chassis wiring Maximum amps for power transmission
OOOO 0.46 0.166196 11.684 107.222966 0.0490 0.16072 380 302
OOO 0.4096 0.131772 10.40384 85.014313 0.0618 0.20270 328 239
OO 0.3648 0.104524 9.26592 67.434449 0.0779 0.25551 283 190
0 0.3249 0.082909 8.25246 53.489874 0.0983 0.32242 245 150
1 0.2893 0.065736 7.34822 42.410073 0.1239 0.40639 211 119
2 0.2576 0.052119 6.54304 33.625122 0.1563 0.51266 181 94
3 0.2294 0.041332 5.82676 26.666068 0.197 0.64616 158 75
4 0.2043 0.032782 5.18922 21.149928 0.2485 0.81508 135 60
5 0.1819 0.025988 4.62026 16.766312 0.3133 1.02762 118 47
6 0.162 0.020613 4.1148 13.298485 0.3951 1.29593 101 37
7 0.1443 0.016355 3.66522 10.551272 0.4982 1.63410 89 30
8 0.1285 0.012969 3.2639 8.367166 0.6282 2.06050 73 24
9 0.1144 0.010279 2.90576 6.631690 0.7921 2.59809 64 19
10 0.1019 0.008156 2.58826 5.261633 0.9989 3.27639 55 15
11 0.0907 0.006461 2.30378 4.168566 1.26 4.1328 47 12
12 0.0808 0.005128 2.05232 3.308224 1.588 5.20864 41 9.3
13 0.072 0.004072 1.8288 2.626861 2.003 6.56984 35 7.4
14 0.0641 0.003227 1.62814 2.082036 2.525 8.282 32 5.9
15 0.0571 0.002561 1.45034 1.652131 3.184 10.44352 28 4.7
16 0.0508 0.002027 1.29032 1.307674 4.016 13.17248 22 3.7
17 0.0453 0.001612 1.15062 1.039845 5.064 16.60992 19 2.90
18 0.0403 0.001276 1.02362 0.822967 6.385 20.9428 16 2.3
19 0.0359 0.001012 0.91186 0.653072 8.051 26.40728 14 1.8
20 0.032 0.000804 0.8128 0.518886 10.15 33.292 11 1.5
21 0.0285 0.000638 0.7239 0.411587 12.8 41.984 9 1.2
22 0.0254 0.000507 0.64516 0.326919 16.14 52.9392 7 0.92
23 0.0226 0.000401 0.57404 0.258815 20.36 66.7808 4.7 0.729
24 0.0201 0.000317 0.51054 0.204722 25.67 84.1976 3.5 0.577
25 0.0179 0.000252 0.45466 0.162360 32.37 106.1736 2.7 0.457
26 0.0159 0.000199 0.40386 0.128105 40.81 133.8568 2.2 0.361
27 0.0142 0.000158 0.36068 0.102176 51.47 168.8216 1.70 0.288
28 0.0126 0.000125 0.32004 0.080448 64.9 212.872 1.4 0.226
29 0.0113 0.000100 0.28702 0.064704 81.83 268.4024 1.2 0.182
30 0.01 0.000079 0.254 0.050672 103.2 338.496 0.86 0.142
31 0.0089 0.000062 0.22606 0.040138 130.1 426.728 0.7 0.113
32 0.008 0.000050 0.2032 0.032430 164.1 538.248 0.53 0.091


Basic Electricity 101: Equation Reference

Ohms Law



I = E / R

Where E = Voltage(Volts), R = Resistance(Ω), and I = Current (Amps).

Ohm’s law can be re-written to solve for any of the parameters:

I = E / R     Solved for Current

R = E / I     Solved for Resistance

E = I * R     Solved for Voltage


DC Real Power

P = I * E     Used when you only have the Voltage and Current components

P = (E)2 / R     Used when you only have the Voltage and Resistance components

P = I2 * R     Used when you only have the Resistance and Current components



Basic Electricity 101: Table of Contents

The Rusty Spike