Mittwoch, 16. Januar 2013

Arduino drives digital locomotives (Maerklin Motorola II)

After trying to write my own interrupt timer service sketch for generating Maerklin Motorola (II) protocol for my model railroad I found a message from a guy who had done this already: (sorry, german only). We changed some email an I tried to get his sketch running. After some (self made) trouble it works fine for me. The code was working but it was not very good organized. So I asked him to make a Sourceforge project of Maerklino (now it is called Ardurail to avoid traddemark problems) and began to rewrite.

And here it is:

Until now we haven't released any files but you can check out the (hopefully) working development version from SVN. The last changes I made were to put the whole code into a class so that it later can be distributed as a simple library. Also I added some functions for better control of the devices.

The next step will be (after testing the actual code): Writing a derived class which implements the P50 protocol (currently it is a method inside the class) and than a derived class for SRCP (see


  1. Hey Codeman, that's great news. I'm looking forward to setting up a Maerklin site myself and think it must be great fun to control the trains from e.g. your smartphone :) Hope I'll have time for it soon. But music comes first!

  2. ... so much to do, so little time... (that's a good title for the next song!)

    Current state: you can address locos but function1..4 seem not to work. Also I haven#t tried if turnout switching will work...

  3. Hallo,

    Where can I find the arduino sketch?
    Is there an arduino sketch for a lok decoder and a switch (wecksel) decoder?