This Arduino sketch ‘captures’ the DCC packets as they are transmitted by your Command Station and shows them in a readable format on your PC screen via the Arduino Serial Monitor.
Hardware: an Arduino Uno (or another type, as long as it runs the Uno code) and a small opto coupler circuit, the schematics of which can be found on the Software page. Total costs: around $4,-. Connect the opto output to pin 2 of the Arduino.
Software: the .ino sketch can be downloaded here. Unzip it and place the folder in the Sketches folder on your PC. No library is needed, just this one .ino file. Put the Arduino Serial Monitor on 38400 baudrate and enjoy the DCC commands passing by on your PC screen.
Most DCC packets are recognized, with the exception of the Decoder Control and Consist commands, which is work in progress.
Some examples of DCC packet readout:
Loc 1902 Forw 21 = loc 1902 speedstep 21 driving forward
Loc 4 Rev 14 = loc 4 speedstep 14 driving backwards
Loc 4 L F4-F1 0 = loc 4 lights off, F4 off, F3 off, F2 off, F1 off
Loc 4 L F4-F1 11 = loc 4 lights off, F4 off, F3 off, F2 on, F1 on (leading zero’s are not shown)
Loc 4 L F4-F1 10001 = loc 4 lights on, F4 off, F3 off, F2 off, F1 on
Loc 4 F8-F5 1010 = loc 4 F8 on, F7 off, F6 on, F5 off
Loc 4 CV 4 Write 3 = loc 4 write value 3 into CV4
Acc 4 1:3 1 On = Accessory 4 (= module 1 port 3) On, pulse = 1
Acc 5 2:0 0 On = Accessory 5 (= module 2 port 0) On, pulse = 0 (a module has 4 ports)
Edit October 25, 2015: A new version is available via the download link above. This version has the ability to send configuration commands via the keyboard, to change the buffer size, change the refresh time and to toggle on/off the display of locomotive or accessory packets. The keyboard commands that are available are:
1 = 1s refresh time
2 = 2s
3 = 4s (default)
4 = 8s
5 = 16s
6 = 4 DCC packet buffer size
7 = 8
8 = 16
9 = 32 (default)
0 = 64
a = accessory packets display on / off toggle
l = locomotive packets display on / off toggle