DCC Programmer for Decoders


Peter Reynolds

Pictures by the author With grateful thanks to Matt Pulzer of Practical Electronics for permitting reuse of their material. Thanks also to Nicholas Vine of Silicon Chip magazine, for permission to use their circuit diagram artwork.

Practical Electronics - October 2019 cover

The inspiration regarding the construction of this compact unit was actually an impulse buy of a reincarnation of a magazine that I had fond memories of from my youth. I used to drive my mother to distraction with my accumulation of electronics magazines as it was a more commonplace and widespread hobby than it seems to be today. Almost everything was analogue, and if you wanted digital, you bought 74 series TTL logic integrated circuits. Personal computing was virtually unheard of, and I remember the huge occasion when the school science department were presented with two Apple II desktop computers.

Since I became involved in railway modelling, I have not forgotten my old hobby, and indeed my old employment, as I worked, initially in electronic manufacturing, then computer engineering, back in the days when you didn’t throw items away, but used a soldering iron to fix them, even at customer premises. I have always kept an eye out for articles in magazines and now on the internet, for items that relate to railway modelling, whether I am going to use them, or not.

I spotted an article in the October 2019 issue of Practical Electronics, so I bought the magazine. I wasn’t really into DCC at the time, but it was railway-related so that was that. Fast forward two years, and I now have two DCC control station set-ups, one using a Digikejis DR5000 (compatible with virtually everything else), and the other using a Pi-Sprog. I also have four DCC-equipped locomotives, with two more under construction, and one old one also to be equipped. By all accounts, it is getting serious, so when I found the magazine again, I thought the project would be useful for me and possibly appeal to a wider audience.


The unit is designed to be a standalone programmer, although it is possible for it to act as a command station for testing purposes only, as the current capacity is only about 200mA. It appealed to me particularly, as most O scale DCC setups tend to be fixed in location, and this connects directly to, and is powered from, a USB port. It is eminently suitable for a workbench.

The heart of the unit is an Arduino microcontroller PCB to which is attached a custom shield that comprises the interface. If you are unfamiliar with Arduino, they are an open-source group that provides various microcontrollers, software, and a community that works with programming in either C or C++. If I have just caused you to recoil in horror at the prospect of programming from scratch in those languages, please rest easy; all the hard work of programming is done for you.

This particular project recommends using an Arduino Uno microcontroller board, which can be obtained for about £11 if you shop around. It is also compatible with the Arduino Mega 2560 board (about £35), but the higher specification board is not necessary – I had one lying around at home for experimentation. Assuming that you have a laptop, the only other essential item that you will need is a USB 2.0 to USB-B cable, if the microcontroller board you buy doesn’t come with one. The programming environment works with Windows, Linux and Mac OS X.

As I mentioned above, the interface component of the unit is assembled as a ‘shield’. That is the name given to what are essentially conversion units for the Arduino microcontroller that allow it to perform a useful function. They are available for prototyping, where you can make up a project to perform a particular function, or come ready-made, so all you have to do is connect the two together. For the purposes of this project, you will need to buy the printed circuit board (PCB) from Practical Electronics (£9.95), and also buy the components to assemble the shield yourself, but it is relatively easy to do. There is no intricate soldering involved – if I hadn’t been making a video of my efforts, it would have taken under 30 minutes to assemble.

Arduino Mega 2560 board

Programme circuit diagram. Originally published in Silicon Chip magazine. October 2018, page 39

I won’t go into excessive detail on how it works, suffice it to say that there are two methods of powering the unit to get the required DCC track voltage (12-13V recommended); either using an MT3608 DC Boost Converter Module (USB powered) or an external power supply plugged into the microcontroller PCB. There is a jumper on the shield to allow you to change this as you require. The DCC signal is derived from a dual timer, the 556, which has been around for very long time and is capable of providing a 500kHz signal at 200mA. The board derives feedback by using a current-sense resistor, although the actual DCC signals with correct timing are derived from the Arduino and converted to the required voltage by the 556. If you would like to see in more detail how the unit actually works, I would advise you to buy the back issue as a PDF from https://www.electron publishing.com/cproduct/october-2019-back-issue/ (£4.50) which will also give you complete assembly and programming instructions. The particular article is six pages long, with an extra two explaining how DCC data works.

Arduinio Uno

Completed shield

As well as the jumper that allows the user to alter the way the DCC power is derived, there are a number of other jumpers that allow alteration of the I/O pins on the Arduino board. This is useful as it is possible to build the board so additional shields can be stacked on top of this particular one. There may be a conflict in the allocation of I/O pins between boards although the program uses certain pins, which would also have to be changed within the program.

USB B lead

Apart from the MT3608, which comes pre-assembled, there are no component acquisition issues with regards construction. Everything is readily available from the usual suppliers. Components I didn’t have in stock already I bought from Rapid Electronics, and from Amazon. To keep the cost of building to an absolute minimum, I would recommend shopping around for components. For example, you only need one of most of the resistor types, whereas Rapid only supply in multiples of five for the 1W resistors, and 100 for the 0.4/0.6W types. I managed to get the MT3608 from Amazon, but they were sold in multiples of 6 (for £3.99); I could conceivably use the remainder for other things, though. As I mentioned earlier, construction is not particularly difficult. The PCB is supplied screen- printed, and it is merely a question of fitting components of the required value in the matching location on the board. The only items of real note are to ensure that devices that require a particular orientation are mounted correctly. It is important to check the resistor values, as the markings are all very similar, and also the orientation of the electrolytic capacitor, the diode, the 556, and the MT3608 if used. I can’t stress too much the requirement to check your work as you go along, solder joints especially, and if you use the MT3608, you need to leave the 556 off while you set the output voltage.

Provided construction has been carried out correctly, and you have mounted the shield on the Arduino board, you can tell if it woks by viewing the LEDs on the Arduino board. There are a green (power) and yellow (‘L’) LED that should be lit. If they don’t light, remove the shield, and try again; if they light with the shield removed, check your assembly of the shield.

To get your built assembly to function, Practical Electronics have done the work for you, and provide two programs free to make the unit operate. If you navigate to https://www.electronpublishing.com/product/1019- download-zip-oct-2019/ you find all the files pertinent to all the projects on the October issue. They download as a .ZIP file, and it is necessary to extract the files you need for this particular project. These are contained in a directory called ‘EPE DCC Decoder Programmer’, and there are two programs and an Arduino library as contents. Arduino programs are called sketches, and you will need to download the IDE (Integrated Development Environment) from the Arduino website (https://www.arduino.cc/ en/software) to allow programming. If you view the second part of the Guild Extra video I show you how to do what is necessary. It is far easier for me, and for you, to do this visually rather than writing a step-by-step description in print. The two sketches provide different functions. The first is a rather basic direct programming mode, which I couldn’t get to work; remember, it is designed with 4mm scale models in mind. The second sketch is an open- source DCC++ emulation, which allows the unit to be used with JMRI DecoderPro, and this, after some minor sketch timing adjustments, worked very satisfactorily with my sound-fitted K1 2-6-0 (Zimo MX645R). The sketch parameter that was adjusted to get it to work, could do with some more minor fine tuning to increase reliability, but it did allow me to read, set and change, DCC parameters. With further investigation, it could well be possible to increase the limited current capability of the unit also, and I will explore this when I have a quiet period at work.

Shield and Uno
Well, was it worth it, in the end? I think it was worth it, and I will definitely use the unit to create a roster of my locomotives using DecoderPro from now on. It is very small, and I don’t need to set-up a huge number of items, just connect it to a length of track and my laptop and I’m in business.

Parts List

Again, if you shop around, it should be possible to buy the resistors in the required quantity, although the unit price may be significantly higher.

For a more detailed feature on construction and programming, please view the associated ‘Guild Extra’ video, where I have tried to illustrate the magazine text, and provide a ‘how to’ guide with regards programming. The video is available at the following URL https://youtu.be/Zl5-LDH1fZE or via the ‘Guild Extra’ tab on the Gauge O Guild website.

Size comparison for complete unit