Basic Concept

CTC is a system comprising hardware and software for controlling model railways. It features the following characteristics:

  • CTC Modules: Electronic assemblies for controlling locomotives, turnouts, signals, lighting, action modules, etc. On each CTC module, local firmware and configuration handle local control tasks such as motor control, turnout switching, turning lights on/off, etc. The respective configuration is stored decentrally in the associated CTC module.
  • CTC App: The software serves as the user interface (graphical user interface) and can be used on smartphones, tablets with Android or iOS, or on PCs with Windows, macOS, or Linux. A dedicated and costly central control unit is not required.
  • CTC modules are configured via the CTC app.
  • Communication via Wi-Fi: A dedicated Wi-Fi access point (e.g., a FritzBox) facilitates communication between the CTC app and CTC modules, as well as between the modules themselves. The transmission speed reaches up to 54 Mbit/s. No cabling is required beyond the power supply.
  • The CTC app interacts with the CTC modules. The graphical user interface allows control of functions such as driving speed, turnout positions, signal lights, etc.
  • Precise Position Detection: Using dedicated infrared transmitters in the track and infrared receivers in the locomotive, the CTC app can determine the exact position.
  • Parallel Operation with other “commercially available” digital and analog systems is possible.

Origin of the Concept

As an alternative to track-based communication, only wireless technology was really an option. Additionally, we wanted to control our model railway from a tablet or smartphone without major effort.

This left only Bluetooth and Wi-Fi as viable options for direct communication between the app and locomotive/turnout/signal. Since Bluetooth is poorly suited for a large number of simultaneous connections and its low power consumption was irrelevant to us, we chose Wi-Fi.

The next step was to develop suitable Wi-Fi modules for locomotives, turnouts, signals, etc., and—above all—to create the necessary software.

All data for locomotives, turnouts, and signals should be stored directly in their respective modules. A locomotive should not only store all technical parameters (CVs in digital model railways) but also, for example, its name, image, or a detailed description. From this idea, a software concept emerged that rendered a central control component completely unnecessary. Thus, we were left with only Wi-Fi, the modules for locomotives, turnouts, and signals, and the app.

The core of the software is now available under an open-source license on PI-Rail.org. This means the communication protocol is fully disclosed, opening the door for your own extensions.

The CTC App

Screenshot CTC-App Desktop

Screenshot CTC-App Android

The CTC app allows you to control locomotives, turnouts, lighting, action modules, and more from a PC running Linux, Mac, or Windows, as well as from smartphones and tablets with Android—and iOS support coming soon. The screenshot above shows the PC version.

The app does not store any data about the model railway. Upon startup, it reads all necessary information from the respective CTC modules and constructs its interface accordingly. Even the locomotive images and the track diagram displayed at the bottom of the app are retrieved from the corresponding CTC modules.

The CTC app provides a convenient way to configure CTC modules, flash firmware, and (initially) register CTC modules with the model railway’s Wi-Fi network. A particularly standout feature is the automatic calibration of the motor sensor in locomotive modules, along with graphically assisted tuning of motor parameters (PID controller).

The app coordinates communication with the modules to ensure smooth operation, even for large model railways with a high number of CTC modules.

Installation

Software:

  • The Android app is currently provided as an APK file. In the future, apps for Android and later iOS will be installed via their respective app stores.
  • The PC application is delivered as a ZIP file and can be launched directly after extraction.
  • The Access-Point (Router) is supplied fully installed by us. Consequently, we have all details such as the SSID and Wi-Fi password. These details will be provided to you in a protocol.
  • You can, of course, also configure a Wi-Fi router yourself.
  • In both cases, we can supply the device modules fully configured. The app includes menu options to register and configure device modules in the Wi-Fi network.

Hardware:

  • Installing the CTC locomotive module in a locomotive is comparable to installing a decoder for classic digital controls: Essentially, four wires need to be connected: two to the tracks and two to the DC motor with permanent magnets in the stator. Wound stators are also possible. Additional functions such as lighting and uncouplers would also need to be wired.
  • Installing the CTC modules in turnouts is also comparable to installing a decoder for classic digital controls. For Märklin C-track, there is the CTC turnout module for installation in the turnout with the same form factor as Märklin decoders. For all other track systems, either the CTC turnout module or a CTC Multi-I/O Board can be used. We offer various common plug and screw systems for cable connections.
  • Two IR balises for position detection can be connected to a CTC turnout module or a CTC Multi-I/O Board.

Registering a Device Module in the Wi-Fi Network:

  • Configuration Mode: A new device module (without Wi-Fi configuration) creates its own Wi-Fi network and waits to be configured.
  • If an already configured device module cannot find its Wi-Fi network, it switches to configuration mode after one minute, waits one minute for a connection, and then resets automatically.
  • The CTC app can detect modules in configuration mode at the press of a button and write the Wi-Fi configuration to the device module. After writing the Wi-Fi configuration, the device module resets automatically and then registers in the model railway Wi-Fi network.

Registering a Control Device in the Wi-Fi Network:

  • The device (PC, tablet, smartphone) running the CTC app is registered in the LAN or Wi-Fi network as usual for the device.

Commissioning (Boot Process)

Once the access point has started and the Wi-Fi is available, control devices can be connected to the LAN / Wi-Fi in the usual way for the respective device.

The fully installed device modules connect automatically to the Wi-Fi as soon as they receive power.

The CTC app automatically detects all device modules present in the same Wi-Fi network. Device modules that start later will appear in the app as soon as they are registered on the Wi-Fi. Registration of a device module takes one to a few seconds, provided the signal quality is good. If there is a dead zone, the usual options for improving Wi-Fi coverage (e.g., repeaters) are available.

For actuators connected to device modules (e.g., turnout, signal), a default position can be configured in the device settings. This position is assumed immediately after the module starts—e.g., turnout set to straight or signal set to stop. Alternatively, the initial state can be read via a sensor input. Configuration changes are made through the guided menu in the CTC app.

Track Layout

Using the CTC app, a simple track layout can be created in the form of a grid, as is now common with many model railway control centers or software programs. As is typical with CTC, this layout is stored in the model railway modules as follows:

  • For each contiguous segment of the model railway (e.g., a baseboard or standard module), select a turnout or I/O module permanently installed on that segment. The track plan for the segment is stored in this module.
  • For each individual turnout, signal, switching function, light, etc., the corresponding module stores its coordinates within the segment’s track plan.
  • For the entire model railway, an additional module is selected to store the arrangement of the individual segments into an overall track plan. The layout can also be divided into multiple track plan sections or levels.

The track plan can be edited conveniently via the CTC app.

When the app starts, it locates the overall track plan and displays it. Turnouts, signals, etc., can then be controlled via the track layout display. The respective switching position is, of course, shown.

Position Detection

Lokmodul

Using infrared signals, a CTC locomotive can determine its position with centimetre precision. For this purpose, two infrared transmitters can be connected to each turnout and IO module. These are then installed in the trackbed. Additionally, an infrared receiver must be connected to the locomotive module and mounted on the underside of the locomotive.

Via the app, each infrared transmitter is assigned an ID, and the distance in centimetres to the preceding IR balise is entered. This ID consists of the associated track section ID (2 characters) and a sequential number. The IR balises of a track section are numbered in ascending order clockwise. The position of the IR balise is also marked on the track plan.

The IR balise now cyclically transmits its ID, the distance to the previous IR balise, and optionally a command. When the locomotive passes over the IR balise, it can use the read ID and distance to determine its direction of travel and average speed since the last read IR balise. The locomotive transmits the read ID and the determined speed to the CTC app, which then displays the locomotive’s position, including its direction of travel.

Track sections that have a constant gradient (or decline) between two IR balises and are either completely straight or uniformly curved can also be used to calibrate the locomotive module’s motor sensor. In a suitable loop track, the CTC app can perform this calibration automatically.

With a well-calibrated motor sensor, the locomotive can now estimate its speed (in mm/s) and its distance from the last IR balise. If the model railway layout has an IR balise approximately every 60 to 100 cm, position detection will be accurate to within a few centimetres.