home : electronics : Train control system

My Train Control System

I have started to develop my own model train control system. The train control system is based on the Fox board from Acme Systems. The Fox board is a small embedded Linux system. It features an Ethernet port, some asynchronous and synchronous serial ports and two USB ports (I do not use the USB ports for the moment).

Here is an overview block diagram of the complete system:

Fox board and buffer board

The Fox board is based on the ETRAX 100LX System On a Chip component from Axis Communications. I have the old version of the board, based on the ETRAX 100LX 4+16 MCM Multi Chip Module, but this makes no practical difference. The ETRAX 100LX has very flexible I/O options. Only the Ethernet and USB ports are used on the Fox board, but there are mounting holes for two 2x20 pin sockets, allowing you to access all the different I/O signals of the chip. Of the different I/O functions offered, I use the following:

The synchronous and asynchronous serial ports are not buffered on the Fox board, so they are LVTTL (3.3 V) signals. The booster uses standard TTL (5 V) signalling. The other signals also need buffering, and I also want to have somewhere to connect the power feed to my different decoders. I have therefore built a buffer board with some standard TTL level logic buffers and a number of contacts. I have also included a 5 V regulator and an RS232 driver for the control panel output. The Fox board is mounted on top of the buffer board.

Since I use M-tracks, all my turnout lamps are grounded through the track, and share power feed with the switch solenoids. I want to be able to turn the turnout lamps on and off, and the only way to do that (without reworking the M-track turnouts inside) is to have the power supply for the turnouts isolated from the track power. The turnout lamps can then be turned on by connecting the grounds of the two systems. I have therefore included a relay that can connect or isolate the turnout control ground, and opto couplers to propagate the serial signal to the isolated turnout decoders.

Buffer board schematic

The buffer board schematic can be found here:

Software

The Fox board is Linux based. It can run either a Linux 2.4 or a Linux 2.6 kernel. Linux 2.4 is installed by default, but you can download an SDK from Acme or Axis and build your own kernel. I have used the Axis 2.10 SDK to build a Linux 2.6.19 kernel. Previously (up to version 0.2 of my driver) I used a precompiled Linux 2.6.12 kernel from Acme Systems.

The kernel has three asynchronous serial ports and two USB ports enabled by default. I need to replace one asynchronous serial port with a synchronous one to control the output to the booster. Axis provide source code for a synchronous serial port driver, but that driver is not so suitable for the rather special task of controlling model trains, so I have written a special synchronous serial driver as a loadable kernel module. So far it supports the Märklin/Motorola and DCC formats. I have added some support for the output part of the mfx protocol as well. The DCC part is very little tested since I only have one loco that understands DCC and that loco has no functions, not even headlights. The accessory (double speed) part of the Märklin/Motorola protocol is only checked with an oscilloscope since I have no such accessories at all.

I have not done very much on the rest of the software. All I have at the moment is a very simple test program to verify that my kernel module works. But I hope I will get time to do something more substantial later on.


home : electronics : Train control system
Last edited June 25, 2013