After refurbishing my dad’s old Lionel train track switches (see post here), the next step was to get them reliably working with a Raspberry Pi (or Arduino, but the Pi is quicker for me to get set up and running).
First off I have a ~1 minute video on the operation of the switches.
There were a few problems to solve here:
- How to reliably switch the switches at the same time
- How much voltage and current is needed
- How much time is needed to hold the voltage
- How to wire it all up, and write some python code to operate it
First “problem” was how to fire both switches at the same time, so they would always be in the proper orientation. (My track is is a ‘double oval’ where there is an outside and inside oval. Both switches must be set to ‘outer’ or ‘inner’ oval in order for the train to run without derailing). My original thought was to have a set of relays by each switch, but once I gave it some thought I realized that I only needed 3 wires total (Neutral, and a hot to each side of the switch for active switching) I decided to use one set of relays (Rated for 10A of current) to power both switches. This had the advantage of reliability (2 less relays to go bad) and as long as there wasn’t a wiring failure, that both switches would activate at the exact* same time and always be in the same orientation. The downside is we lose the ability to control the switches independently, but that isn’t an issue in this design.
- – Engineers are notorious pedants, and I’m sure someone would send me an email pointing out that the switches would switch delayed by the speed of the electricity in the wire, which is very close to the speed of light. If I wired from the relay, to the 1st switch, and then the second switch, it would take 3 x 10 -8 seconds longer to reach the second switch. In order to make sure that both switches fire more exactly, and more importantly to ensure that both have roughly equal resistance between all the connections, I wired the neutral directly to one switch, and then to the second, and the hots to the other switch and then back to the first.