back to my model railroad page Back to my model railroad page

A DIY NMRA compatible Accessory Decoder


I

n April 2003 I started the do-it-yourself project "DCC turnout decoder" and was able to show results in a relatively short time. The decoders have overcome their 'children diseases' and are running very well in my modular layout and of course in the layouts of many co-railroaders. The more I learned about accessory-, signal- and turnout-decoders, the more I realized that the flexibility of the decoder I made was not sufficient. The tight binding of the concept to 4 pairs of outputs, allowing only 8 different output states but specially the hard coded times and other variables of the decoder modes were just some of the limiting factors when applying a DCC-Decoder. Programming with a button did not make a professional impression and forced me to crawl under the layout to change a turnout decoder address. I suddenly preferred to have a decoder, which could be programmed like a multi function- or locomotive- decoder using CVs (Configuration Variables). This new decoder had to be compatible with the existing and new NMRA standards. Not only should it understand all standardized packets for accessory decoders, it had to be more communicative in that it supports programming in service mode and even programming in operations mode (sending CV write instructions over the normal tracks). These compliant accessory decoders are not very well represented in the European model railroad market. The programming capabilities of the most common accessory decoders were limited to dip switches and push buttons. The features I wanted were only available in more sophisticated vehicle decoders. Since then I spent many hours reading the NMRA recommended practices and standards to find out how these concepts could be implemented in a program for a relatively simple and cost effective controller like the ATMEL AT90S2313.

WDecN-90

NMRA-DCC-Logo


T

he first decoder was built on perforated card board. Later prototypes ran on printed circuit boards and were intensively tested for functionality and emc resistance. CVs can be read and written. The decoder accepts all DCC-packets and outputs the correct bit patterns. Those more sophisticated packets for broadcast, operations mode programming or extended packets which could not be generated by the IntelliBox (FW 3) using its keypad, can now be generated using the LocoNet commands (this requires version 1.5 of the IntelliBox Firmware). To do so, I have to code these packets using VB on my PC and send them serially to the IntelliBox. All tests have been concluded and the NMRA compatible accessory decoder can be considered a mature piece of electronics.

First Prototype of the NMRA compatible Accessory Decoder
the prototype of the NMRA compatible decoder


Software Features


Hardware Features


Final version of the decoder measures 70 x 55 mm
The final single sided printed circuit version of the decoder requires only one wire jumper and measures 70 x 55 mm


F

or those who want to build this NMRA-compatible decoder WDecN-90 for their private use I created user manual including the schematics which I designed around the AT90S2313 microcontroller.

Since the Atmel AT90S2313 is obsolete now, it must be replaced by the newer and better replacement ATTiny2313. This has the advantage that the voltage supervisor TL7705 is no longer needed. Pin 1 (negated reset) of the Atmel can now be directly connected to +5V. The 10 MHz crystal was adopted from the original AT90S2313 based concept. Thus the ATTiny is and stays a direct replacement for the older controller.

The controller firmware which was originally published below has been taken from the web because it was misused for commercial purposes. Therefore I will provide pre-programmed and protected controllers on request. Due to the AT90S2313 obsolescence I now ship ATTinys with the brown-out-protection activated and prepared to run with the external crystal oscillator.
During the software development (AVR assembler) the user manual served as a development specification. All the decoder properties are documented in this manual. Due to the extensive specifications the memory of the Atmel micro is almost completely filled (95%) with code. There is no more room left for bigger additions. The actual version of the firmware is 2.1.

Download of the user manual
User manual
WDecN-90 Decoder
325 kB
ask the author for preprogrammed ATMEL Micros
WDecN-90.hex
1kB
ask the author for preprogrammed ATMEL Micros
WDecN-90.eep
1kB

!This information is for non commercial private use only. The author does not accept responsibility for damage caused by the use of the circuitry and the information published on this web site!


Frequently Asked Questions

Q: I have some AT90S2313 (or ATTiny2313). Can these be used to run the WDecN-90 decoder?

A: Yes, just ask me. I can also program your AT90S2313 or ATTiny2313 to run the decoder firmware.

Q: What is the difference between the NMRA compatible decoder WDecN-90 and the self learning DCC Decoder WDecD-90 which is introduced elsewhere on this web? Both decoders are DCC based, are'nt they?.

A: The simple accessory decoder WDecD-90 just understands one DCC turnout command out of whole collection of NMRA DCC standardized instrucions. This simple decoder does not know about CVs and must be programmed with a push button. The NMRA compatible decoder understands several accessory instructions defined by the NMRA. It can be completely configured using CVs and can even be changed online.

Q: I am currently preparing a similar project. Could I consult your source code or parts of it?

A: No, the source code was never pusblished and I do not intend to make exceptions.

Q: Why was the hex-code removed from the web?

A: For three reasons: 1. I found it being used for commercial purposes, 2. It was repeatedly disassembled, 3. I got fed up answering questions about this disassembled hex-code.


Commercial Decoders

S

ince May 2005 a very similar decoder can be obtained as completely assembled and tested decoder. Prices are exceptionally low.

These complete decoders use a slightly different hardware concept and are based on the ATTiny2313. Instead of the external crystal clock generator the decoder uses the internal R-C clock generator of the ATTiny. The embedded brown out protection circuit of the Atmel is used instead of the external TL7705 voltage supervisor. The functionality of this so called WDecN-TN decoder is identical with the functionality of the WDecN-90 decoder from the DIY project.

Decoders can be ordered at Darisus GmbH or at the Darisus web shop.


© 2004-2008 Gerard Clemens last update 23/03/2008


Back
to my model railroad page

Valid HTML 4.0!