Model Railroad: Control Electronics#

This post is a collection of thoughts and information on the electronics and software I use on my N-scale model railroad project. This is a very long-term hobby project that evolves as I work on it. This documents my current approach. I think most the hardware and software used here is flexible enough to support all the plans I eventually have (namely fully-automated running).

tl;dr hardware summary#

  • Scale: N

  • Track system: Kato Unitrack

  • Loco protocol: DCC

  • Command Station: DCC-EX CSB1

  • (Future) Automated Control: Raspberry Pi running JMRI

Unitrack thoughts#

Overall I like the Kato Unitrack system. Its easy to work with especially when starting out. The turnouts work reliably and quickly. I think Kato also provides a few great starter sets for track. There are not as many options as I would like in terms of track geometry. There were many times during the planning-phase where I wished they had a curved turnout for instance.

I bought the majority of my track from Plaza Japan. Shipping/import fees can be significant, so this is only cost-effective when buying a large amount of track. Otherwise, local/online hobby stores are a good source.

Turnout control#

Kato Unitrack turnouts dont support DCC out of the box. So I’ve added a Digitrax DS51K1 DCC decoder to all my turnouts. This allows them to be wired on to the regular DCC bus for remote control. These can be hard to source. I usually have to check a few store websites to find any. Maybe there are cheaper and more readilly available alternatives out there. So far all my DS51K1’s have worked well enough. Pretty easy to configure, although I have had issues with them very rarely loosing their configured DCC address at power on.

Layout design and planning#

I chose to design my own layout for this project. I spent many hours in Any Rail designing a layout that would fit my space requirements while offering all the features I wanted. The layout is not the most realistic in many aspects (some tight curves and aggressive grades). Here’s the current mainline design:

../../_images/model_rail_2026_nov_mainline_layout.png

Train Control: DCC-EX#

My layout uses the DCC protocol for command/control of all trains. DCC is a standardized protocol that has support across all brands I’ve used.

For DCC control, the open source DCC-EX CSB1 is used. These are easy to buy (at least in the US) and are a great way to get started with DCC. The CSB1 has WiFi builtin so you can control trains directly from your phone with any DCC throttle app (ie: ‘Engine Driver’, ‘ThrottleCard’, etc).

Initial basic setup is pretty simple. With the included OLED you can see the wifi details needed to connect to the CSB1. The firmware provides a lot of customization options too. For instance, it was very easy for me to configure a couple of i2c gpio expanders attached to its Qwiic port.

Here’s a basic diagram of the setup:

../../_images/csb1_wiring.drawio.svg

Advanced Control#

For more advanced control (train block detection, signal control, automated running), I’ve started down the route of using JMRI on a Raspberry Pi. This is purely for more advanced controls/automation. To just run trains, only the CSB1 is needed.

JMRI is a long-running open source model railroad control/management application. Its age and open-source-ness is clearly manifest in the janky, obtuse UI. For me the main attractors are JMRI is free and has insanely broad support for bridging a variety of protocols and devices. I always like using and supporting open-source projects where possible.

I will save the details for a later post, but I currently use JMRI to integrate my CSB1 and current sensors for block detection on the layout. Here’s a picture of the JMRI panel displaying turnouts and a train detected in the dashed-red block:

../../_images/model_rail_block_detection.png

The dial#

As a side-project I got one of these touch-control dials from Waveshare. These are surprisingly nice for the price (metal dial, decent touchscreen, battery-included), just a bit of a pain to program. It has 2 ESP chips inside and the MCU you are talking to/programming depends on the orientation of the USB-C-to-A cable connection (weird).

I thought this could be a perfect little control dial for a train, so I started working on an implementation that uses SquareLine Studio for the embedded UI and JMRI WiThrottle protocol for comms.

I got a basic proof of concept up and running that could control one train and left things there for a while: len0rd/withrottle_dial

I was pleasantly surprised to discover I was not the only one with this idea, and a fellow developer took my work and fleshed out all the missing details: honzup/waveshare_withrottle_dial . This version is much more polished and feature rich!