Model Train-related Notes Blog -- these are personal notes and musings on the subject of model train control, automation, electronics, or whatever I find interesting. I also have more posts in a blog dedicated to the maintenance of the Randall Museum Model Railroad.

2019-01-20 - Mini Wifi Camera and Train Layout Usage

Category Video

I’m continuing my exploration of what we can do using these cheap small mini cameras when it comes to train layouts, and today’s subject is this mini pinhole wifi camera. How well does it work and what can we use it for?

Mini pinhole camera compared to an HO-sized gondola

Click here to continue reading...

2018-12-14 - Conductor 2: Route / Events Programming

Category Rtac

Just to keep some perspective, here is how the current Conductor 1 script is architectured:

  • There are 3 routes, 2 for passenger and 1 for branchline, with the passenger ones alternating.
    • Where appropriate, the routes define variables for speed & timers upfront so that they can be adjusted for new engines / train configuration.
    • They lack profiles but these are essentially an extension of the current setup.
  • Within each route are sequences. Since the script is a parallel execution script, the sequences are implemented using state keeping, but that’s mostly what the states are for.
    • That’s actually a bit of an issue as it makes the states hard to figure and keep track of, creating some unforeseen complications sometimes.
  • There are events not associated with any route.
    • Main example is the Sonora switch in non-automated mode.
    • A lesser example is the RTAC display especially for stopped/error modes.

Having changed the trains for automation recently, I can see where the system works and where it breaks:

  • Mostly I changed the passenger trains just by adjusting the speeds.
  • I did alter 1 or 2 timers, for example the Freight’s run time before stopping at the mid station.
  • It broke when I tried to use an MTH engine as its functions usage is vastly different.
  • Same goes for the Rapido which has more fancy functions. In that case changing the engine in a route would require customizing the script for different functions.

Click here to continue reading...

2018-12-09 - SQ23 Mini Camera for Cab Rides

Category Video

After trying the SQ12 camera, I moved on to its newer sibling, the SQ23. The goal is to use it to record cab rides. As this one has wifi, a secondary goal is to see if it’s suitable as a “live camera” e.g. to broadcast a ride view to a screen.

Cab ride filmed using SQ23 Camera

This is the SQ23 Camera I got from Amazon (can be found cheaper elsewhere, e.g. on Aliexpress), compared to my  Mobius Action Cam and the SQ12 camera:

From left to right: SQ12, SQ23, Mobius compared to an HO-size engine + gondola

Click here to continue reading...

2018-12-08 - Conductor 2: Route Sequences

Category Rtac

Above I mentioned the key features for Conductor 2 would be profiles, configuration language, and routes.

I should elaborate a bit on this, especially the routes.

First the profiles: A profile is simple a DCC address number and a map of variables values. Routes will defined variables for, e.g., timers and speeds. The profile will fill in these values to adjust them to a specific train.

Click here to continue reading...

2018-12-01 - SQ12 Mini Camera for Cab Rides

Category Video

I’ve been doing all my “cab ride” recordings using a Mobius Action Cam. A few months ago I tried the RunCam 2 for comparison.
This time I decided to try one of the SQ “mini” cameras series for a change.

Cab ride filmed using SQ12 Camera

I got this SQ12 from Amazon:

Click here to continue reading...

2018-10-12 - CMRS Touch Panels, continued

Category CMRS

This is a follow up on that proof-of-concept I made at CMRS about touch panels for the mainline.

I'd like to elaborate a few points, with some pros and cons, which I had been thinking about when I started the project. Upfront I want to make it clear I am not advocating for one solution or another. I am offering "food for thoughts", pros and cons, and matters of discussion. Some of the discussion involves industries or city names which are specific to CMRS’ layout. A map of it can be found in the link above.

Click here to continue reading...

2018-10-01 - Cameras, OpenCV, and occupancy detectors

Category Train

A lot of my interests when it comes to model train layouts are all about automation. Automation can mean to make the trains move automatically but it can also mean to automate signaling -- displaying semaphores and search lights according to traffic on the layout. The common denominator for both is block occupancy detection, namely to know where trains are on the layout.

An early prototype of camera-based block detection

Click here to continue reading...

2018-09-15 - NCE AIU01 and Motion Sensor

Category NCE

As previously discussed, on the Randall layout, visitors press a button to trigger the trains’ automated sequence. Soon enough, we added a sign asking people to be nice with that button. The sign has nothing to do with the actual electronics behind nor the automation, not even the button itself. Both the button and the software are sturdy enough to survive any abuse.

And abuse there is. The abuse is simply… social. Kids hammer that button like there’s no tomorrow. Does it make trains run faster or more frequently? Nope. One would hope it would be a good exercise in parenting in teaching kids to be reasonable and treat common property adequately, but alas, no.

Eventually Jim and I had enough of it and I decided we could simply use a motion sensor as trigger instead of a hardware button. Back in March, I built this prototype:

The original design for the motion sensor was to use an ESP32 with an HC-SR501. The ESP32 would be used to send a sensor activation command to JMRI.

Click here to continue reading...

2018-09-02 - Digispark Tiny

Category Arduino

The Digispark Tiny is probably the most basic and compact Arduino-like I’ve worked with. It’s about the size of an USB A plug. It is powered by an ATTiny85 and offers 1-5 I/Os depending on usage (typically 2-3).

(image source:

Kickstarter Date: 2014.

Example of the Digispark Tiny connected to an USB OTG with a PIR sensor:

Click here to continue reading...

2018-09-01 - Conductor 1 and E-Stop

Category Rtac

Another behavior I need right now in Conductor is to have an E-Stop feature when trains get blocked. It’s the 3rd time a train keeps running for an hour or more blocked somewhere. Ideally Conductor 2 would have a model of “what’s next” and error management, but I can’t wait for that.

What I need is simple: a route starts, and if the train has not reached the destination in say 10 minutes, send a stop to the train. We can do that trivially using a timer, which is canceled (aka “timer end”) when the train reaches destination.

Although not exposed through the script grammar, JmriThrottleAdapter (.py) and IJmriThrottle (.java) do have an eStop() method (the estop is only used when triggering an e-stop via RTAC). Right now just using a repeated stop should be enough.

Click here to continue reading...

 Generated on 2022-10-03 by Rig4j 0.1-Exp-666f4a7