L i n  T r a i n

Model Railway Digital Command Control for Linux







What is LinTrain ?

LinTrain is a DIY model railway control system based around a PC running Linux. The code is distributed under the terms of the GNU General Public License. There is also some hardware involved. Schematics and PCB layouts are available for download, but we don't sell the boards.

There is now a rather primitive GUI within LinTrain. This owes quite a lot to Brian Ward's tktrain. That was written in TCL and used a command station interface, for which LinTrain includes a replacement. The "native" LinTrain GUI is written in Python, using a set of Python bindings to present the core LinTrain functions as a Python module.

Who is LinTrain ?

Currently, it is being developed by Rob Pearce <lintrain@bdt-home.demon.co.uk>.

Patches, bug-fixes, ideas and code contributions are, of course, welcome.

What Platforms are Supported ?

Linux, like it says. There is some evidence remaining of a past life in which MS-DOS was mentioned....

The main bulk of LinTrain compiles on Linux for i386, using gcc. It includes a kernel device driver module to do the low level DCC stuff, so I suspect porting it to anything else would be a significant task. At the moment this driver is compatible with 2.2 and 2.4 series kernels, and is being ported to kernel 2.6 now.

There is also some code for the PIC micros used on the various bits of hardware. This can be compiled with Microchip MPASM or the GNU GPASM.

Hardware design has been done in a mixture of SeeTrax Ranger for the earlier parts and Eagle more recently.

Downloading LinTrain

The LinTrain source tree is currently located at SourceForge.

The least ancient release version was on May 22, 2005 : v0.3

Work continues in CVS. If you have CVS capability, the following will get you the latest sources.

cvs -d:pserver:anonymous@lintrain.cvs.sourceforge.net:/cvsroot/lintrain login

The password is empty and pressing [ENTER] will get you in.

The following command will checkout all of the sources and place them in a lintrain subdirectory.

cvs -z3 -d:pserver:anonymous@lintrain.cvs.sourceforge.net:/cvsroot/lintrain co lintrain

You can browse our CVS tree here.

SourceForge has further documentation on accessing a CVS tree here.

Recent NEWS

July 12, 2009 -- update

After a very long hiatus I've started doing a bit more. I was rather busy with other stuff when the PC I was running the railway with expired. Since the rest of my boxes were all on unsupported kernels, I couldn't do much until I had time to sort the driver. That has now been done in CVS (though not much tested yet).
In the mean time, the Python GUI has been enhanced to include an attempt at a layout control panel. Layouts can be loaded from XTrackCAD files, though as yet some of the information required is not available.

May 22, 2005 -- Another baseline tarball - v0.3

With some further work on the GUI, the joystick port throttles, and the accessory decoders, I felt it was time for another "release".

December 21, 2004 -- update on work

The track zone occupancy detector schematics have now been updated, and also ported into Eagle.
The line-of-sight optical detector also had a PCB error (using an input-only pin on the PIC as an output). This has been fixed.
There has been quite a lot of work done on Python language bindings and a TkInter based GUI. It's almost useful now! There's also the beginnings of a decoder programmer application.
Two new bits of hardware have been added, both accessory decoders. One is a cheap four channel low current device suitable for LEDs or lights. The other is a capacitor discharge turnout motor unit. Both designs incorporate some surface mount components so good eyesight is needed.

February 22, 2004 -- update on work

The track zone occupancy detector required a few (fairly small) circuit changes but is now working. Unfortunately the schematics have not yet been updated. Meanwhile I have created a line-of-sight optical detector. Like the zone detector this talks to the PC over a wired-or serial bus, which I am calling the LinTrain Status Bus. The hardware is based on the ISO9141 / LIN automotive standards, though the protocol has a collision detection scheme closer to CAN.

August 30, 2003 -- update on work

There hasn't been much progress on the JNI wrapper, but I have added the work I've done so far on a track zone occupancy detector. I finally got the first prototype PCB this week, so I'm about to start testing it.

January 25, 2003 -- update on work

If you check the CVS repository you'll see I've not been entirely inactive. The interface to "tktrain" is now a little better, some of the compiler warnings have been eliminated, etc. I've also started looking at doing a JNI wrapper to integrate LinTrain into the JMRI project.

October 26, 2002 -- CVS updates

Some minor compiler warnings fixed

June 29, 2002 -- CVS updates

A problem in the kernel module has been fixed, which means it now compiles and works on 2.4.x series kernels (at least 2.4.2 anyway). This is only in CVS as yet.

April 21, 2002 -- v0.2 Released

Although not much changed from V0.1 this release has some bugs fixed. In particular, the following changes have been made :

  • The build process now works out-of-the-box. Previously an important header file was not built first time through. Also the "mtd" application is now built as part of "all".
  • A file buffering bug has been fixed in mtd, which now means the tktrain cabs remain up to date. There's also some added information produced, but this is not used by the standard tktrain system.
  • The tktrain "status" and "accessory" protocols are now supported by mtd.

March 31, 2002 -- v0.1 Released

This is the first public release, and should be regarded as "Alpha test" software. In practice, I've been fiddling with this for a while, so the bulk of the low level stuff is fairly stable. In particular :

  • The hardware is fundamentally sound (as long as it's built right!).
  • The PIC code is fully working
  • The Kernel module has been tested on both 2.2.5 and 2.2.19 and I believe it to be free of serious bugs. It should compile (and work) on any 2.x series kernel but there are no guarantees.
  • The user space applications are all test code at the moment

Support for LinTrain

LinTrain comes with some limited documentation. When that isn't enough, you can find help in the following places:

This Site Hosted by


Last updated: May 24th 2005