here some links to info about digitally controlled model railroads and some electronics/software:

...there is more info on the GERMAN version of this page! example for analog wiring

DCC and Arduino

what is DCC?

Android Software to control SRCP servers, for example DDW or MBS1/2/3


A newer development with a DIY hardware based on the CAN-bus is "CBUS", made by the (mostly) UK group MERG (Model Electronic Railway Group), see more here: MERG - CUBUS - Layout Control System.

listening to the CBUS with an Arduino


... is relatively simple system, developed in the 1980 bei the german company "Trix" (now part of Maerklin).

more about Selectrix® ...

Selectrix and Arduino

SX3 PC Software

first O-scale RFID experiences

.... more to come .....

Android SRCP Client [inactive]

This software was developed for Android 1.6 and is no longer supported, sorry!

this page is only kept for reference

Here is an Android™ software which enables your phone to run a locomotive via a SRCP protocol server, see screenshot on the right ->:

The software was tested mainly with the Digitalzentrale MBS1/2 (Jörg Seitz and Rainer Barnstorf) see - but also works (only with long DCC addresses!) with DDW, DDL and with my "SX3" software for Selectrix.

SRCP client is OpenSource software, apk as well as source code can be downloaded from

the software Manual (English version) v.0.9

Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions.

DCC and Arduino

For quite a few (~40) years besides model railroading I also have an interest in electronics.

I'm more and more fascinated by the possibilities of the microcontrollers, whose programming gets simpler and simpler. With a few lines of codes you can convince an "Arduino" Board to do something useful.

And a model railroader seeks for some model railroad application, of course. What about a simple trottle to control a train .....?

Here is the hardware, a Arduino Duemilanove with 4 key (functions F0 ...F3), a variable resistor (speed) and a switch for direction:

In a first project, the throttle is sending ASCII data (for ease of understanding/debugging) via USB (serial Port) to the PC, the PC sends command to the Lenz central station (via LI101F interface).

In a second step, I added some software to the Arduino to let the Arduino generate the DCC signal itself - a PC and a Lenz system is no longer needed to control the train, see SimpleDCC

SimpleDCC - a command station (?)

In the meantime I added a little power amplifier with an LMD18200 (Bridge), and wrote some lines of code for a very simple software (and easy to understand, I hope) to realize a "one loco" command station.

here is the additional hardware (electrolyte capacitor at pin6: 10 to 100uF, C1, C2: ceramic capacitors - please check that your arduino accepts your input voltage of 12...15V, or use USB power supply for the arduino!)

and her the software (limitations: only 1 loco, only speed and direction controlled - "switching the function off and on is left as an exercise for the reader ...").

To generate the DCC signal timer2 is used and a simple state machine (1. preamble, 2. separation pulse, 3. send a byte) - a special thank here to Wolfgang Kufer and the "openDCC" programs , which are not explicitely used here, but which were very helpful in understanding DCC.

Your browser cannot display the text - please send me a mail, I will then sentyou the program.

For the "advanced readers": There is a general Arduino DCC library available at model railroading with arduino - this can be used for more useful programs. However, the source code of the library is pretty complex.


a remark:

In the meantime I also tested the readers (also 125kHz) ID-12 und ID-20 , these readers are also used by MERG - and got much better results!! More to come on this page!

I want to give a short report about my very first tests with cheap RFID readers in O-scale.

The RFID Readers...

were just put under the rails. A quick and fast test with an RFID tag was successful!

The Detection circuit...

consists of an Arduino with a (serial) 2-line display. The readers have a serial (5 Volt) output as well which is easily connected to the arduino. There are already some example programs to find in the web. (I use two readers to also be able to detect the direction of the movings locos and cars.)

The cars

... get an RFID tag glued under the trucks - and NOW, IT MUST WORK, I thought.

However, the result...

... was pretty much depending on the speed of the train. The RFID reader is so big, that it doesn't fit between the rails (max. 28 mm in O-gauge) and the resulting distance between reader and tag is about 10mm, which works in principle. But in this setup I could only detect slowly moving locos and cars...

Whats next?

I still haven't given up on the idea of using RFID for detection. Yes, I know, there is RailCom® now available for detection of locos - but I would prefer to also detect the cars! I will make some more test with smaller RFID detectors (to be able to put them between the rails) and with different RFID tags...


Railcom is a registered trademark of Lenz GmbH.

SX3 - PC Software

The Selectrix digital system:
Selectrix™ is a relatively simple system (at least in its original version). There are 112 addresses (also called "channels") with 8 bit data each. These channels are transmitted regularly on the track signal as well as on the "SX bus" (a simple 0/5V bus with clock, data-out and data-in). Each of the addresses can be used for either loco control or turnout or signal control and also for track occupancy detectors. THATS ALL!

The complete state of the system can be displayed easily on the PC screen and there are already some "SX monitors" (mostly freeware) available.

The SX3 program:
Similiar to other programs there is an „SX Monitor“ where you can see the state/data of ALL selectrix channels - all channels with data <>0 are marked yellow - or orange when the data have changed during the last second. (this windows is enabled only in simulation mode or with the Rautenhaus SLX825). In the "SX mode" of displaying the 8 bit data is always shown with the lowest bit (bit 1) first.

In addition to the monitor with „SX3“ you can open more windows to control locos and also turnouts, signals and other accessories.
with another window you can display the state of sensors (note: the address range is 0 to 111 for ALL windows, therefor you can simulate sensors by opening a turnout window on the same address and activate some bits.) This is the "main" window, which handles the connection to the interface, switching on and off the track power and which allows for opening the other windows.

Currently, only the Interfaces from Trix the Rautenhaus SLX825 are supported, the baudrate is fixed to 9600Baud.
There is also a simulation mode , during which the SX data are only saved internally. This allows for testing other SW and useful also when no SX interface is present.
The SRCP server is still in development, it supports locos, turnouts, signals and sensors at the moment ( a note to addressing turnouts, signals and sensors: the SRCP address is built by concatenating SX-address and SX-bit, for example turnout address 883 is SX-Adress 88, bit 3 ).
The SRCP server is working quite error tolerant to be able to be connected from a range of different client software (for example my Android SW) - it does not care what busnumber you select and what "format" you select for and loco and how many speedsteps are used (because SX always uses 31 speed steps). You have to define a list of sensors (in the settings) to make automatic reporting of sensor changes work.

download and installation of SX3 program

Trix and Selectrix are Trademarks of Firma Märklin, Java is a Trademark of Sun/Oracle.

SX3 RaspberryPI

You can run the SX3 program also on a RaspberryPI, here are the requirements:

1. you have installed JAVA, see
Raspberry PI - Oracle JDK in the latest Raspian images, JAVA seems to be installed already.

2. you have installed rxtx-lib:

sudo apt-get install librxtx-java

more about rxtx-setup in Ubuntu

3. you are using an USB-to-serial adapter, the built in serial port on the expansion port is not detected by rxtx-lib. (the reason seems to be unexpected name of the device - when you create a symbolic link to a "well known name":

sudo ln -s /dev/ttyAMA0 /dev/ttyS0

then this device with the new name /dev/ttyS0 is detected by rxtx-lib and can be used.)

4. please add the rxtx-lib path when startings sx3:

cd /home/pi/sx3/dist
java -Djava.library.path=/usr/lib/jni -jar SX3.jar


Selectrix (SX) Arduino

With the help of an Arduino it is not too difficult to decode the Selectrix signal.

The interface can be very simple:

The sx clock signal (pin 1 of the SX DIN plug - also called "T0") triggers the interrupt INT0 of the arduino (pin D2), the data signal (called "T1" is sampled with another input (I'm using pin D4). Be careful, on pin 3 of the SX bus there are 20Volts, which is a pretty high voltage for any microcontroller...

this is the first PC board...
To reduce the overall size, I did not make an Arduino "shield" but instead integrated the ArduinoProMini on the board (the ArduinoProMini already has a 5V regulator and a quartz etc on its small SMD board).

I moved the C-code for decoding into a library with the name "SX", an example program (this is "Arduino style") shows how to use it. I tried to keep the code very simple.

Download Arduino Library "Selectrix" v.2.1 (GPL) . This version runs on all Arduino (and reading the SX Bus works fine), however, the writing on the bus seems to be not fast enough for some central stations. Therefore there is now a new version (thanks to Reinhard Thamm) where all the DigitalWrites are replaced by direkt port commands. Please check your arduino ports if you NOT using an ATmega328 based arduino.

Arduino Library incl. write - fast version 2.2 (GPL)

Selectrix is a registered trademark of Maerklin GmbH, Goeppingen, Germany.


Another digital system for model railroads was is called Selectrix®, shortened "SX". It is no longer actively developed by Trix®, but there are number of users and also several smaller companies who continue to develop new components for this systems.

The SX system (standardized in NEM 680 and NEM 681) is pretty simple - and loco decoders were the smallest ones on the market and are used also in N- and Z-scale. It cover (in its original version) 112 adresses for locos and accessory decoders. Theres are lot of project around SX, for example Mr. Steinhart ( ) describes a servo turnout decoder with a material cost of only 2 Euro!

I'm currently experimenting with an Selectrix shield for the arduino...

more on the page "selectrix-arduino".

We are using SX on 2 layouts (one German and one with US-prototype) in our club ( ), therefor I wrote a Java program for "debugging".
more about the "SX3" program.



Trix und Selectrix are registered trademarks of the Märklin, Göppingen, Germany

Tinkerforge Motor Driver

There is a nice mikrocontroller kit system available, see . Just connect the bricks and begin to program your application! No need to have a soldering iron...

There are lots of sensors and also IO-boards (named "bricklets"(, however there was no bricklet which can control 4 tortoise turnout motors "out of the box".

I now made such a board, based on the IO4-bricklet with 2x LB1909MC as +/-12V drivers for the motors. Here is an image of the 35x35mm "IO4-12Volt" Bricklet:
The test setup with a master brick, an RS485 brick, the new "tinker-tortiose" bricklet and a turnout motor:

Schematics: (for the software the module is identical to the IO-4 Bricklet )

Using this bricklet with JAVA
If you connect to a RaspberryPI (and with "raspian"OS ), you must first

To control tinkerforge modules via "Lanbahn" UDP Multicast pakets, I have written some small java programs which you find on: sourceforge - project Lanbahn, directory tinker

"work in progress": a compact 4-channel "train-on-track-indicator" (with galvanic isolation via optocouplers) ein kompakter 4-Kanal Belegtmelder (mit galvanischer Trennung über Optokoppler) for the Tinkerforge System. The blue connector is for ISP programming of an ATtiny84.


The Software is hosted at github: - in addition there is now a new website with info about this concept, see:

Digitally controlled model railroads are getting more complex and are still pretty expensive (if you use turnout, signal control and complete locodetection). The reason is the use of highly specialized hardware and software (and overall the model railroad industry is pretty small, numbers are low). The prices are as high as 140 Euros for a single LAN interface! You get half a netbook or 4 RaspberryPi's for this money. So why don't we use more standard components to control our model railroads?

Most control systems and protocols were developed in the the 80-s, to run on the 1980s microcontrollers. But the performance of the components has made a lot of progress in the meantime, however, the protocols have only become more complex.

It's time to simplify MRR control again!

The idea is to develop a new type of MRR control, which uses standard components and has more intelligence moved from a "central station" (which is now longer needed) to the accessory decoders and smart phone controllers.

Anyone is invited to contribute - just send me an email that we can get into contact.

The "Lanbahn" Concept:
- Intelligent end devices
- all with a network or wlan interface
- No central station, no PC needed
- no complex binary protocols
- decoders advertise their capabilities via zeroconf/avahi/bonjour protocol.
- everyone can build a decoder based on a raspberryPI or an (ethernet-) arduino