Digital intelligent booster for DCC miniature train networks

Modern miniature trains are now driven by means of the DCC (Digital Command and Control) system, which allows the human operator or a personal computer to launch commands to each individual train or even to control different features of the same train. The digital command station encodes these commands and sends them to the trains by means of electrical pulses via the rails of the railway network. Due to the development of the miniature railway network, it may happen that the power requirement of the increasing number of digital locomotives, carriages and accessories exceeds the nominal output power of the digital command station. This digital intelligent booster relieves the digital command station from powering the entire railway network all by itself, and it automatically handles the multiple powered sections of the network. This electronic device is also able to detect and process short-circuits and overload conditions, without the intervention of the digital command station.


Introduction
Nowadays, hobbies have become very important aspects of our lives. Model railroading is one of these hobbies, a very spectacular and interesting one, which requires a certain level of scientific knowledge and skills for the enthusiasts. More than being mere toys, the latest model locomotives and rolling stock are trying to replicate as well as possible, at a smaller scale, the looks and even the prototypical behaviour of their real world counterparts. Modern miniature trains can be taken as micro-robots, due to their features and internal architectureelectronic digital decoders, individually controllable miniature motors and supplementary devices, such as lights, sounds, smoke generators, sparks simulators at the wheels and pantographs, electrically switchable couplers, functional doors and even moving passengers inside the carriages etc. All these have become possible due to the continuous enhancing of the miniature railroading industry, together with the conventional and nonconventional manufacturing technologies, allowing the realistic and correct miniaturization of more and more train components [1,2]. The independent features of the modern digital miniature trains can be operated by means of the DCC system, where DCC stands for Digital Command and Control. Briefly, the commands issued by the human operator are converted into digitally coded electrical signals by the digital command station, which feeds these signals to the rails of the miniature train network. The digital decoders of every locomotive, carriage and other miniature railway device receive, decode and execute the individual commands addressed to each of them. Lately, it has become possible that these digital decoders can send feedbacks to the digital command station via the same rails of the train 2 1234567890 ModTECH IOP Publishing IOP Conf. Series: Materials Science and Engineering 227 (2017) 012133 doi:10.1088/1757-899X/227/1/012133 network, and they can even "talk" to each other, which allows the automation of the railway operation, relieving the human operator from performing additional tasks, security checks etc. This paper presents a digital device that can be used to ease the load of a digital command station for large miniature train networks. The railway tracks can be divided into multiple electrically insulated sections, which are then fed with electricity and digital commands through the independent sections of this digital intelligent booster. Moreover, this device can handle the individual operating conditions of each railway section, according to the commands that are launched by the human operator or by a personal computer via the digital command station. This digital intelligent device boosts the original DCC signal of the digital command station, relieving it from powering the large miniature train network all by itself, and deals with the individual normal and abnormal operating conditions (overloads and short-circuits) on each railway section. This digital device was built according to the experience and own ideas of the authors.

DCC System
The miniature trains are fed with electricity by means of the two metal rails of the railway network, placed on insulating plastic sleepers. They can be operated using one of the two main systems: analogue or digital. In the analogue system, the rails are fed with continuous voltage, according to certain specifications, such as 14 volts maximum voltage. All analogue trains on the same track react the same way: they go forwards when the right rail is connected to "plus" and left rail is connected to "minus", and they go backwards when the polarity is reversed ( fig.1). The analogue trains go faster if the voltage increases, and they slow down if the voltage decreases. All analogue trains stop when the voltage is cut off. All the internal components of the analogue trains are electrically connected to the wheel power collectors that pick up the electricity from the rails, which means that the polarity and the variable voltage affect all of them ( fig.2.a). Their motors will rotate one way or the other, faster or slower, according to the voltage and polarity, but also their headlights brightness will react the same way. As a result, the headlights will get brighter as the train speeds up, they will get dimmer as the train slows down and they will turn off when the train stops. This is definitely not a prototypical behaviour relative to the real trains. Also, all the trains on the same railway will travel in the same direction, with comparable speeds, which does not look very realistic as well. In conclusion, the analogue system is relatively simple, but does not provide realistic behaviour of the analogue trains. The DCC system is more complex than the analogue system. Each locomotive, carriage or railway accessory must be fitted with digital decoders, which are able to receive, decode and execute each command that was addressed to them by a central digital command station. This complex electronic device receives the commands that were initiated by the human operator or by a personal computer and codes them into electrical pulses that are fed to the rails of the train network. The internal components of the digital trains are not connected to the power wheel pickups anymore, but to the outputs of the digital decoders ( fig.2.b). They can be enabled or disabled individually and not all together, which means that, for example, trains can stand still with their lights brightly lit. Also, different trains on the same line can perform different tasks, as if they were driven by their own drivers. In addition, the modern digital decoders are now able to produce sounds and other realistic effects such as steam bursts emission synchronised with the locomotive puff sounds and correlated with the locomotive speed, which was not possible within the analogue system. Thus, the DCC system enables the modern digital miniature trains to accurately replicate the behaviour of their real-life counterparts [2]. a b Figure 2. Internal connections of miniature trains; a -analogue locomotive, b -digital locomotive.   In order to maintain the compatibility between all digital trains, all the DCC signals and devices must comply with the same NMRA (National Model Railroad Association) regulations, which establish a set of rules for encoding, decoding, signal amplitude and durations etc. [4,5]. Briefly, the DCC signal consists of positive and negative pulses that are continuously sent to the rails by the digital command station. These pulses must be rectangular, with constant amplitude (default value 16 volts, but can be set to lower values for smaller trains and to higher values for bigger trains) and standardised durations. The DCC signal contains rows of encoded "1" and "0" bits, according to the NMRA Standards & Recommended Practices. Fig.5 shows a fragment of the DCC signal, which is broadcasting the encoded "1" and "0" bits.  The hardware and software of the digital command station encodes the commands launched by the human operator or by a computer, turning these commands into rows of pulses that are sent along the rails of the miniature train network. The same algorithm is applied by the digital decoders, which are able to receive, decode and execute the commands that are addressed to them individually. The digital command station sends the information in "packets". One such packet contains bits and bytes in a certain order, by means of which commands are transmitted to one individual decoder. The decoder analyzes the signal received from the rails and searches for data packets destined to it. Before emitting one data package, the central digital command station broadcasts a series of ten or more "1" bits, so that the decoder will "be aware" that a data packet will follow. This sequence is followed by a "0" bit which warns that the next byte will contain the decoder address. If the decoder does not recognize this address as its own, it ignores the entire data package. Fig.6 shows a baseline packet with the instruction for locomotive 55 to proceed in the forward direction at speed step 6 (in 28) [5]. The commands are encoded in a similar way and are continuously sent to the rails of the train network. Thus, the rails are permanently powered, which puts a serious burden on the output power section of the digital command station when the railway network grows larger and there are more trains that run simultaneously. This is where the DCC boosters come into action.

Intelligent DCC Booster
When the digital command station has to deal with a large train network, with many trains that must be controlled all together, digital boosters are used. These electronic devices must provide enough electricity to support all trains and to feed them with the boosted DCC signal. The large train network is thus divided into several insulated sections, and each of them is fed with DCC signal by its own digital booster. Every booster must handle the operating conditions of its own section of track, with or without the intervention of the central digital command station. Also, each booster must be able to interact with the central digital station. Such DCC boosters are already available on the market of miniature railways systems, made by specialized companies such as Roco (Austria), Lenz (Germany), Digitrax (USA) etc. They are more or less complex, expensive, flexible etc., they all require separate power supplies, they all boost the DCC signal that they receive from the central digital command station, and they all serve one single insulated section of the miniature railway network. Our intelligent DCC booster features three final stages, which produce the boosted DCC signals for three insulated sections of the miniature railway system, and together all of them are driven by one microcontroller unit that receives the DCC signal of the central digital command station by means of an optocoupler. In addition, this booster connects the rails of the separate programming track to the DCC signal in the normal operation mode, and automatically switches them to the programming connectors of the central digital command station while in the programming mode. The block diagram is shown in fig.7. In normal operation mode, the central digital command station produces the DCC signal, which encodes the commands launched by the human operator or by a computer. In order to ensure total electric separation, the DCC signal is fed to the booster by means of an optocoupler. The microcontroller unit processes the signal that it receives from the optocoupler, reshapes the DCC signal and sends it to the three final stages via three separate outputs. The presence of these three DCC signals is shown by means of three LED's. Each final stage is able to sense any overload / short-circuit situation and, if such situations do occur, they send appropriate signals to the microcontroller unit, which cuts off only the DCC signal of the affected final stage and switches off its corresponding LED. After removing the cause of the overload / short-circuit condition, the affected final stage can then be re-enabled by launching the adequate enable command from the handheld controller of the central digital command station. Due to the software that has been loaded into the microcontroller, the three sections of the intelligent DCC booster are seen by the central digital command stations as accessories that can be switched on and off, just like turnouts, signal lights etc. Also, whenever is necessary, the operator can disable the DCC signal for one of the railway sections, without interfering with the other sections, using the handheld controller of the digital central command station. The three final stages were designed around the L6203 integrated DMOS full bridge drivers [6]. In order to sample their output currents, three 0.1 ohm resistors of 1% tolerance are connected between their "SENSE" pins and ground. The voltage drops at their terminals are carried to the microcontroller as feedback signals to be evaluated. For example, a 2A output current produces a 0.2V voltage drop. The feedback signals of the three final stages, which are proportional to their respective output currents, are continuously sent to the microcontroller unit, which compares them to a previously set threshold value. If this value is exceeded by one or more feedback signals, which means that an overload / short-circuit event has occurred, the microcontroller disables its respective outputs, cutting off the DCC signals for the affected final stages. Larger or smaller voltage / current spikes may occur during normal operations of miniature digital trains, caused by polarity changes of the DCC signal, imperfect contact between rails, wheels and power collectors, momentary contacts of opposite phase rails by the metal wheels of a train passing over a turnout, signal transients and reflections etc. (fig.8). These spikes are perfectly able to trigger the overload / short-circuit protection, although they are normal and non-destructive. In order to avoid the unnecessary protection triggering which disrupt the normal operation, the feedback signals are integrated by means of RC circuits (hardware detection). In addition, the software checks if any feedback signal continues to exceed the threshold value for more than 12 DCC packets (software detection) and, if it does, it disables its corresponding output ( fig.9).  Figure 9. Short-circuit.
All central digital command stations are able to perform programming operations, which consist of reading and writing values from/into the memory registries of the digital decoders, also known as CV's (Configuration Variables). In order to do so, the digital railway networks must be provided with an insulated railway section, named "programming track", which must be connected to the DCC output during normal operation, and to the programming outputs while in the programming mode. The digital locomotives or carriages that are to be programmed must be driven to the programming track, in the normal operation mode, and then the digital central command station is set to the programming mode, when the entire DCC signal is cut off. The microcontroller senses the absence of the DCC signal and powers the DPDT relay, which switches the programming track from the section 3 output to the programming connectors P & Q of the digital central command station. Thus, the programming commands are sent solely to the targeted decoder, preventing the unwanted adjustments of all the other decoders on the layout. The DCC signal across the rails of the main line (section 1), and the output current (measured by means of a 0.11 ohm shunt) are shown in fig.10-13. After several hours of operation, the heatsink which cools the three final stages had a comfortable temperature of 34ºC.       The digital intelligent DCC booster is fed by three separate 16V / 4A power supplies, so that the three final power stages would not influence one another. The microcontroller unit is fed by these power supplies by means of three diodes, followed by a 12V stabilizer (for DPDT relay and cooling fan, if necessary) and a 5V stabilizer. The microcontroller was programmed with custom-made software, so that it can perform all the above-mentioned tasks. The firmware was written in assembly language and compiled using Microchip's MPLAB IDE v8.80. Following, here is a short excerpt showing the routine that deals with reading the DCC data packets and checking for errors: The prototype was built on single-face copper plated PCB, with both SMD (surface-mount device) and THT (through-hole technology) electronic components, and the miniature 1:87 railway network and train collection of Mr. Ursu were used for testing and adjustments. We also used a DSO138 miniature oscilloscope kit to visualize the shapes of the voltages and currents and a VA21 autoscaling multimeter to measure their values. The maximum measured current was 1.3A on section 1, the double-track main line, when an express train with seven digitally illuminated carriages and a fast train with four digital illuminated carriages were driven at a cruising speed step of 21 (in 28). Both locomotives were fitted with sound and illuminated headlights. The overload & short-circuit protection was also tested successfully on all the three sections.

Conclusions
To date, the DCC system is the most suitable platform that adequately uses the multiple features of the modern miniature trains, which nowadays can easily be considered as micro-robots. The DCC signal must provide all the digital trains and accessories with coded commands and electrical power. When the miniature railway system gets too extended for the limited power output of the central digital station, it then must be divided into several sections which must be powered by DCC boosters that receive the same DCC signal from the central digital station. Our intelligent DCC booster is able not only to feed three railway sections with DCC signals and to take care of each section individually, but also to "listen" to some specific commands that were launched by the central digital stationselectively enabling or disabling the DCC signal for one or more sections and automatically switching the programming track to either the DCC signal (normal operation mode) or to the programming output of the central digital station (programming mode). In addition, the user is able to edit the overload thresholds and even the address and other settings of this intelligent DCC booster by means of the central digital command station itself. There is always room for further improvements. Multiple modular items might be added to the intelligent DCC booster, such as supplementary final power stages, micro-miniature gauges for voltage and current real-time measurements, LCD panel for displaying each output electrical status, USB interface for PC connection, etc.