Introduction: Model Railroad Mainline/Siding Signal Lights Circuit

About: Started playing with electronics to add extra character to my model train layout. The hobby keeps growing.

I began this project for a model railroading friend who was having some trouble getting his signal lights for a mainline/siding to work correctly, or more exactly, in the manner that he wanted. The signal standards are visible at each end of the turnouts used to enter or exit where the siding exists on the mainline route. These are three aspect signal standards: green/yellow/red. One of the turnouts is controlled by a Tortoise switch control and the other by a simpler stall motor switch which has a microswitch installed that will open or close based on the switch position.

For the purpose of this tutorial, when both turnouts are considered closed, it is free sailing on the mainline and both signal lights will show a green signal only. The truth table PDF will highlight the switch position combinations and the on or off lighting of the signal aspects.

A couple of important notes:

  • A closed switch position always produces a green
  • An open switch position always produces a yellow
  • When the switches are NOT in the same position (open or closed) a red is added
  • Thus, a red signal is always accompanied by another colour.


2 - 2p Screw Terminals

2- 4p Screw Terminals

7 - 2n3904 transistors

2 - 150 ohm resistors

4 - 220 ohm resistors

6 - 10k ohm resistors

3 - 20k ohm resistors

1 - CD4070 XOR Gate IC chip

Step 1: How It Works

Refer to the Siding Controls PDF file for the full schematic of the circuit.

The CD4070 IC chip provides XOR calculation on the two inputs. Basically, when both inputs are the same (in my case 0 or 5 volts) the output is 0v. When the inputs do not match (one is 0v and the other is 5v) then the output is 5 volts.

The other parts of the circuit are simple transistor switches that turn on and off with the power provided by the switch (SW1 and SW2) inputs. Please note that the switch inputs are grounded by the GND circuit on the circuit board.

How it Works:
Examining the top circuit for the LED output D1:

The Yellow LED (pin 4 of D1) turns on when the input to SW1 has a positive voltage and transistor Q1 is turned.

The Green LED (pin 3 of D1) turns on when there is 0V on Q3 which in turns causes transistor Q6 to turn on. Q6 is on when Q1 is off and vice versa.

CD4070 U2A XOR is used to control the output of the red signal light. The truth table of the XOR IC matches the requirement of a positive signal when the inputs are not in sync. The IC will output 0V when Both SW1 and SW2 are in the SAME Position (either open or closed). When switches are NOT in the same position (Open or Closed) the output is Vcc and this will turn on transistor Q5 which will then turn on both of the RED leds.

I should note that the resistor values used for current limiting on the signals are just suggestions. I believe on my actual circuit board I used larger value resistors after testing different values with individual lights. I prefer the signals not to be glaring. The circuit is also based on common anode signals which I believe are pretty standard. If your signals come with a common resistor I would suggest removing it and using individual resistors on each of the leds. Different coloured leds tend to have a different forward voltage and therefore current draw (with the same valued resistor). Experiment with this!

Also, I have tested and designed this with a 5v power supply. This circuit should also work fine with 9v or 12v if that is your power supply. If you use a higher voltage supply just increase the resistor values used for the leds. Again, test and experiment. Start at 1 or 2k for the red led and see how you like the output.

Step 2: The Circuit Board

My first working version of the circuit board was done on a breadboard. When the concept was proven to work I then hand soldered the entire circuit, which can be very time consuming. My current working circuit board, and as shown in the video, is a printed circuit board with output files generated by Kicad which is my circuit modelling software.

I have used this site for ordering the PCB's:

Here in Canada the cost for 5 boards is less than $3. Shipping tends to be the most expensive component. I will usually order 4 or 5 different circuit boards. (The second and more circuit boards are about double the price of the first 5). Typical shipping costs (by mail to Canada for various reasons) is about $20. Having the circuit board pre built so I just have to solder in the components is a great time saver!

Here is a link to the Gerber Files that you can upload to jlcpcb or any of the other PCB prototype manufacturers.