Digital Command Control (DCC) AVR Project

This is an on going research and experiment project.  The end goal was to design a simple Digital Command and Control (DCC) interface for the computer that provided both power and signal.  The DCC controller also needed to be scalable and bi-directional.  I also put together a simple bi-directional LOCO interface. I used Atmel AVRs for both circuits.  I have a front end on the PC that was written in C#.  The computer passes simple commands over RS232 serial to the ATMEGA8515L on the controller.   I am going to share that project with you here.  Feel free to use any ideas from this page for your own use.  If you wish to incorporate any of my design into a commercial product please contact me first.

I don't claim to be an expert at any of this and the drawings might be crude, but this is not a finish product. I wanted to share my schematics and C code with others to help their development as I went.

The general idea of DCC is send an square wave on the tracks to your train.  By changing the pulse width of the square wave you can create 1's and 0's. Binary. Once you have binary sending information is trivial.

I have captured a few waveforms on the oscilloscope for reference. Due to probes and other issues the voltage measurements on my oscope are not accurate in these images. Sorry.

500uS/Div  The voltage measurements shown are not accurate.  Should be around 12 to 15v peaks. 

This is a DCC sample captured on my oscilloscope. The first is the trailing portion of a DCC message.  Below is a full pulse train and a zoom of 1 and 0.
A full pulse train is shown between the long Zero Volt times. Those are the listening times.

50uS/Div.  The first full Pulse (negative then positive) is a zero.  The Second set the smaller pulse width is an one.

My controller

On the locomotive (or any accessory you wish to control) end of the system you need to rectify the square wave to get DC power for the electronics and the motor.  Detect the binary, decode the message and control the outputs (motors, lights, etc.)

My decoder

The bi-directional part of the system is a bit vague but this is my take on it.  After the controller sends a command, the controller removes power from the track and listens for a brief period.  The locomotive using stored power (good dual layer capacitor) transmits a short series of pulses to acknowledge commands or return information.  My detector schematics are not 100% NMRA compliant in this matter.  The standards dictate the track should be shorted at listening time, a simple transistor and resistor off the PIN4 will do this but then you need a current detector on that resistor/transistor to detect the return. 


A full DCC command with the bi-directional response.


A close up of the bi-directional response.