SMA10 – Build a 17-Function DCC Decoder for about $5

My activities in Scale Model Animation often lead me to use DCC as a control method for sequencing. This could include building and street lights, even sparking welders and twinkling camp fires. Timing can be done with JMRI scripts (Like this: http://youtu.be/RXpvp5mIXvU?list=PL4dHfZjHc9t-pvctGQzSuOXBLG1M42xbS) or with programmatic control (Like this: http://youtu.be/zlcdJKXj_YI?list=PL4dHfZjHc9t-pvctGQzSuOXBLG1M42xbS). Control switches for such projects are a must. Using 4 or 6 function DCC decoders in this regard, can get costly, quickly. But with a little effort, and some low cost components one can build a DCC decoder supporting 17 independent functions for about $5.00, or less, depending what you have on hand. This version has no CV’s, uses no DCC programming, can be set for any short address in CV1, and controls 17 Function Lines (which I am using to drive the green LEDs in the example below). Interested? Read on! (Latest Rev for this work can be found here: http://model-railroad-hobbyist.com/node/19446 )
>> Posts index
Navigation
Journals/Blogs
Recent Blog posts:
Comments
@Nicolas G
Hi Nicolas,
You can find the details to Mike's project here:
http://model-railroad-hobbyist.com/node/20906
That's a RRampMeter permanently installed on the board. Really good job, don't you think?
Best Regards,
Geoff Bunza
Geoff Bunza's Blog Index https://model-railroad-hobbyist.com/node/42392
More Scale Model Animation videos at https://www.youtube.com/user/DrGeoffB
Home Page: https://www.scalemodelanimation.com/
Location of Capacitor C8 on SMA 10 Schematic
Hi Geoff, I'm debugging my Arduino implementation and I noticed that in the picture of your construction that C8 seems to be across pins 5 and 8 of the opto-isolator. This makes sense as a de-coupling cap. However the schematic seems to show C8 across pins 2 and 3, i.e. on the DCC input side. Which is correct?
Apologies if this was previously answered; I tried to read the threads thoroughly.
Thanks,
Brian Forbes
Hi Brian,C8 is the 270
Hi Brian,
C8 is the 270 picofarad high frequency filter cap to reduce noise spikes to the photo-diode of the 6N137, and I strongly recommend you make sure it's there. C8 goes from pin 2 to 3. There are other published circuits on the web that do not have this or place a filter after the 6N137 both of which I found to be ineffective.
The mustard colored cap from pin 5 to 8 on the 6N137 is likely C4 a .1 microfarad cap or even an extra cap I soldered there when I was experimenting. Also note that C5 should be a 220uf cap not another .1 uf cap.
These are pictures of the first decoder I built so it is a bit (and only a bit
) more messy than usual!
'Hope this helps. Ask more questions as needed. Have fun!
Best Regards,
Geoff Bunza
Geoff Bunza's Blog Index https://model-railroad-hobbyist.com/node/42392
More Scale Model Animation videos at https://www.youtube.com/user/DrGeoffB
Home Page: https://www.scalemodelanimation.com/
Capacitor Clarification
Thank you sir!
Brian
great post
Hello!
a post very interesting to know better the DCC, I built one as a test and runs perfectly on an arduino UNO but fails to an arduino mini pro.
The code compile and load without problem to mini, but can't detect any activity in the pin2 (that went to the 6N37 opto out pin6).
The arduino IDE tested wit versions 1.6.0 and 1.6.2, always run in UNO, but don't work in mini.
must necessarily operate in a mini equal as an UNO? (I think that it is) some difference between boards?
Thanks!
@fransobre
Hi fransobre,
All my examples use the Pro Mini. All decoders should work exactly the same Uno's & Pro Minis and many other Arduino versions too!
Most likely you have some wiring error or bad component on your second unit. Slowly go over every connection for correct connectivity. If you can't find the problem, try wiring the output of the good 6N137 to the Pro Mini & see if that works. Remember to change the "board type" in the Arduino IDE when switching between the 2 Arduino's types. Have fun!
Beat regards,
Geoff Bunza
Geoff Bunza's Blog Index https://model-railroad-hobbyist.com/node/42392
More Scale Model Animation videos at https://www.youtube.com/user/DrGeoffB
Home Page: https://www.scalemodelanimation.com/
Hello Geoff, Thank you for
Hello Geoff,
Thank you for your rapid response. Something must be bad in the arduino mini.
Even I have changed the interruption pin (3 instead to 2 with the modifications in the code) and come to work perfectly in the Uno, but fails again in the mini.
I think that the board (the mini) has got damaged. I will try with another mini. For the project, small size is extremely important. Things of the N scale!
Thanks,
Fran, in Spain
Use on garden rail DCC
Hi Geoff,
Fantastic series - really has me salivating with the possibilities
Wondering if the track input side is robust enough for use on our 24volt garden rail DCC system?
Looking at the 6N137 data sheet, the emitter diode may be too fragile for the voltages on our track, or am I completely misunderstanding the data
Keep up the GREAT work Geoff, and thanks in advance for any advice you feel able to give.
Martin
Re: Use on garden rail DCC
Hi Martin,
I'm happy to hear you are enjoying this.
I just went through the specification sheets for all the components used regarding 24 Volt DCC levels. The two components you need to pay the most attention to are the capacitors C8 (270pf) and C3 (.1 uf). These need to have voltage ratings of 50 Volts. Some would recommend 35V but caps have a bad history when the voltage rating was close to the operating voltage. Price differences should not be large. In prior comments I mentioned changing the 1N4152 (D3) to a 1N4148. This is an even better idea here. D3 protects the 6N137, and the 1K resistor (R18) is still in range for proper 6N137 operation. Whatever diode bridge you use (B1) should be rated for 50 Volts or higher.
Ignoring the connections for the individual functions, this decoder can be built to be fairly compact relative to G scale equipment such that the decoder could easily fit inside a railcar. That's a thought I never entertained when I started building these!
Let us know where you take yours.
Have fun !
Best Regards,
Geoff
Geoff Bunza's Blog Index https://model-railroad-hobbyist.com/node/42392
More Scale Model Animation videos at https://www.youtube.com/user/DrGeoffB
Home Page: https://www.scalemodelanimation.com/
Thanks
Geoff,
Thanks for the prompt reply, and the extra info. That is great. I have an arduino pro mini on order and will sort through my spares for other parts. I intend making one of the servo versions, utilising a more robust 5V supply so that I can maybe operate crossing gates / barriers, signals etc. plus station / building lighting etc. etc. My imagination runs wild
The cost of this type of decoder, suitable for garden rail here in UK is fairly prohibitive if a lot of functions are required to be operated, as all decoders that I have seen do not have so many function outputs as this, necessitating the purchase of multiple decoders .
Thank you once again Geoff for an invaluable source of information and ideas.
Martin