Comments
Login to post a comment...
Model railroads use Digital Command Control (DCC) to control locomotives and accessories. Instead of 0-12v DC on the rails, DCC uses a digital packet stream. This circuit will let you write sketches on the Arduino to decode those packets and take actions based on what you decode.
|
A couple of resistors, an opto-isolator and a LED... The 6n137 optoisolator and the LED are configured so that both phases of the DCC signal are used - one to drive the opto and one to confirm that there is a DCC signal present. The 1K resistor keeps the magic smoke inside the LED, and the 10K acts as a pullup for the output signal. Connect the 2-pin terminal block to your track and pin6 of the opto to the Arduino's D8 pin, which is also the Input Compare interrupt pin. The SourceForge Embedded Loconet project has example code that can be adapted to read and decode this signal (my next project...) |
FilesFritzing Files |
azend # Nov. 1, 2010, 8:24 a.m.
How does the arduino itself get power? I don't see a direct line from the track power to the voltage regulator?toholio # Nov. 15, 2010, 11:39 p.m.
It doesn't get power from the track. I think this project is intended as a self powered stationary decoder. The PCB layout is for a full sized shield which would make it too big for anything smaller than G scale stuff. It wouldn't be hard to make it track powered though.gharryh # Nov. 26, 2010, 12:25 p.m.
Is there a sketch available for this?robli67 # Feb. 24, 2011, 2:57 p.m.
This sounds very cool. I would like to see the sketch as well. Plus anymore info on the project and how it worked.bradm # April 8, 2011, 11:52 p.m.
The 6n137 works perfectly. I have this working with the NMRA DCC code created by Alex Shepherd. I left the pull up resistor out since the pin can be set to high without interfering with the interrupt.chrismalyon # Oct. 12, 2011, 2:30 a.m.
Can you post a link to Alex Shepherd's code?