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)
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)
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)