The cheapest DCC sniffer with board from Arduino Nano!

Have you ever need see data on your digital model railroad? Or do you only want see the packets of DCC? Now, it is possible with low price or for free!

During the making DCC command station (DCC command station for model trains controled via Android (iOS) application), I wanted see the DCC packets and signals.

At first I was using the logic analyzer from SALEAE, but it was really annoying, parsing the all DCC packets. I decided make own analyzer for the DCC commands with AVR microcontroller Atmega328. I used board from Arduino Nano, but it was programmed in AVR Studio.

The program is very simple. It is only parsing the all DCC data from rails and writting this data into console. You can see parsed address, type of DCC command, speed of train, direction of train, etc…

Data in console looks like here:

+-----+-----------------------------------------------------------------------+-------------+------+
|  #  |                                              DCC PACKET               | PACKET TYPE | ADDR |
+-----+-----------------------------------------------------------------------+-------------+------+
|  0  | 1111111111 11111111 0 00000000 0 11111111 1                           |    IDLE     |    0 |
|.....|.......................................................................|.............|......|
|  1  | 1111111111 11111111 0 00000000 0 11111111 1                           |    IDLE     |    0 |
|.....|.......................................................................|.............|......|
|  2  | 1111111111 00000011 0 00111111 0 10100111 0 10011011 1                |    TRAIN    |    3 |
|     | Direction: 1, Speed: 39                                               |             |      |
|.....|.......................................................................|.............|......|
|  3  | 1111111111 00000011 0 10000000 0 10000011 1                           | TRAIN_FUNC  |    3 |
|     | F0=0, F1=0, F2=0, F3=0, F4=0,                                         |             |      |
|.....|.......................................................................|.............|......|
|  4  | ERROR: DCC signal corrupted.                                          |             |      |
|.....|.......................................................................|.............|......|
|  5  | 11111111111 10000001 0 11111010 0 01111011 1                          |  ACCESSORY  |    1 |
|     | Switch: 2, State: 1                                                   |             |      |
|.....|.......................................................................|.............|......|

The DCC data are writting into console on PC (fig. 1).  But my friend is going to make program with graphical interface.

16402663_1239509922803893_4670285958642025133_o

Fig. 1: DCC packets in console PUTTY.

Now, the program can parse these commands:

  1. IDLE – not active packet, it is for making voltage in rails
  2. RESET – reset all DCC devices
  3. TRAIN – control train
  4. TRAIN_FUNC – train functions (lights, sounds, etc.)
  5. ACCESSORY – control accessories (lights, turnouts, etc.)
  6. ACCESSOR_EX – extended accessory packet
  7. PROGRAM – programming

 

How can you make it?

It is very simple. You need only Arduino Nano and write the HEX file (download on the ond of this article) into it. You will need ISP, ASP or similar programmer.

Then, you connect rectifier and resistor for the DCC signal, like on the picture 2.

DCC sniffer en

Fig. 2: Block schematic of the DCC sniffer.

At the end, we can put all into nice box. (like on the gallery on the ond of article)

After you make the hardware , you can connect device via micro USB from Arduino to USB at computer. You will see new virtual serial port COM on your computer. You can check it on your Device manager (right click to Computer icon -> Properties -> on the left top corner Device manager). Now you should see window like on the picture 3. You will need a number of COM port. You can find out it, when you unplug and plug board into USB port.

device_manager_en

Fig. 3: Device manager window.

The next step is launch terminal (some the console application). I am using PUTTY (http://www.putty.org/). After you launch the Putty, then you should set right COM port number and baud speed, which is 115 200. You can see the right settings of Putty on the picture 4. Then you click on Open. After that, you should see window like on the picture 2. It should resize the window for better display a table.

putty_settings

Fig. 4: Settings of Putty.

Use

You can change display of IDLE packets on the window by press button “i” on your keyboard.

Video

 

Gallery

Download

If it was helped for you or you want more similar articles, you can donate author by donation form on the right of this page. You can pay by PayPal or credit card. 

If you do not send money, you can donate by sharing this article on social networks or with your friends.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*