Saturday, February 24, 2024

Getting Way Too Excited About Terminal Strips

In my last post about replacing the Vasona Branch's signal controller, you might have spotted those odd terminal strips in the pictures of the new signal controller. These are the Dinkle modular terminal strips (the 2.5N size) intended for professional use on industrial controllers and electrical panels. As someone who grew up using the vintage Molex black terminal "barrier" strips from Radio Shack, the terminal strips definitely feel like I’m in a new century of wiring practice. The individual terminals in multiple colors clip together onto a DIN rail, a common mounting bracket for electrical equipment like controllers and circuit breakers.

I found them great for model railroads (as compared with the traditional terminal blocks) for a few reasons:

  • packs more terminals in the same space - about 3/16" per terminal
  • multiple colors so easy to identify terminals and polarity
  • inset test points for safer testing with voltmeter
  • supports adding jumpers for wire-free connections between strips, and two jumpers allowed on any terminal.
  • terminals are covered, so loose wire less likely to touch others.
  • able to reconfigure as wiring changes - possible to pop terminals out of the middle to change colors, or move end clamp blocks to add terminals.

Close-up of the Dinkle 2.5DN terminals showing how they're wired and attached. Terminals are 3/16" wide, wire is 22 gauge.

The price is a bit more than terminal strips from Amazon; they work out to about 30c a terminal compared to 12c a terminal for the classic terminal strips. (They're all a deal compared to $4 each at Radio Shack back in the 1980's!) The other challenge is that getting an assortment of colors requires buying a box of 100 terminals at a time - that’s $30. Getting a good assortment (red, black, green, yellow, blue, white, and brown) requires spending about the same as a plastic locomotive. You’ll also need some of the DIN rail, and some of the end clamp blocks for securing a row of terminals. (For our low voltage uses, you don’t need the thin plastic endcaps to cover the last terminal in a row.) I’m planning on using all I need then selling off spare terminals to someone else if I've got enough unused terminals. I could also imagine having a group of modelers team up and share an assortment.

Jumper with every other pin cut. With these, I could line up a row of alternating green and white terminals for the different switch machine power feeds, then use two jumper barss to connect all to power coming in from a single pair of terminals.

The colored terminals are particularly nice for documenting the wiring. I use different colors for DCC supply vs terminals going out to the tracks (red/white vs red/black), and could color code for signals easily (red/brown and green/brown terminals for “upper” and “lower” signal lights at same location. Sets of terminals can be connected together using jumper bars that fit into the top (and don't interfere with the screw terminals.) 10 terminal jumper bars are available, and can be cut shorter to gang several adjacent terminals together. For the switch motor power, I ended up cutting every other pin from a pair of the jumper bars so that I could feed in the two wires for power to one set of terminals, and have power distributed to all the other pairs simultaneously.

The color coding and labeling also helps me double-check wiring and remember how things are connected years later. When I rewired my DCC track connections using the new terminal strips, I realized I’d mis-connected power from multiple boosters to different stretches of track, probably because I lost track of which terminals were for which section of the railroad. That mistake caused me to melt at least one locomotive when it shorted against a switch but was still getting power from a different booster.

Drawbacks? I needed to use a smaller screwdriver to fit the protected holes for the screw terminals - I couldn’t grab any random home repair screwdriver to turn huge screw heads. The terminals also bent a little bit when pulled by larger wires like solid 12 gauge DCC buses, but work fine for smaller wiring.

One of the rewired panels. It's much easier to understand now!

I’m slowly going around the layout, cleaning up wiring, adding labels, and adding the new terminal strips. I’m very, very happy with these - the terminal strips make it easier for me to understand the wiring even years after I’ve done it, and they make the underside of the layout look neat and organized. I suspect I'll love the terminal strips even more in ten years when I need to figure out a rewiring I did in the distant past.

If you're interested in checking these terminal strips out: I got my Dinkle terminal strip parts from - search for "Dinkle 2.5N". Some sellers offer the components - separate purchases for boxes of 100 of each color terminal, for the end brackets which hold the terminals in place, the DIN rail, and the jumpers. Others offer assortments of 20 terminals of specific colors for common electrical projects such as solar panel controllers. The little assortment was a good way for me to decide the terminal strips were for me. I cut my initial cost when buying full boxes of connectors by just getting a few colors of terminals that I needed for some specific tasks such as re-wiring switch machine power. (I was using just green, white, and yellow for wiring connected to the switch machines.) I later got boxes of the other terminal colors as I rewired areas with other wire colors.

You can also see the terminal strips in use on the layout - the Vasona Branch will be open for tours at the NMRA Pacific Coast Region's 2024 Convention April 24-28, 2024 in San Jose.

Friday, February 23, 2024

Big Changes At Signal Gulch

Semaphores at the east end of Glenwood siding.

When is a model railroad “done”? Some might say it’s when it’s complete - when every scene is detailed and when the trains are running well. Some might say that a model railroad is always being changed, so it’s only “done” when it’s being torn down. I’ll throw out another option - our model railroad is “done” when we’ve confirmed that it’s the right design, when we’ve built enough to know “this is what it’s going to stay like”, and when we’re satisfied with the condition. One easy way to know when we’re satisfied is when we move from building new stuff to having to make big infrastructure changes - replacing a command control system, or changing control panels, or fixing other normally-invisible bits of the layout. If we’ve decided to do some wholesale replacement of some invisible aspect of the layout, that must mean the layout’s lasted long enough for us to need to do big repairs and that we’re happy enough with the layout to do the improvement instead of tearing down and starting a new one.

In my case, replacing the signal system suggests that I’ve done pretty good with this layout.

One of the pain points for my Vasona Branch layout over the last few years has been the signaling system. The real Los Gatos - Santa Cruz branch had automatic block signals (ABS) installed when the line was reconstructed after the 1906 earthquake. (Read Carsten Lundsten’s explanation of SP’s ABS signals here to learn what automatic block signals mean, and how the SP operated them.) The SP assumed the Los Gatos-Santa Cruz line was going to need increased capacity for future San Francisco - Santa Cruz traffic. As they upgraded the line from narrow gauge to standard gauge, they also added the automatic signals to minimize the effort of running trains over the mountains. In the narrow gauge days, keeping two trains off the same track required staffs and other physical tokens, or required explicit train orders to carefully control movements. Having multiple trains follow each other in the same direction was tedious and slow. The automatic block signals got rid of some of this work, allowing railroad crews to know the track ahead was safe to occupy. Note that ABS signals only provide protection, rather than authority. A green signal means that the track ahead is clear, not that your train is allowed to occupy that track. Those train order operators at the stations along the line are still needed to let trains know when they're safe to go.

On the model, the signaling system consists of a bunch of signals placed at intervals along the track, and a signal controller hidden underneath the layout. The controller keeps track of which tracks are occupied using detector circuits and notes which switches might be thrown away from the main line, and sets the ABS signals accordingly. Soon after I’d laid the track on the upper level of the Vasona Branch, I bought a pair of signal controllers - SIC24 (“Signal and Indicator Controllers”) from Team Digital. The SIC24 is a small circuit board with a programmable chip on it; using a DCC programmer (or LocoNet), I could program in signal logic so that if a particular track detector indicated a train was present, or if the switch on either end of a single track was thrown wrong, a signal would go red. The Team Digital boards could also be connected together so that an input on one board could affect a signal output on the other. I used two boards for the needed 16 inputs and 48 outputs. All the signals were within about 10 feet of the SIC24 boards, so I connected all the signals with twisted-pair code 26 phone wire - no need for scattering electronics around the layout.

Old signal controller. Not my best work, but it worked for more than ten years.

The photos shows one of the two SIC24 boards, and the phone cable providing the connection to the other board. This wasn't my neatest job, but it worked. You can see the signal power (large green wires with suitcase connector taps), inputs are yellow wires to the left, and signals are green/white and red/white wires below. I'd realized it was easier to put resistors on all the inputs and outputs here, so they're soldered onto the wires leading to the terminal strips. The odd shape of the plywood is because it's a scrap left over from cutting roadbed for curved track. I was unsure enough about whether the signals would be interesting that I didn't bother to build for good appearances.

The SIC24 boards generally worked well. They “just worked” when the power came on, they had sufficient smarts to run ABS, they were configurable enough to handle a couple of non-standard layouts on the place, and they didn’t require having a computer in the garage with the layout. Over the years, though, the SIC24 boards did start showing problems. One problem is that there’s no way to debug what’s going on; if the indications weren’t making sense, it was hard to diagnose exactly what was happening without attaching a voltmeter to inputs and trying to remember how I’d programmed the boards several years before. I ended up building a little circuit using an Arduino microcontroller board that could listen to the two cards talking and show on a tiny screen which inputs were changing, but that was clunky to use, requiring me to crouch under the layout, plug in the device, and look at a tiny 2" screen to understand what inputs were seen. Over the years, there were also times where it seemed that bits of the signal programming were getting lost. Because I don’t have any Digitrax equipment, reprogramming the cards meant detaching them from the layout, carrying them to a programming track, and attempting to reprogram the whole card from JMRI. I’d then have to reattach the card and see whether the change took - whether the signals now worked correctly. If they didn’t, I had to guess whether I’d mis-programmed the card or if the card was having problems. The several minute delay between making a change and seeing if it worked wasn’t fun, and caused me to give up on several bad signal problem.

I’d finally gotten frustrated enough to decide to replace the fifteen year old signal system a couple years ago. There’s plenty of choices out there, both commercial and home-made. The current NMRA Layout Command Control (LCC) standard defines how to build interoperable signal systems without a central computer. The LCC boards are expected to be scattered around the layout near the signals, then connected via a common bus to communicate. RR-CirKits is selling its Signal LCC and Tower LCC boards that work a lot like the SIC24s I’m currently using. However, they’ve still got the problem that debugging what’s going on requires a computer in the garage, increasing the work required for debugging. It also required me to get up to speed on a new technology, and I’d found some of the online manuals cryptic. Another possibility would be to go in the direction of Bruce Chubb’s centralized CMRI (Computer Model Railroad Interface). CMRI systems have a computer program control the signals, and defines how the different boards scattered under the layout all talk to the central computer.

Both of these are a bit of overkill for me. CMRI seems intended a larger and more complex layout than I have, and has expectations about having a desktop computer present running specific software. LCC has the decentralized and hardcoded logic that I liked from the SIC24, but has similar problems with monitoring and debugging problems, and required me to come up to speed on how LCC worked.

Unfortunately, my day job is as a software engineer, and so whenever I come across “do I buy something to make this happen, or do I just roll my own?”, I’ll often decide to go and build it. That’s often seen as a wasteful choice - why rebuild something that’s already available on the open market? However, for a small home layout, building my own makes more sense. I’ll know the design, know how to debug it when it breaks, and won’t be forced to do upgrades.

In a perfect world, I’d have a tiny Linux computer under the layout controlling the signals, I’d be able to write my own code for controlling the signals, and I’d be able to run a little web server to show the current status of the signals. That’s not a hard thing to do these days; I can buy a Raspberry Pi single board computer for $50. The only question was how to control the signals.

To keep my “no computers in the garage” rule, I chose to build from the Raspberry Pi. This is a little computer that’s the size of a deck of cards, but runs the UNIX operating system and can be logged into and programmed just like a larger computer. It’s easy to hide away, starts up within a minute, and is infinitely configurable. To handle the inputs from sensors on the layout and to power the LEDs for the signals, I chose Model Railroad Control System’s IOX32 boards, small boards with 32 inputs or outputs that can connect to a computer. The IOX boards are built for CMRI based layouts, but the way they talk to the computer, using the standard I2C wiring that lets different devices in a single computer talk, means they can be connected to the Raspberry Pi directly. I ended up getting a Raspberry Pi “hat” - an add-on circuit board that attaches to an expansion port on the Raspberry Pi - to provide the I2C connections. Finally, to help debugging, I bought a small two line display from one of the online electronics companies. This board also talks to the Raspberry Pi using I2C, and can be told to display short messages to help debugging.

This photo shows the new signal controller mounted on plywood. The terminal strips for power, inputs, and outputs is at the top. The Raspberry Pi is the box with the red board in the lower left. The IOX32 boards are to the right of the Raspberry Pi, and the display and 5 volt voltage converter for the IOX32s is to the left of the Raspberry Pi. The crossing wires were needed to match the layout of the terminals on the old and new boards.

As can be seen from the photos, the signal system has a lot of wires going in and out. In order to make the replacement go smoothly, I set up the new system on a plywood board with terminal strips for all the connections, then wrote the software to control the signals and tested it on the bench. This also helped me confirm that the IOX32s could correctly drive the LEDs I use for signaling. More importantly, I made sure the terminal strips roughly matched the layout of the existing board so I could disconnect the old board, detach the old wires, put in the new board with controller, and reattach. I also made a few very good choices to help installation - painting the board with the electronics white for easier viewing under the dark layout, printing up very clear labels indicating the purpose of each terminal, and making sure I had good terminal strips for attaching the connections.

New signal controller in use. LEDs are for signals that aren't yet connected - I've added LEDs on the terminal strip to check their state.

Finally, I took a deep breath, detached and marked the existing cables, pulled out the old controller, and put in the new one. The new system required a bunch of manual work - soldering extensions on too-short wires, changing how some of the detector circuits were powered to ensure a safe common ground between equipment around the layout, and slowly reattached and tested that the signals still worked. This all happened within a couple long days, but it went well with no surprises.

The Raspberry Pi did make it easier to debug. Checking out the existing signals, I found one of my long-lived problems was an incorrectly-attached input for one of the switch positions. I also found some incorrect assumptions in my signal programming, and with a few lines of programming changes was able to get the signals working like the real thing. Debugging is, for now, looking at text logs spewing from a computer program, but I’m looking forward to writing some code to show the layout state on a web page next. I even added a lamp test action at start that flashes all the signals - this makes it easy to double-check that all LEDs are connected and are working.

The biggest drawbacks? The Raspberry Pi does have more complexity. It's a full fledged computer with a boot disk (stored in these modern times on a MicroSD flash memory card.) If the boot drive gets corrupted, then the signals won't work. I’ll need to keep a backup SD card just in case things break.

I must be happy with the Vasona Branch, because I’ve done a big wholesale replacement of the signal system. It took several weeks to get the home-brewed signal controller ready, but all the planning and preparation made swapping the old for the new an incredibly pleasant exercise. I now have much better control over the signal systems, can better understand why it misbehaves, and can quickly fix it so it works correctly in a prototype manner. There’s still lots to do before the layout is fully scenicked, Being willing to do this wholesale fix, though, reminds me how happy I am with the current layout, and how far I’ve come.