Mark DiVecchio's Lionel O-Gauge Train Layouts

1992 Layout Page

2006 Layout Page

2009 Layout Page

P&LE Postcards by Howard Fogg 

Plasticville Buildings

Portable Layout Page

Train Clubs

Bing Track


YouTube Channel

OOK Radio Support

Playing clips from .mth sound files

More RTC Videos

Technical Videos

RTC - Remote Train Control

This Page last updated on .

This page shows a few videos and screen captures of a program that I wrote. I titled it "RTC" or Remote Train Control. Here is the discussion on the OGR Forum:
http://ogrforum.ogaugerr.com/topic/pc-control-of-mth-engines-by-serial-connection-to-the-tiu

This web page talks about the RTC program and its original wired interface to the TIU - that is, using the tethered phone cord connection. While you read this, keep in mind that I have now developed a radio interface to the TIU. I don't recommend that anyone build this wired interface (unless you are just interested in trying it). But I recommand that you go directly to the radio interface using the links below. Still, read this page to learn about the RTC program itself.


March 21, 2015 8:19 PM

PC Control of MTH Engines by Serial Connection to the TIU

To me, MTH makes the best engines and rolling stock for my railroads of choice, the Pittsburgh & Lake Erie Railroad and the Aliquippa & Southern Railroad (where my grandfather worked). MTH has many many engines and dozen of pieces of rolling stock for these railroads. My layout uses only MTH's DCS.

DCS has been out for almost 15 years. I've been waiting for a way to control my layout using my PC. I've always used Windows PC's so this effort was done originally using XP and more recently Windows 7 and Windows 10.

A few years ago, Mike Hewett <mhewett737yahoo.com> presented a PC interface to the tethered mode of operation of DCS. He showed how to sniff out the RS-232 packets running between the Remote and the TIU, how to save those packets and how to later transmit those packets to the TIU from the PC.

Mike presented his findings in three videos which he produced around May of 2011. Look at those three videos before you continue with my description.

Chapter 1 https://www.youtube.com/watch?v=MxlUb-YccZw
Chapter 2 https://www.youtube.com/watch?v=IBrhLSVHjIo
Chapter 3 https://www.youtube.com/watch?v=oqaeeR3pgPw

Look at this OGR Forum thread for a followup:

http://ogrforum.ogaugerr.com/topic/wonderful-gift-dcs-to-pc-control?reply=5371679459030161#5371679459030161

Mike made more progress as shown in this video from 2013

https://www.youtube.com/watch?v=Ug5CSZFwo-c

I think that I first saw what Mike did around October of 2011 as my earliest date stamps on files that I've saved are from that date.

Mike's methodology was to record the packets sent by the Remote when each key on the Remote was pressed. Without regard to the contents of the packets, he saved them in a file. Then, later, his PC program could read up those saved packets and send them to the TIU. He created a very nice touch screen interface and he could run his DCS trains from his PC.

I contacted Mike back then and he sent me copies of his program and I was able to build up his interface to the TIU, sniff out the needed packets and I had a way to control my trains from my PC.

This worked up to a point. When I added a new engine number, I had to run the packet sniffer again and pick up the packets needed for the new engine number. Mike's program only captured a subset of the many, many types of commands that could be sent to the TIU. Mike did not read back responses from the TIU or process any of those returned packets.

I was looking for something more. I needed to understand the protocol over the tether cable.

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 DCS 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'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.

March 25, 2015 10:19 PM

I'd like to thank everyone for taking the time to comment on my posting. I've waited to follow up so I could add my thoughts to the comments.

My purpose in what I did was to develop a new way to run my trains.  I'm not competing with anyone else, especially MTH since they don't have a product for PC control that they sell or give away. I'm not selling anything that I've done. Once I determine that it is working fairly well, I am going to send the program to whoever can use it. It will probably be distributed under one of the GNU Public Licenses.

Understanding the protocol over the tether is what is most useful. Mike (skylar) wrote about wanting to build a system with sensors that adds location information to the mix. I can envision something like the operation of the Lionel 132 Automatic Stop Station that you could automate with location sensors and PC control.

The DCS patent does not talk about the protocol over the tether. I've learned from my analysis that the protocol is an industry standard RLL(0,1) which is just a fancy way of saying how often the RS-232 signal changes from 1 to 0. Part of the encoding is actually patented and not by MTH - #5,625,644 issued in 1997. The next part uses Morton or Z-Curve encoding. You can Google that. Third are the commands themselves. They are in ASCII and are based on an Application Note published by Microchip Technology in 2002, look for AN759. Another document, AN752, describes the MCRF4XX CRC protocol used. These public documents describe the protocol completely, it was just adapted to model train control. All of these documents were found on the Internet.

PC control has one (at least) major drawback and that is the need for a wired connection to the TIU. My program only handles one RS-232 port but there is no reason that a program could not be written that uses 5 RS-232 ports, each connected to the 5 TIU possible. In other words, once the protocol is known, practically anything can be done by writing software. I haven't yet completed my analysis of the protocol. My program knows all of the train control commands and AIU commands. I know how to do lashups but I haven't added that to the program. I've not yet looked at a TMCC interface or conventional operation.

(Update Apr 2015 - RTC now handles Lash Ups and Conventional operation)
(Update Oct 2015 - RTC now communicates wirelessly with up to 5 TIU)

Writing a program that encompasses every aspect of train operation is not something one person can do alone. Maybe because of that, PC control will never be practicable. It is not possible for me to singlehandedly write a program that will satisfy everyone. But I can probably do enough to let enterprising and interested hobbyists have the ability to operate their trains in a different way.

My program, RTC, was written using Borland C++ Builder 4.0 because that is the software that I used years ago when I was still working. There are probably other better environments which would better handle the real-time control aspects (like asynchronous RS-232 characters arriving). C++ Builder is not really good at that. When I started writing the program, I had no idea what the protocol over the tether was. I had to write my program to handle many different protocols, of which all except one turned out to be deadends. For example, I used CRC code that could handle dozens of CRC algorithms. But only one was needed once I understood which one. All of that extra code is still in the program. The CRC code, by the way, was written by Ross Williams, who placed it in the public domain in 1993.
As I mentioned in the posts on the forum, I am releasing my program and documentation under the  GNU General Public License Version 3 and GNU Free Documentation License Version 1.3. These licenses permit anyone to use the program and the documentation to produce follow on programs as long as those programs remain covered by the GNU licenses.

The Free Software Foundation web page talks about what "free software" means.

For more information, look on the Open Source Initiative web site which includes a description of what  Open Source means and their certification of the GPL version 3.

Here is the copyright notice for those two licenses:


GNU GPL

Remote Train Control Program for Windows
© Copyright 2015 by Mark DiVecchio

Remote Train Control is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Remote Train Control is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Remote Train Control.  If not, see <http://www.gnu.org/licenses/>.

GNU FDL

This is part of the Remote Train Control Manual.
© Copyright 2015 by Mark DiVecchio

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. You should have received a copy of the GNU Free Documentation License along with Remote Train Control. If not, see <http://www.gnu.org/licenses/>.

Important note: Before you can use an engine with RTC, the engine number must be changed from the factory reset setting of zero. Use a Remote and TIU as usual to perform the Add MTH Engine operation.


Getting the RTC Program

If you have already watched these videos and just want to download the RTC program, Click Here.

You can get a detailed description of the serial protocol to the TIU here. And a description of the command set here.

From when I recorded some of these videos, the user interface has changed slightly. You can also access these videos on my YouTube Channel.

RTC Program running on Win7 Computer


Video 1 - Recorded 19 Mar 2015. The first video is an introduction to program showing a screen capture and audio. Its running on a computer in my train room.

Image loading....


RTC Program running on Win7 Computer


RTC running 3 engines

Video 2 - Recorded 22 Mar 2015. Here is a screen capture of the running of three engines at the same time with freight yard announcements on one of the engines.

Image loading....


RTC running 3 engines


Recording and Playback

Video 3 - Recorded 22 Mar 2015. This screen capture shows the ability of RTC to capture packets sent to the TIU and to play back what is captured.

Image loading....


Recording and Playback


My layout with 3 engines under playback control by RTC

Video 4 - Recorded 22 Mar 2015. Here is a playback of a recorded session based on Video 2, above. This video features an Aliquippa & Southern SW1200 and its freight yard announcements. My grandfather worked for the A&S in my hometown of Aliquippa, PA.

Image loading....


My layout with 3 engines under playback control by RTC


AIU control of Accessories and Switches

Video 5 - Recorded 25 Mar 2015. This video shows the AIU control screen. RTC can save names and TIU/AIU associations for 25 AIU.

Image loading....


AIU control of Accessories and Switches


Tour of the Main Window of the RTC program

Video 6 - Recorded 25 Mar 2015. This  is a tour of the main window of the RTC program, with a description of what each button and selection does..

Image loading....


Tour of the Main Window of the RTC program



Conventional Operation - Screen Capture

Video 7 - Recorded 9 Mar 2015. This video shows my first cut at a Conventional Mode Operating Screen. I haven't yet tested this with a real engine on a track. I connected a voltmeter to the TIU output and monitored the voltage changes...

Image loading....


Conventional Operation - Screen Capture



Creating and Running a 3 Engine LashUp - Screen Capture

Video 8 - Recorded 9 Apr 2015. Here I'm creating and running a LashUp of three engines while recording it for later playback. (Look at Video 9)..  

Image loading....


Creating and Running a 3 Engine LashUp - Screen Capture



Playback of 3 Engine LashUp

Video 9 - Recorded 9 Apr 2015. This is a video of the three engines running on my layout using the recorded file from Video 8...

Image loading....


Playback of 3 Engine LashUp



More Videos here.

1978 May - Model Railroader

Wired Interface between the TIU and the PC:

The wired interface to PC uses a fairly simple RS-232 signalling. Here are some details. I built up this interface on a prototyping breadboard. Please understand that this worked for me but you assume any risk of damage to your TIU, PC or layout..

Major parts:
    1. USB to RS-232 adapter. Must use 3.3v levels. I used the Pololu Adapter #391. Source Pololu web page. Other adapters are fine as long as they output 3.3v levels (many of the FTDI based adpaters output 5v levels).
    2. Handset cord - this is the coiled cord normally found between the handset and the phone base (NOT the flat cord between the phone base and the wall jack). The cord is usually coiled. Some of these have only 2 wires; we need one with four wires. Generally called a "4P4C" cable. Good sources : Thrift Stores, Walmart, RadioShack.
    3. Texas Instruments (TI) CD4503BE 3-state buffer in a PDIP (Plastic Dual In-Line Package). Good sources: Mouser Electronics. and Digi-key.
    4. Prototyping board - also called a Breadblock. I used a board from MJPA. #19048. Any other physical way you want to build interface this is fine. Placement of parts and wiring are not critical.
    5. USB cable - USB A Male to USB Mini-B (5 pin) Male. Good sources : Pololu, Amazon, China, Inc (or a million other places).

Software:
    You will need the serial port drivers for whichever USB to RS-232 adapter you are using. If you use the Pololu #391, the drivers for Windows XP, Vista, 7 & 8 are here. Follow the instructions on that web page to install the drivers. When you install this driver, note the COM port number that Windows selected for you. You will need to select that port on the Setup window in the RTC program.

    In the RTC program, the first time you run it, click the Setup button and select the correct COMx port. It will be remembered each time you run RTC.

    The RTC program itself can be copied to any folder. I suggest that you make a folder called "RTC" or something like that. Copy the program into that folder. Create a link on your desktop to the "remote_control.exe" file which is the program. When the program first runs it will create its database files in that folder.  There is no special, separate "installation" or "setup.exe" to run.

Design:

4P4C Handset Cord

My implementation on a Breadboard

Breadboard Wiring

Schematic

USB A Male to USB Mini-B (5 pin) Male



Supporting Documentation:

    Pololu - Pololu USB-to-Serial Adapter
    Pololu USB serial port drivers
    AN752 CRC Algorithm for MCRF45X ReadWrite Device
    US5625644 DC Balanced 4B-8B Binary Block Code for Digital Communications
    A Painless Guide to CRC Error Detection Algorithms
    CRC Reverse Engineering  
    Z-order curve
    Decoding Morton Codes
    3 X 170 Point Mini Solderless Breadblocks in Red, White & Blue
    TI CD4503 Datasheet



Here is an interface used by one of my alpha testers. Its a simple interface that does not offer the "disconnect on idle" function because the CD4503B is not used. Its still a good working interface:




Another alpha tester used this USB to serial adapter (ebay link) :  CP2102 USB 2.0 to UART TTL 6P Module Serial Converter Adapter

This adapter is actually pretty nice because it has 3.3V and DTR already on header pins. You won't have to wire jumpers as I had to using the Pololu adapter. The CP2102 operates at 3.3 volts so its output voltage levels are compatible with the TIU.

Driver here:   //www.silabs.com/products/interface/usbtouart/Pages/usb-to-uart-bridge.aspx

Here are some photos of this tester's interface. Its a good example of how you can build a solder-less implementation:


Circuit schematic. The circuit is the same as the one I built.

The CP2102 and the CD4503. The nice thing about this CP2102 board is that all of the needed signals breakout onto pins. These pins can then be connected without soldering. (remember on my USB adapter, I had to solder wires to the board for 3.3V and for DTR.

The CP2102

Connecting the handset cord with "Scotchlok 3M Type Red Button UR3 Type Phone Splice Connector Wire Crimp Connectors". Here is a source.



Results from another alpha tester:



This tester found a cable with the wire colors in a different sequence than the cable I have.
His wires are Red-Black-Yellow-Green. I thought the colors were standard but I guess not!

He had to swap around the connections before his interface worked.

Here is his final interface hardware. Now it works!


Another user sent me a photo of his wired interface. Looks and works well.





Getting the RTC Program

On 8 Sep 2015, I made the RTC program generally available. It has undergone testing by a group of alpha testers and it has now met my standard of "good enough". The alpha testers (thanks - you know who you are) found problems which I fixed and I added some features over the months. You can contact me on the OGRR Forum "SanDiegoMark" or you can email (mailto: link at bottome of each web page) me with problems and questions.

You can download the program (v3.22.0 - 9 Feb 2017) here:  Remote Train Control ZIP file. This version of the program was compiled with Borland C++ Builder 4.0. You may note that some of the final windows of RTC look a little different than what is shown in these older videos. You should be able to figure it out. Links to the source code are near the bottom of this page.

Inside that ZIP file is some additional documentation that might help get you going. One of the docs included are simple operating instructions (for the wired version of RTC) which can be directly downloaded here. and for the radio version of RTC, you can download the simple operating instructions, here.

Here is the exact same version, RTC v3.22.0 but compiled with Embarcadero C++ Builder v10.1. The code is exactly the same as the BCB 4.0 version. Being that I used a newer (by decades) version of the compiler and IDE, its operation may be improved on some newer computers.

Hint - If you click on "RTC Info" from the main popup menu and then click on the "Hide" button, that annoying copyright window on startup won't appear any more.

The readme file:

Remote Train Control Program for Windows

(c) Copyright 2015 by Mark DiVecchio

    This file is part of Remote Train Control.

    Remote Train Control is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

    Remote Train Control is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with Remote Train Control.  If not, see <http://www.gnu.org/licenses/>.

----------------------------------------------------------------------------------------------------------
Installation

0. Read through this readme file and read the GNU Public and Documentation Licenses.

1. Create a folder somewhere, call it "RTC" or something like that.

2. From the ZIP archive, extract the program "Remote_Control.exe" and put it into that folder.

3. Build one of the TIU interfaces (wired or radio) shown on my web pages. Read the file "Remote Control.pdf" from the ZIP archive.

4. Double click on the program name to run it or create a shortcut on your desktop.

5. Look at my on-line videos and read the popup hints you get when you mouse over the controls

6. Good Luck
----------------------------------------------------------------------------------------------------------
Release Notes:

V 0.0.2.10   12 Apr 2015

1. Hopefully repaired the memory allocation bug

V  0.0.2.32  16 Apr 2015

1. Changed how the conventional mode voltage slider works. You can now enter the actual input voltage and the program will display the actual output volage on the slider. Or you can tell the program that the input voltage is 22v and the slider will work just like the Remote.

2. Special functions menu on the Operation Window. Right click for menu Coors Door open and close : CDO and CDC (not sure yet about CDS).   < more to be added as found>

3. If you presss the PFA button with the shift depressed, the automatic sequence is disabled. You muct press the Direction toggle 4 times just like with the remote. NOTE: I may reverse this sometime so shift causes the automatic sequence.

4. Added Electric Engine type, click on the type name in the Operations screen. The type is saved from run to run. (RTC can determine if an engine a is Steam or Diesel but I've not yet found a way to tell if its an Electric.)

5. Added Electric Engine Pantograph controls. You must change the engine type  selection to Electric for these to be visible.

6. Added RTC Main Screen popup menu
    1. DCS Setup - same functionality as the item on the Remote.
    2. RTC Info - this displays the copyright information and then sets a flag so that the copyright popup is not displayed any more.
    3. Reset RTC Registry - this resets all of the non-commuications preferences from the Setup screen and exits from the program.

7. On the Sound Control screen, I added Boiler (FPR & FBS) and coupler (SCC and SCS) sounds buttons along with a Train Wreck sound button (STW). Engine type must be set to Electric    for the Boiler buttons to display.

V 0.0.2.33   16 Apr 2015

1. "Speed mode" was too fast for the TIU. I had to put a short delay in each transmission.

V 0.0.2.53

1. I created a TX only mode for when the TIU to PC path is not working. This is not a good long term use. You should get that path working. Set this in SETUP in Debug Mode. Select "TX Only Comm", set "# Retries" to 1 or 2 and set "Speed Mode". In this mode of operation, commands which require data back from the TIU will not work. Only available in Debug Mode.

2. Repaired a second memory allocation bug

3. I've realized that LashUps will probably not work in Speed Mode as some commands used by LashUps take several times longer than regular commands to be processed in the TIU. Try it but you might have trouble.

4. On the Engine List popup menu (right click), I've added options to set the engine into Command Mode, Legacy Mode and Conventional Mode.

V 0.0.2.60

1. I've added some code to make the horn/whistle buttons on the operations screen a little less sticky. Generally, clicking those button very quickly causes the problem. When you click them, click deliberatly and slowly.

2. The TIU box in the upper right of the main screen now shows the status of the communications with the TIU:
    white:    communications not attempted yet
    green:    last communications successful
    red:    last communications failed
    yellow:    communications in test mode (eg: "TX Only Comm" is set)

3. Fixed a "Critical Section" error. For the techy types, the VCL controls that I use in the Borland C++ Builder environment are not thread safe. I had to have the RS-232 part of the program send a message to the VCL part of the program for certain operations.

4. Added a "Drop DTR on Idle" mode. Now when RTC has been idle for 10 seconds, it drops DTR. When RTC needs to communicate with the TIU again, it raises DTR. If you use my interface design with the 3-state buffer, droping DTR makes the TIU think that you have unpluged the remote. This lets you use the wireless remote just as in normal operation. Look at Setup Screen.

5. The "Activate" button on the Accessory Screen has the same sticky problem as the horn (see note 1). I applied the same fix to this button.

6. I repaired a error in the RTC Recording/Playback code. Any recorded files that you previously recorded probably won't playback any more. Sorry.

V 0.0.2.61

1. I think I fixed the problem with the "sticky" Horn/Whistle button.

V 0.0.2.65

1. Added RTS to have the same functionality as DTR, that is, if the progam is idle for more than a few seconds, it will drop DTR and/or RTS (as selected on the setup screen). The dropped DTR/RTS can be used to disable the interface buffer chip so that the DCS Remote can control the TIU. When the progam needs the TIU again, it will automatically raise DTR/RTS. Suggested by an alpha tester.

2. The AIU control code had a bug in it which is fixed. The bug prevented the AIU from responding to the program. Uncovered by an alpha tester.

3. I made another attempt to fix the sticky button problem.

V 0.0.2.70

Interium version - never released

V 0.0.2.92

1. Each TIU now has its own list of engines. These are kept on five files on the disk named "EngineDataX.ini" where X is the TIU number, 1 to 5. If you used a previous version of RTC and want to keep the list of engines, you should rename the file EngineData.ini to EngineDataX.ini where X is the TIU number that you use. You can find this file in the same folder as where the RTC program itself is located.

2. As an extenion to #1, the RTC program now saves all of its information on a TIU by TIU basis. This means that you can start up two copies of RTC, set one to TIU 1 and the other to TIU 2, then set two different COM ports, use two USB to RS-232 adapters and cable up to two TIU. Actually, there is no reason that you can't use five copies of RTC and five adapters connected to five TIU.

To make this work, you have to tell RTC which TIU and which Remote number to use. I have added two command line parameters. If you create shortcuts on your desktop, set the "Target" of each one to something like:

E:\Projects\SerialTest\Remote_Control\Remote_Control.exe 1 15
E:\Projects\SerialTest\Remote_Control\Remote_Control.exe 2 14

where the first parameter is the TIU # and the second is the Remote #

You can then startup each one and select different COM ports and you are off.

3. An idea stolen from Mike Hewett and his Train Brain based program. Shows one window with up to 10 sets of controls. Each set contains only the basic functions but you can see the controls for up to 10 engines at the same time. You can select the engine number for each Engine. This does not work for LashUps yet but might sometime in the future. To access this feature, RTC must be connected to the TIU and then press the "Quick Ctrls" button. RTC will remember the engines that were selected. Settings are saved on a per TIU basis.

4. Added an option in Setup to keep old engines in the Engine List when the "Read" button is pushed. This lets you accumulate engines if you have more engines than fit on your layout. Suggested by an alpha tester. Engines are shown on the Engine List in normal font for active engines and in Italic and grayed for inactive (that is, not found by the previous "Read") engines. As another addition to this, when an engine is added to a LashUp, it is grayed in the Engine List. It returns to normal font when the LashUp is broken up.

V 0.0.2.99

1. Added state information to the saved Accessory/Switch data. RTC will remember the state of each Accessory/Switch between runs. When first started, RTC can't know the state so it assumes that accessories are OFF and switches are Straight.

You must delete any AccDataXX.ini files as the old format is not compatible with this change. Sorry

2. I added some color to the Accessory/Switch control screen so you can tell quickly the state of each device. I added a "Make it so" button which goes through all the devices listed and sets them to their saved state.

3. Another shot at the sticky button problem. This is probably as good as I will be able to get it within the limitation of the Borland C++ Builder environment. You have to press most buttons for at least about a quarter of a second in order for them not to stick. If they do stick, you can always unstick them by pressing them again for more than about a quarter of a second. This was a major rewrite of the handling of the sticky buttons. The problems occurs more on faster computers.

4. The max speed spinner was not working correctly. Fixed.

5. One of the alpha testers reported that sometimes the speed sent to the TIU does not match the value in the Speed Slider. He noticed that when he dragged the Speed Slider to zero but the engine kept on moving. This turned out to be another limitation of the Borland C++ Builder environment. The same problem as the sticky buttons - the event driven architecture of Windows causes a request to set 0 MPH to be sent before the request to set 1 MPH is complete. The 0 MPH request was lost. I redesigned the slider operation and now the problem will be much, much less frequent.

V 0.0.3.00

1. panStamp radio support. Plug in the panStick with the panStamp radio plugged into it. Drivers should load. Determine the COM port number that was assigned to the panStamp. Start RTC, go to Setup, pick "Radio Support", select the appropriate COM port, press "Hide & Save". RTC should work just like a remote. You can select TIU's 1 to 5. You can switch between the TIU. You can startup and engine on TIU 1, then startup an engine on TIU 2 - you will have two Operations Windows controlling those two engines on their respective TIU. See this web page for more information.

2. I improved the look of some of the button Icons.

V0.0.3.1

1. An alpha tester requested that I add hot keys to open/switch to different Engine Operation screens. Now F1 through F10 will start the corresponding engine from the engine list or if its already started, will switch to its Operation screen.

2. I've expanded on those hotkeys. Look at the file Remote_Control.pdf for the complete list.

V0.0.3.2

1. "Auto Connect to TIU" setup option causes RTC to connect to the TIU automatically when the program is started.

2. Added option to use the minimum acceleration and deceleration rates for all engines and LashUps - "Use Acc/Dec = 1". I recommend that you always use this option. With this slowest acceleration/deceleration, the engines are close to real life but still aren't slow enough.

3. Added a "Mode Select" radio button box to the Setup screen. In this selector, you can select specific RTC support for the "Wired" or "Radio" interface to the TIU or for support for the "TIU Emulator".

4. Added a "Startup All" button to the main screen which, when pressed, will send a startup sequence to all "Active" engines in the Engine List that aren't already started. This will open an operations windows for the started engines. Enable this by checking the "Enable SU/SD All" checkbox on the Setup screen.

5. Added a "Shutdown All" button to the main screen which, when pressed, will send a shutdown sequence to all started up engines in the Engine List. It will close any open operations windows for the shutdown engines. Enable this by checking the "Enable SU/SD All" checkbox on the Setup screen.

6. Moved the Coors door open/close to buttons on the the Sound Controls screen. These buttons are always enabled because I don't know how to tell if the Coors train is running.

7. Added a "Mute" menu selection to the RTC main screen popup menu. This selection mutes all started engines. Selecting it, places a checkmark next to it. Selecting it again removes the checkmark and unmutes the engines.

V0.0.3.15

1. Changed the way that the COM port is selected. Now the RTC program will list the COM ports that it finds and you can just select the one you want. You can also just click the spinner to select the port. The COM port list also displays the "Friendly Name" if it can figure it out. You will probably have to choose the COM port the first time that you run this new version
of RTC.

2. Added Auto Labored Smoke handling to the Operations window (steam only). When "Labor Chuff" button is pressed, the engine's smoke level will be changed to maximum, when "Drift
Chuff" is selected, the smoke level will be changed to minumum. When both are turned off, the smoke level will be left unchanged.

3. In a similar manner as #2, added Auto Rev Exhaust handling to the Operations window (Diesel only). When "Rev Up" is selected the engine's exhuast level will be changed from minimum to medium to maximum as rev levels are increased from 1 to 9. In the same manner, the exhaust level will be lowered as "Rev Down"  is selected.

4. Cleaned up TX Only mode (a Debug only mode) to put a 100ms delay between each command. RTC was sending commands to the TIU faster than the TIU could process them.

5. RTC quietly ignores any TIU responses addressed to a different Remote number.

6. I changed the way the PFA button on the Operations window works. I never liked my original implementation. First, I added a new option on the Setup window "Automatic PFA Sequence".
A. if "Automatic PFA Sequence" is not checked, the sequence will start and you need to click the Direction button 4 times just like with the remote. You can press the PFA button again to cancel the sequence. Between the presses of the DIR button you can go off and run other engines.
B. if "Automatic PFA Sequence" is checked, the sequence will start and automatically send the Direction command 4 times spaced about 20 seconds apart. You can press the PFA button again to cancel the sequence. When this automatic sequence is running, you can go off and  run other engines.
C. The PFA button is green when the PFA is running.

7. Improved the performance of the "Radio" option on the Setup window. Now Port information is separately saved for radio mode (for wired mode, port information is already saved by TIU number).

8. Improved the operation of the "Activate" button on the AIU Accessory/Switch control window.

9. Added a right click popup menu on the Emergency Stop button to give you the option to just send Shutdown to all engines rather than killing the TIU power.

10. Added a Master Volume control on the Quick Controls window for each engine. The volume setting is saved between runs (as is the smoke switch setting).

11. From the main RTC window right click popup menu, I added an option to change the TIU number.

12. I added a new option to the Setup window : "Short Bell/Whistle Sequence". This option causes a shorter Bell/Whistle sequence when moving from 0 Smph. Suggested by Mike Hewett. This option leaves the Bell ringing after the sequence is complete and you must manually turn off the bell.

13. There is now a right click popup menu attached to the Bell switch on the Operations window. You can turn on the bell for 10, 20, or 30 seconds and it will automatically turn off at the end of that time.

14. Touchscreen note: The touchscreens that I have found don't handle "long presses" well. They seem to use "long press" to emulate a "right mouse click". I have found that if you roll your finger you can get the same effect as "long press". This affects the Whistle/Horn and Accessory Activate buttons on RTC. The other built-in problem with the touch window is the missing SHIFT, ALT and CTRL keys. Currently, RTC uses some of those keys for alternate actions when clicking a button. Over time, I will be adding popup menus to present those same alternate actions so eventually, those keys won't be needed.

15. The DCS Setup window now saves its settings by TIU number.

16. I made the selection of Middle Engines when creating a LashUp simpler. You can click on an engine then the ">" button repeatedlly to add engines. Click on the "<" button to clear the Middle Engine List and start over.

17. I further improved the "Critical Section" code which should reduce the problem of "sticky" buttons.

18. I improved how LashUp are created/edited. Sometimes, though, an engine will not get correctly marked as active/inactive. You can right click on the engine list on the Main screen and set any engine to active/inactive.

19. When LashUps are started, Smoke/Exhaust and Engine Type are set to values saved with the head engine.

20. I added an option on the Setup Screen to disable the Emergency Stop buttons. Use at your own risk!

21. I added a right click popup menu on the Whistle/Horn button. This feature is still experimental and may not work correctly. The problem is that the minimum duration whistle/horn is different for different engines.

V0.0.3.16

1. I added a Super TIU mode selection on the setup window. This is my best guess at how it works but it remains largely untested because my layout doesn't need it. Feedback appreciated. Debug Mode only. If you don't know to get into Debug Mode, contact me. I'll move this out of Debug mode once a few people use it.

2. I did some more testing and fixups on the code which allows the use of Engine #0 - the factory reset engine. You can control, rename and renumber factory reset engines. Debug Mode only. If you don't know to get into Debug Mode, contact me. I'll move this out of Debug mode once a few people use it.

3. I added the ability to create Routes and Scenes. They are not separate things as in the Remote but can contain both switches and accessories. Up to 256 can be created. Each can contain an unlimited number of switches and accessories (although only 500 (250 switches and 250 accessories) can be connected to the maximum 5 AIU on 5 TIU). They can be "Activated" to presets or "Reset" to defaults. Unlike the remote, you set an accessory to turn off when a Scene is activated.

The Route/Scene windows works in a similar manner to the LashUp Window.

Right Click on the Route/Scene window for Help.

4. I cleaned up the operation of the AIU Control window. Now double clicking on an accessory or switch will toggle the state of that device. The state is now shown with a cute Icon rather than words.

5. Added "All" Accessory and Switch operation to the AIU Control Screen. Turns On/Off all accessories connected to the TIU or sets all switches connected to the TIU to straight/diverge. ALL switches and accessories connected all AIU connected to the selected TIU. Debug Mode only. If you don't know to get into Debug Mode, contact me. I'll move this out of Debug mode once a few people use it.

V0.0.3.17

1. The Engine List on the main window was acting odd and I finally found the cause and fixed it.

2. The little Icons that I used for Accessory and Switch states had a transparent mode which I forgot to set. Now their background is transparent.

3. On the AIU Control and the Create Route/Scene windows, I show the four possible state Icons as a "Legend". I wasn't very clear that they are not buttons. I added a Hint which pops up trying to explain what they mean.

v0.0.3.18 AKA v0.3.18.0

0. I changed the version numbering scheme because I find that I am sending out RTC to my alpha testers between releases. I need a way to distinquish these. This would have been v3.18 but I just moved the numbers one position to the left. So this is version 3.18.0. I will use the last digit position for intermediate releases.

1. On the Operations screen, the Boost and Brake buttons will increment/decrement the speed by 1 Smph if clicked. If held down, they will increment/decrement the speed by 1 Smph every second. I also made them a little larger so my aim on my touchscreen did not need to be so precise.

2. I spent the last week finally digging into the way that Engines report which hotkeys that they respond to. In response to an Interrogate command, the Engine reports back 80 bytes of data. 26 of those bytes indicate hotkeys based on bit position where there is a '1' bit. I was able, using the RTCEngineE Arduino program, to set all of those bits to '1' and feed them to a Remote. The Remote then listed all of the hotkeys when I pressed the "S4"/"more" button. I've been able to detect 70 hotkeys and the exact bit in the Interrogate command response that causes that hotkey to be displayed by the Remote. Once I could do that, I could just press the hotkey on the Remote and watch (again using RTCEngineE) exactly what command the Remote sent for that hotkey function.

Using what I learned, I modified the Operations and Sound Control Windows to show only controls for hotkey functions that are actually supported for each engine. So if the engine does not support the Grade Crossing Signal, for example, that button will not appear in the window.

This includes switches and buttons on the Operations Window for:
    Firebox Glow (LFB)
    Headlight (something different than the HDLT button on the Remote)
    Mars Light (LMA)
    Ditch Lights (LDI)
    Interior Light (LIN)
    Marker Lights (LMK)
    Beacon Light (LBE)
    Number Boards (LNB)
    Running Lights (LRL)
    Track Inspection Lights (LTI)
    Auxiliary Lights 1 (LA1)
    Auxiliary Lights 2 (LA2)
    Auxiliary Lights 3 (LA3)
    Crossing Signal (SXS)
    Pantograph Menu (MOP)


And on the Sound Control Window for:
    Coors Delivery (Start/Stop/Doors Open/Doors Close) (CDS, CDO, CDC)
    Boiler Startup/Pressure Release (FBS, FPR)
    Train Wreck (STW)
    Coupler Slack (SCS)
    Coupler Close (SCC)

If you want to understand the gruelling details of the hotkey encoding, on my web page, look for the file "Command ('Ixxx') Response.xls". I haven't completed this yet. Some of the hotkeys, like Engine and Idle Sounds, are not used by RTC so I haven't yet determined their exact bit position. I'll do it when I need it.

I'd appreciate feedback on how well this works. If you look at the hotkeys on a Remote, RTC should show the same set of hotkeys from the list above. Remember though, I don't have hotkeys for Engine Sounds or Idle Sounds and other hotkey functions are handled in the background by RTC.

RTC does not handle Doppler or Trolley functions. RTC does not yet handle the quillable whistle but I know the hotkey commands to do it. Let me know if you have an engine with such a whistle.

As an aside, in looking in detail at hotkeys, I can see a lot of erroneous hotkey information in the Engines. For example, I see many cases where a Marker Light hotkey is reported by the Engine but that Engine did not have any Marker Lights. I have a Doddlebug that reports a Pantograph Menu.

3. Hotkeys not tested because my engines don't have them:
    Beacon Light
    Running Lights
    Firebox Glow
    Mars Light
    Auxilary Lights
    Pantograph
    Coors Delivery
    Boiler Startup/Release

4. On the Operations Window, I deleted the "LIN Light" switch as it now is handed by the hotkey code. I added a "Sounds" switch which will mute the engine sounds.

5. Generally cleaned up a lot of labels and Hints.

6. I realized that if communications fails while playing back a saved recording, I needed to do something drastic. So now if comm fails (after the set number of retries), RTC will send an Emergency Stop to all TIU's.

7. Dumb typing mistake in the LashUp window code prevented start up of a good LashUp.

8. I generally made buttons bigger where I could mostly to help when using a touchscreen.

9. Rule 17 lighting - almost. My P&LE GP-7 #1501 (PS3) headlight dims when it is stopped. A nice feature not even listed on the MTH webpage (but the webpage advertises lighted marker lights and there are none). I've added a setup option to RTC which automatically turns off the headlight when your engines are stopped. Not exactly correct but its there if you want to use it. Defaults to off, if set, it applies to all engines.

v 0.3.19.0

0. This is mostly a maintenance release where I created one set of source code which would compile under BCB4.0 (my orginal IDE) and CB10.1 (the lastest IDE from Embarcadero).  Thanks to the Kevin Rice for leading the way on this.

1. I added a debug mode for the Engine Sound Knob. Now in debug mode, you can explore all of the 255 values for this knob and see what sounds come out. In particular, starting at engine sound 80 are the clips for PFA.

Some of the engine sounds cause a continuous repeat of the sound. When that happens, other sounds will not play. I don't know how to turn this off other than pressing the "Whistle/Horn" button.

Note: in non debug mode, the Engine Sounds Knob sends commands that correspond with the Engine Sounds as listed on the hotkeys. When sound 1 is selected, the command "n177" is sent and so on. In debug mode the knob setting is sent unchanged to TIU. If sound 1 is selected in debug mode, "n1" is sent to the TIU. The sound number corresponds to the index used by the ADPCM program.

2. Changed the Rule 17 lighting to be by engine rather than to apply to all engines. It now also turns off the interior light when the engine starts moving. I added a switch to the Operations screen.

v 0.3.20.0

1. Added Hot Buttons:

    The big addition are Hot Buttons. This is a window of 20 buttons that you can program to perform most any operation, on any engine, on any TIU or AIU. So if there are functions that you do over and over, on any TIU or to any engine, you can setup this window to do that function with one click of a button. You can popup this window and keep it on the screen to use as needed.

    Up to 20 Hot Buttons can be defined. Once defined, a click on the button will immediately send that command. To open the Hot Buttons Window, click on the [Hot Buttons] button on the Main screen.

    To edit a button, right click on that button. Fill in the fields:
        - Button Label that will appear on the Hot Buttons Window. Use "&&" for "&", ie "P&&LE".
        - Command to be executed selected from the drop down Command List
        - TIU Number 1-5
        - Engine/Lashup Number: Engines 1-99, All Engine Operation 100, or LashUp 101
        - for AIU commands, the AIU Number 1-5 and the Port Number 1-10
        - for LashUps, the LashUp String - engine numbers separated by commas, using a minus sign to indicate Reverse Running.
        - for engine sounds, enter the sound number 1-255

Press the [OK] button to accept that command.

To undefine a button, right click on it, press [Clear] and then press [OK].

A special function "Playback of a Recorded File" lets you associate a recorded file with a hot button. When you press the button, the recorded file will play. You can cancel playback by pressing the [Cancel] button on the playback popup. You can repeat the playback by checking [X]Repeat.

The program, internally, maintains the Command list. If you want to add a command, right click the Hot Buttons Window outside of the Hot Buttons themselves and select "Edit Command List". Each line in this list is a command. The format is "Command Description"="Command". Press [Done] to save the edited list. The edited list is saved in the RTC folder with the name "HotCommands.txt". You can delete this file at any time to return to the internally maintained list.

A setup option "[X]Auto Hot Buttons" causes RTC to display the Hot Buttons window automatically each time the program starts.

2. Moved position of Quick Controls button

3. The buttons for Startup All Active Engines and Shutdown All Engines have  been removed. To perform these functions, right click on the Main Window and when you get the popup menu, you can select these functions.

4. In the setup, you can select [X]Allow 255 Sounds. This sets the Engine Sound knob on the Sound Controls window to show sounds 1-255 on the knob. With this, you can play all 255 sounds in the engine. On the remote, "S01" hot key selects sound 177, "S02" selects sound 178 and so on. The 1-255 number corresponds to the index into the sound file as shown by the ADPCM program. http://www.silogic.com/trains/ADPCM.html

4a. For touch screen users, I added up/down buttons to both the Engine and Idle Sounds knobs. With a touch screen, the knobs are too hard to accurately control. The knobs themselves may disappear someday.

5. Totally rewrote the recorded file playback routine. Now when you select a recorded file for playback from either the Setup window or the Hot Buttons window, the playback runs as a separate thread. That means you can do other operations or even other playbacks while the playback is running.

V 0.3.21.0

1. Hot buttons would not work if you had no AIU, ouch.

2. Bug fixes in Quick Controls. Enhancements in Quick Controls.

3. General code cleanup and communications speed up.

4. General improvement in how Conventional Mode works. RTC now puts the channel into Variable mode when you select the [VarX] button.

5. Added a button on the operations screen that causes the bell to sound with the Horn/Whistle and with the Crossing Sound. The setting of this button is saved.

Now this button and 3 others have been relocated on the operations screen:
    Rule 17 Lighting - turns off the headlight when stopped
    Ring Bell w/Horn - causes the bell to sound with the Horn/Whistle and with the Crossing Sound
    Auto Bell/Whistle - relocated from a switch. Sounds the horn/whistle when engine is starting moving from a dead stop
    Auto Labored Smoke/Auto Rev Exhaust - For steam engines, increases smoke output when laboring.
                For diesel engines, increases exhaust output when Revs are increased.

The settings of these 4 switches are saved with the engine.

6. Super TIU Mode operation improved. Setting screen added from "Super TIU Mode" button on Setup window.

7. Added the ability to increase the size of the Quick Controls window. It also increases the size of all of the buttons and controls for easier touch screen use. The size can be set to 1.0, 1.1, ... 2.0 of the normal size.

V 0.3.22.0

1. I found the Hot Buttons to be so useful that I added 4 more windows of them so their total is now 100. Right click on [Hot Buttons] to bring up a popup menu where you can select from the 5 windows. Left click on [Hot Buttons] brings up buttons 1-20 just as before.

2. Added support for Alternate Sound, SAH. This button, on the operations window, plays sound 243. If the engine supports the SAH button, it will appear automatically on the operations window when the engine is started up.

3. Yet another attempt to fix the sticky buttons problem. In the Windows message based execution environment, I delayed the processing of the mouse button up message until after the mouse button down message processing is complete.


Radio Interface between the TIU and the PC:

I've been able to communicate between the PC and TIU via radio.

I used the panStamp AVR 1 which is no longer available. In the photo, it is shown mounted on a panStick 3.0 (with the USB connector, also no longer available). The panStamp consists of an Arduino-like processor using the ATMega328 MCU along with a TI CC1101 radio chip.  Its programmed using the Arduino IDE along with the panStamp AVR 1 board files as downloaded by the IDE's Board Manager. The new version of this board is now available. Its the panStamp AVR2 @  902-928 MHz along with a panStick 4.0.


panStamp 1.0 and panStick 3.0 (no longer available)

The antenna is a 3.069 inch quarter wave whip.

Look here for a preview. I will have the writeup about the technical details of the radio on this web page. (this page now has the details of using the panStamp AVR 2.0  as well as a solution with a different radio board, the ElecHouse CC1101).


About my Borland C++ Builder v4.0 IDE

RTC was developed with a program that was released when Windows 98 was current. The IDE is Borland C++ Builder v4.0. I've used it on Windows XP, Windows 7 and Windows 10 with success. You can still find copies on eBay. 

The IDE is designed tobe  expanded with 'components'. These components can be visual (like buttons) or non-visual (some code that performs a function). The RTC program uses:

 Components that I wrote and which you will have to install in the IDE:
 HideButton - implements the functionality of the [Hide] button. <download ZIP file>
 QuitButton - implements the functionality of the [Quit] button. <download ZIP file>
 ColorButton - implements the funtionality of the standard button but in color. <download ZIP file>
 SyncListBox - implements the functionality of synchronizing the reverse running check box (TCheckListBox) on the LashUp window. <download ZIP file>

 Components that I bought:
 Abakus VCL - v6.51 - implements the functionality of the speed slider, toggle switches and other controls.

 RTC Version 3.20.0 source code 4 Sep 2016  for Borland C++ Builder v4.0 is available here <download ZIP file>.

Released under the  GNU General Public License Version 3 and GNU Free Documentation License Version 1.3. 

You will have to buy Borland C++ Builder v4.0 (eBay??) and Abakus VCL v6.41 to compile this code.


About my Embarcadero C++ Builder v10.1 IDE

With the help of Kevin Rice, who first ported RTC to use the lastest IDE and Abakus releases, I was able to edit the RTC source code so that one set of source files would compile under both the old and new IDEs.  Borland became Imprise and then became Embarcadaro. Embarcadaro is still around and sells a modern version of this IDE (C++ Builder  (version  10.1)) which is the version to which we have ported the code.

The IDE is designed to be expanded with 'components'. These components can be visual (like buttons) or non-visual (some code that performs a function). The RTC program uses:

 Components that I wrote and which you will have to install in the IDE:
 HideButton - implements the functionality of the [Hide] button. <download ZIP file>
 QuitButton - implements the functionality of the [Quit] button. <download ZIP file>
 ColorButton - implements the funtionality of the standard button but in color. <download ZIP file>
 SyncListBox - implements the functionality of synchronizing the reverse running check box (TCheckListBox) on the LashUp window. <download ZIP file>

 Components that I bought:
 Abakus VCL - V8 - implements the functionality of the speed slider, toggle switches and other controls.

 RTC Version 3.20.0 source code 4 Sep 2016 for Embarcadero C++ Builder v10.1 is available here <download ZIP file>.

Released under the GNU General Public License Version 3 and GNU Free Documentation License Version 1.3.

You will have to buy Embarcadero C++ Builder v10.1 Starter Edition (go to their web page - as of 18 Sep 2016, the Starter Edition is FREE!) and Abakus VCL v8 to compile this code.


Screen recording performed with CamStudio.


This site prepared and maintained by Mark DiVecchio

email :  markd@silogic.com

SD&A HOME
 
 Mark's Home Page

The DiVecchio genealogy home page
The Frazzini genealogy home page

This site will be under construction for a while.