Blog & News

About the Model Railroad

RTAC Software


The Randall Museum in San Francisco hosts a large HO-scale model model railroad. Created by the Golden Gate Model Railroad Club starting in 1961, the layout was donated to the Museum in 2015. Since then I have started automatizing trains running on the layout. I am also the model railroad maintainer. This blog describes various updates on the Randall project and I maintain a separate blog for all my electronics not directly related to Randall.

2022-01-06 - Automation Maintenance

Category Randall

On the software side, while traveling during the xmas break, I have spent time cleaning up the Conductor source code, which is my script-based software that drives the entire model layout automation. I have not changed any functionality, just done maintenance on the code base; I have modularized the code to split the parser and the script engine into an engine module, and I have updated all the dagger components to make it easier to write tests for just the scripting engine.

I have remotely deployed the new version on the layout, and as desired this update was totally silent and unnoticed.

On the train model side, we’ve had issues with the Branchline for a little while.

Last month, the 2-car Santa Fe RDC from Rapido stopped working. I “solved” that by just running it with only one of the two RDC cars. The unit is also not doing sound anymore, at least not in a consistent manner.  That’s unfortunately the second Rapido RDC unit that developed similar problems. The small motors they use for each truck is apparently the weak link, and since they use two of them, the unit can’t run well once one of the motors fails. For the RDC SP 11, I worked around that by disconnecting one of the motors, making it single-truck powered, which is fine on our flat branchline. I could do that too here, however it won’t solve the sound issue (it does make sound from time to time IIRC so it’s not a speaker/wiring issue, maybe more like a decoder issue).

The other way I “fixed” the branchline automation is by thoroughly cleaning the engine wheels and then scrubbing the track where it was losing power with the Walthers hand cleaning tool.

But at some point we need to just work around the problem and address it. Time for an engine/train change on the branchline.

There’s a similar issue on the mainline. The trains were not stopping at the right spot, and that got solved by cleaning the engine wheels. But more importantly, we’re going to have to swap the engines at some point. Out of the two UP SD70ACe engines, one is out of commission, and I’m currently running with the backup UP 8749. There is no backup for the backup so we’ll need to deal with that.

The easy solution here is to try to get yet another UP SD70ACe once available. Currently Walthers or TrainWorld have none though. In any case, one of the many pending tasks I have is to look at what’s wrong with the first unit and fix it. What I have done in the past that worked well is get any similar unit from the same OEM and just do a shell swap.

2022-01-01 - Happy New Year

Category Randall

Happy New Year 2022 from the Randall Museum Model Railroad team.

2021 was yet another odd year. It was marked by the museum reopening in October. The usual lot of mandatory layout maintenance happened with various things to fix (B91, B320, B321, T150, T320, T450, etc). Some new stuff happened like balloon auto-reversers for Bridgeport yard, and a good amount of time spent understanding the lighting.

Click here to continue reading...

2021-12-23 - Update to Vision Computer: VLC with RTSP on Debian Bullseye

Category Randall

I’ve spent the last couple weeks doing background computer maintenance mostly. The kind of stuff nobody at the layout will notice, because things magically get fixed before they are too broken.

If you don’t like computer stuff, you can skip this one as we’re going to get deep in the weeds with Linux commands.

Click here to continue reading...

2021-12-16 - Randall Layout Git Repositories on Bitbucket

Category Randall

I keep all the source code and configuration files related to the automation in git repositories on Bitbucket. At first I was using my private workspace, and I finally moved the various projects into a proper dedicated workspace:

This now contains three repositories:

  • automation: The main repository that holds the various projects used for the train automation of the railroad exhibit. Most notably it contains the sources for the Conductor software that drives the automation, the RTAC program that runs on the Android display tablets, and a few other Arduino/Pic16f projects.
  • train-motion: The software that runs on the Vision computer at the museum, playing recorded videos, and also playing live feeds from cameras located around the layout.
  • documentation: This one is totally new. I moved here all the public documentation I have for the Randall Museum Model Railroad.

The documentation repository contains files for layout maps, layout schemas, layout labels, and all the documentation I wrote for the museum staff and the Saturday Operators. I do have links to that in the introduction page however all the source material was just on my own drive. Now it’s properly archived as it should with proper revisions. One goal of having a public repository is to have volunteers submitted patches to extend it. For that purpose I’ve clarified in the README the license and the file formats that can apply here.

2021-11-28 - “Cracker Jack” Illuminated Billboard

Category Randall

Today Allen and I finally got the “Cracker Jack” illuminated HO-sized billboard powered by the layout’s building lighting panel:

Even with the full room lights on, it’s still quite visible and should be a nice animation for visitors:

Back in June, Allen got the billboard and we temporarily installed it, yet it remained unpowered. The sign can be powered via a battery and instead I wanted it connected to the layout’s building lighting circuits using an Adjustable Voltage Regulator.

That project took a bit longer than expected -- first I plugged the voltage regulator in reverse (thus increasing the voltage instead of reducing it), and that killed the billboard’s control board. So I got a replacement for that, and this time wired it up correctly. Allen and I made the building self-contained with the voltage regulator and I tried adding an orange LED inside to add some scene lighting, which honestly didn’t work and is quite sub-par.

Click here to continue reading...

2021-11-27 - New Version for Train Vision

Category Randall

Concluding 4 days of work, this morning I installed the new version of the train-motion software on the Vision computer at the museum for the Train Vision Project.

The project has three cameras looking at the layout and displays live videos when it detects trains. In the initial version, that video was really choppy. It was fine when I was experimenting with this on the wifi at home, but the same cameras + laptop resulted in a really bad frame rate when using the sub-par wifi in the train room.

So I spent the Thanksgiving break entirely rewriting that part of the software. In the previous version I was using the FFmpegFrameGrabber to get the cameras’ RTSP h264 feed, analyzing the frames for motion, and then feeding them to the display by drawing them directly with a Canvas in a JPanel. That was really not optimal. In the new version, I replaced the custom viewers by instances of VLCj in Direct Rendering mode, so now I have VLC driving the RTSP feed, and I use the reverse where the VLCj decoded frames are fed to the motion analyzer. They all work in their respective threads with blocking queues for synchronization.

The result is that the videos are really better looking now. Not choppy anymore. I also reconfigured the cameras to boost the contrast and saturation as the image was rather bland -- I overdid that part a tad much, I need to tune it down now.

The only downside is that CPU usage really went up, which makes sense since I now have 3 VLC viewers in 1280x720 @ 15 fps doing their work where before I had 3 meager 640x480 feeds at some very irregular frame rate. But that’s fine, because now I can underclock the analyzer threads and run them at 5 fps -- they don’t need to detect motion on every single frame. Overall the software now runs at 50-75% on the 4 CPU i7 cores which is on par with what I had before, but with better quality.

The last thing I’ve done is add a statistics collector for debugging purposes that can export the motion events to the chrome://tracing json format:

That should allow me to fine tune the motion detection thresholds.

2021-11-23 - Train Vision Maintenance

Category Randall

I’ve done some work on the Vision computer to get more reliable networking. The USB-to-ethernet adapter hasn’t been behaving as stable as I’d like to, and I fixed the wifi so at least I got that.

But maybe it’s not just that USB-to-ethernet adapter that needs some more work though -- last time I went by the museum, all the port lights were off on the ethernet switch till I power-cycled it so maybe I should look at that first.

I have also updated the highlighter’s logic in train-motion, and actually I like the updated logic even less than the original. Look at these stats:

That’s terrible. Too many highlights. The thing is too sensitive, I need to change it to have some kind of adaptive threshold. Some of the highlights happen when no trains are moving, probably because the RTSP h264 stream is of subpar quality and very noisy, not to mention noticeable inconsistent frame rate. That’s why I need that wired ethernet to work.

And what’s up with the lack of stats after noon? I know the laptop was running at least till 4-5 pm. If it were a 12/24 hour mismatch, the “12 pm” events should look like midnight (12 am) and the 4-5pm events should look like 4-5am, which is not the case here. More mysteries.

2021-11-22 - Maintenance and Debian Updates

Category Randall

A few things have happened this week-end.

First the visible yet inconsequential thing: the Bridgeport Ballon Track #2 now has the proper Auto-Reverser.

The story about this is that I had ordered two Tam Valley Dual Frog Juicers to be installed and configured as auto-reversers, one per balloon track. Unfortunately in the order I was sent a DCC Hex Frog Juicer by mistake. The Dual Frog Juicers can use up to 4 amps per track, whereas the Hex Frog Juicer can only only 1 amp per track and that’s not enough when running multiple engines in consist with sound. So now I just got around to installing the proper board. It was a rather trivial swap since I had done all the prep work when installing the Hex Frog Juicer, so really only terminals to unscrew/rescrew. Probably took more time to take the pictures and write this post than actually installing the board. But hey, one more task is complete on my long list.

The more exciting news is that I got around to update my Layout Presentation Documentation. I know, exciting, isn’t it? “See? Nobody cares.” Well I do. I added a whole chapter on the computer setup used in the “train room exhibit”, and updated the pending work list, and I think that’s pretty neat. I’ve also updated the Known Issues list.

Click here to continue reading...

2021-11-16 - Mainline T330 at Sonora

Category Randall

Speaking of disasters waiting to happen, this is the mainline track at T330 Sonora:

What we can observe here is that both rails from the turnout lead are not soldered to the mainline track anymore. There’s some remnant of solder, thus I’ll venture a guess they used to be joined. Moreover the track lifts by about half a millimeter and can flex up and down freely. It’s amazing we don’t derail here. And that’s the mainline where every single train runs..

2021-11-15 - Randall Repairs: Block B321 / Turnout T322

Category Randall


Mainline B321 close to Turnout T322.


Dead spot on Mainline B321.

Summary Fix

Fix bad track joiner.

Description of Issue

As explained earlier, we’ve been having issues with the train stopping on a dead spot on the mainline block B321, just after the Branchline turnout T322. I posited the issue was a broken solder joint, and it was indeed the case. A repair has been made -- actually two of them --, we’ll see if that holds.

On the track schematics, repairs were performed at the approximate locations shown below, on the red-side rail.

Trains used to stop dead in that area recently, intermittently. Typically that’s due to a solder joint that is broken and now makes a bad contact. As the track shrinks or expands with humidity, temperature, and the weight of the rolling stock, contact can appear or vanish during the day. The test was simple: with the train dead at that spot, just putting some slight pressure on the track was enough to power the train again. Problem is, that track has been naturally weathered by decades of usage, and it’s nearly impossible to know where the solder joints are, or for what. There can be many, from track feeders, to rail jointers. Not to mention the voluntary block isolation gaps that I need to preserve. Due to the lack of documentation, it means that when I find a gap (or a broken rail that looks like a gap), I don’t really know if it’s on purpose or not.

Description of Fix

First repair at spot #1 was done somewhere near the middle of the block. There is a track feeder under the layout going to both the black and red rail. It’s worth pointing two important details at this point:

Click here to continue reading...

 Generated on 2023-03-22 by Rig4j 0.1-Exp-666f4a7