Train Wreck
Posts in Category: Arduino
  • Software Available

    I’ve added the software that I have been developing to the downloads page. The zip file contains a simple Arduino sketch to send a DCC signal to a booster, a very simple ‘booster tester’ that just flips the port connected to the booster every 5 seconds (basically a modified ‘blink’ sketch) so that you can measure the booster output with a multimeter, and a very early version of my MacDCC Command Station. (Read more)

  • MacDCC Command Station

    Over the last few weeks I have been building an Arduino and Mac based DCC command station and today it all successfully came together with the running of my first locomotive under DCC control!

    The Arduino software is quite simple, just receiving raw bytes from my Mac in a very simple format, which is then converted to DCC and sent out to a booster. The format is just a byte specifying how many further bytes are in the message, followed by the actual DCC bytes including checksum. After the required number of bytes have been received by the Arduino, the message is validated using the checksum, then replaces the oldest of the current two messages being sent. The Arduino software continuously sends out the last two commands that it receives so that no message is sent twice in a row. It is only a slight modification of the code mentioned in this post. (Read more)

  • Thinking About a Command Station

    In the discussion below to keep everything straight as to which code I am talking about:

    Communication from a PC (in my case a Mac) to the Arduino I’ll call a ‘command’.

    Communication from the Arduino to the booster I’ll call a ‘packet’.

    A message or message packet is a ‘command’ packet as distinguished from an idle packet.

    The overriding philosophy of my command station will be to keep the code in the Arduino as simple as possible and have most of the smarts in the software running on the Mac. With this in mind, probably the simplest possible command station for the Arduino would be code to accept a new command from a Mac (or PC) via the serial port, convert this command to a valid DCC packet, and then continuously send this packet to the booster. However, while this would probably work, it would be out of spec because the NMRA standard S 9.2 (line 116) says: (Read more)

  • Sending DCC With An Arduino

    In my last post I mentioned that I now have 2 Arduino controller boards for experimenting with creating my own DCC command station, booster and DCC decoder. However, one of the problems with developing your own software and hardware that works together is that when something doesn’t work it can be difficult to figure out just where the problem is.

    To help get around this I figured that it should be possible to simplify things by hooking two Arduinos directly together and send DCC commands from one to the other. This would at least ensure that the software was working before even having to think about the electronics.

    So that’s what I did, and it worked! (Read more)