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:

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.