This project implements an idea I’ve been kicking around for a while: to implement Mini-Commander-like TMCC control of an operating car with a compact Arduino paired with a radio module. The arrival of an MTH signalman caboose, which has very little room for additional electronics, provided the opportunity to try it.
The basic idea is that a master Arduino acts as a bridge, receiving commands from the Legacy base over the serial line and transmitting those commands over the radio link to Arduinos installed in operating cars, which then take whatever action you program into them. I used the Moteino, which pairs an Arduino with an RFM69HCW radio module. The module can theoretically transmit for more than a kilometer, so should work even on the largest layouts!
The master Moteino reads commands coming over the serial line from a SER2 module, parses the TMCC command, and, if it’s an ENG or ACC command, sends the command over the RFM69HCW radio to the specific Moteino node identified by the command’s TMCC address. I use the Radiohead RFM69 library, which provides simple and transparent transmission of addressed, reliable datagrams with acknowledgement and retransmission.
The MTH caboose activates the signalman with a bell detector circuit that responds to the DC offset from the bell button of a conventional transformer; it can’t detect TMCC or DCS bell commands. The MTH implementation is a little peculiar. The bell detector circuit activates a transistor, which delivers half-wave rectified DC from the track to a relay – but instead of activating the relay directly, the DC ( ~ 50 mA) is delivered to a bridge rectifier that feeds a 9V regulator. That 9V regulator turns on the relay. When the relay is closed, it connects power from a separate 9V regulator (which is always connected to track power) to the signalman motor circuit.
I replaced the bell detector circuit with a Moteino that turns on a small solid-state relay (TLP222AF); when activated the SSR connects track power to the 9V regulator, which in turn activates the relay. It could be done more cheaply with a transistor or triac, but the SSR was only $1 and makes the wiring simple: since the stock MTH circuit feeds a bridge rectifier, I could connect track power directly to the relay control circuit without worrying about rectification. Here’s a couple of photos of the Moteino with a ‘shield’ that has the SSR circuit. I used the existing MTH plugs that connect to the stock bell detector board to connect to my shield.
The Moteino needs a source of DC power, of course. The stock MTH board has a 9V regulator that is always connected to track power, even though it only seems to be used when the motor is on. The board even has an unused socket connected to that regulator which I could tap into. However, I found that this plug is only live when the motor relay is active. So I made a small modification to the board, cutting a trace and soldering a connecting wire, which makes the unused socket always live:
The software on the caboose Moteino is pretty simple. If the Moteino receives a command addressed to it from the master node, it parses the command. If the command is an AUX1 press, then it activates the SSR for 4 seconds, which is enough to initiate the signalman cycle (after 4 seconds, the MTH design activates a microswitch which keeps the motor relay active). I’ve attached the Arduino code for the master and the caboose Moteinos to this post.
The Moteino with a radio transceiver costs $21, so each node in an operating car or accessory could be implemented for less than $25. For installations where there’s no source of DC power available, you’d need a voltage regulator or module to power the Moteino; it can accept 3.6V to 12V as a raw DC supply and draws about 130 mA at maximum transmission power.
You could make the nodes a little smaller and maybe cheaper by designing a custom PCB with a ‘328 and installing your own RFM69 module, although the convenience of the Moteino is hard to beat.
Since you can also get Arduinos (or other microcontroller modules) with built-in Wifi or Bluetooth, one could probably implement a similar system that gets commands from whatever smartphone app you’re using to control your trains – but I’m still on ‘old-fashioned’ Legacy and the programming for Wifi or Bluetooth is well beyond my skills!