Skip to main content

I've been working on ways to control my MTH trains from my PC for many years. About 8 years ago, I released the first version of my Remote Train Control (RTC) program for the PC. The very first version was for a TIU tethered between the Remote jack on the TIU to a serial port on the PC (or a USB serial port). Next came a radio which enables RTC communicate to over a wireless radio connection to a TIU. After that came the ability for RTC to communicate over WiFi with both the WIU/TIU and the WTIU.

I've written several utility sketches to help me learn and understand how the trains are controlled. For example:

  • An Infiduino sketch to monitor the radio signal between the Remote and the TIU. It decodes the commands and produces a trace. (RTCSnoop)
  • An Infiduino sketch that emulates a TIU. This sketch can be controlled by either a Remote or the RTC program. (RTCEngine)
  • An Infiduino sketch with radio hardware that lets RTC communicate directly to a TIU. (RTCModem)
  • An Infiduino sketch that uses RFID technology so that the RTC program can locate engines and cars on my layout. (RTCNFCIRQ)

With a lot of effort, I was able to understand almost all of the communications between the Remote and TIU. I am now able to create packets to control the engines. The packets are complete with correct addressing, command syntax and CRC.

I figured this out by examination of the packets that I could sniff using Mike Hewett's original RS-232 interface design and the port settings that he found. Without Mike's insights into the RS-232 data stream, I don't think that I would have been able to get a foothold into this protocol.

So again, I figured this out just by looking at the RS-232 stream over the tether cable. No code disassembly, no logic analyzers, no opening up of Remotes or TIU's.

The sketches originally used USB based serial communications to the RTC program using the Infiduino. Then they moved to the ESP8266 using WiFi commications with the RTC program.

  • An ESP8266 sketch that emulates a WTIU. This sketch can be controlled by either the App or the RTC program (RTCWTIU)
  • An ESP8266 sketch that uses RFID technology so that the RTC program can locate engines and cars on my layout. (RTCNFCWiFi)

Now I've written an ESP8266 sketch that acts as a bridge between a Remote and the WTIU. (RTCAdapter)

ESP8266 and CC1101 Wireless Transceiver E07-900M10S by Darrell Lamm - top

This requires that a CC1101E radio (such as the one from Elechouse, Darrell Lamm or eByte be wired to the ESP8266).

Details on this web page.


This is a new sketch that I've just started to develop so it is not complete yet. It is meant to act as bridge between the Remote and the WTIU. The Remote only communicates via a radio and the WTIU only communicates via WiFi. This sketch, which requires a CC1101E radio, listens for commands over the radio from a Remote, translates them to what the WTIU requires and sends via WiFi to the WTIU. Then it takes responses from the WTIU over WiFi, converts them to what the Remote requires and sends them over the radio to the Remote.

The sketch named "RTCAdapter.ino" compiles into one runtime module which can be uploaded into the ESP8266. At the bottom of the web page are instructions for loading a precompiled binary into an ESP8266 and instructions for compiling the source code yourself.

Communications :

  • Command : RTC or Remote > via CC1101E radio > ESP8266 sketch which translates command format --> via WiFi --> WTIU
  • Response :  WTIU --> via WiFi --> sketch which translates response format --> via CC1101E radio --> Remote or RTC

There is some debug output that the sketch sends out the USB port. You can use a terminal emulator (I like 'Termite") set at 115200 baud to watch this debug output.

What works and what doesn't

I only have one WTIU so I can't test Super TIU mode and the code for that mode is not complete.
The Remote never indicates when TIU are in Super TIU Mode. So whenever you select that mode, RTC Adapter assumes that all TIU are in  Super TIU Mode.
I have tested all of the "normal" running commands (startup, shutdown, speed, whistle, horn, lights, couplers, smoke, etc.) for single engines, lashups and All Engine mode.
I've tested all of the accessory and switch control functions (so routes and scenes should work).
I've tested most of the hot keys.
I've not tested any of the really esoteric things like Protocast, ProtoDispatch, Speed mode, Track and Trolley modes.
I've not tested TMCC mode as I don't have any TMCC hardware.

Attachments

Images (1)
  • ESP8266 and CC1101 Wireless Transceiver E07-900M10S by Darrell Lamm - top
Last edited by SanDiegoMark
Original Post

Add Reply

Post
The DCS Forum is sponsored by
×
×
×
×
Link copied to your clipboard.
×
×