Two-aspect Signaling for Small Model Railroads - pymrrsln2
If you have a small model railroad layout like I do and you wished for simple solution to do automatic signaling, I might have something for you. My layout uses Digitrax DCC. Digitrax offers several components to build signaling. In the most simple version, you need block detection and some signaling components. They do not offer signal heads, so you have to get those from somewhere else - I used Atlas’s.
My layout is small, I have 7 blocks that I wanted to guard with signals. In my setup, I was not aiming for the maximum realism, because I would need to add transponding, so that the system would know which loco is where and could ask for the direction of travel, which we would need to set the signal heads downstream from the train. With having just the information which block is occupied, we can achieve a simple 2-aspect signaling. Basically, when a train enters the block, we set the guarding signal heads to red and when the train leaves the block, we set them to green. Simple.
Now, when I tried to use JMRI, the whole setup of defining the layout, connecting the blocks, etc. was just way too much for such a small layout. All I need is to have a link between blocks and switch numbers (the signals are operated by setting switches to thrown or closed - that will set green, red, yellow, or flashing yellow). So I searched the internet and found a specification of LocoNet. LocoNet is just a serial bus which can be connected to a computer and we can talk to it via serial port. Well, that’s just a simple computer science exercise ;-)
So, for the programming language I picked Python even though I am not a big fan of it, but I needed a language that is easy to handle by potential users and is not compiled - not everybody is a computer geek and who wants to deal with complicated build systems anyway. We need something easy to deploy. There is a pyserial package that can be installed via pip and it does all the heavy lifting for us, so we can focus only on sending the right data to the bus and reading it back.
So, in order to use pymrrsln2, you need to have a computer that can run python and has an USB port. It can be an old PC, Raspberry Pi, whatever. You connect PR3XTRA to LocoNet and the other end goes to your computer. You need to setup a simple file that describes the serial port (its name and communication speed, I provide a simple example to help out out) and another file that describes your layout setup. Then you just run one script and you watch the magic happen ;-)
More technical details can be found on pymrrsln2 web site.