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
@Jmarben
Jmarben,
Did you see my comments just before your last post above?
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/
C5???
I cannot find c5 on the above drawing. Did I have another stroke?
@Michael D re: C5
Hi Michael,
C5 refers to the original schematic at the beginning of this blog entry (SMA10) repeated here:
In the revised schematic (due to external power supply used for many servo support-- see blog SMA12) shown a couple of entries back, C4, C5, D1, & D2 aas well as the regulator circuit were eliminated-- no longer appropriate. As said before C1 should be 220uf and C1, C2 should be physically placed as close as possible to the 6N137, C6,C7 should be physically placed as close as possible to the Pro Mini.
'Hope this makes things a bit clearer.
Best regards and Happy New Year,
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/
Hi Jeoff, Of course, I have
Hi Jeoff,
Of course, I have seen your comments. The schematic is the simplest one you have, with resistors, leds and servo pin conectors. I supply 5 volt with external power supply (an old cellular phone with usb conector and 0,5A).
I have bought 5 Arduino pro mini 5V, but I have tried them also with 3,3V and they run. I can programmed them without problems. Is it correct or they are really 3,3V models? It is very strange, don't you think?
I will try to find out the problem but if the cause is an overvoltage then I think the best is to built another board and power it with 3,3V.
I will post again as soon I have made some progress.
If I get it running my next step is to power the turnouts frogs activating the cor.responding relais. I know that will be a big challenge.
Thanks for your support!
Happy New Year.
Best regards
Juan.
@Juan & The Need for Speed !
Hi Juan,
The Atmel Mega328P chip that is the heart of the Arduino Pro Mini can operate over a voltage range from 1.8 Volts to 5.5 Volts, BUT will not operate at all speeds depending on the operating voltage. This is what it can do:
0 - 4MHz @ 1.8 - 5.5V,
0 - 10MHz @ 2.7 - 5.5.V,
0 - 20MHz @ 4.5 - 5.5V
At 3.3 Volts it is spec'ed to operate at least to 13MHz.
The Pro Mini board has a 16MHz clock crystal (usually) and the ones I have recommended have always been 5 Volt 16 MHz models. However, I have seen them offered for 8 MHz @ 3.3Volts as well. You must select the proper "Board" in the Arduino Menu "Tools" if you are running with a slower speed version, otherwise your sketch will not account for time correctly. Note well: if your Pro Mini uses a crystal you cannot change the speed without changing the crystal, If you have a 16 MHz version you can lower the voltage to about 3.9 Volts or so and still be within specifications. I have successfully operated at 3.4 Volts and 16 MHz, but technically, this may be "out" of spec.
Also, if the Pro Mini board is a 5.0 Volt version, Its on board regulator will regulate to 5 Volts. Likewise a 3.3 volt board will have a 3.3Volt regulator on board. These voltages will be present at the VCC pin if a higher voltage is applied to the RAW input, Pro Mini pin.
'Hope this helps.
Best regards and Happy New Year,
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/
Problem solved!
Hi Geoff,
I finally figured out where the problem is! It was the LED, bad soldered to the board. I have soldered again and now it runs without problems. I will try to load the software this afternoon. I hope that everything will go fine!
Thank you for your "need for speed" explanation. Very interesting.
Best regard.
Juan
@Juan re:Specs vs. Reality & "The Need for Speed" Comments
Hi Juan,
That's great that you found your problem,. I hope the rest goes well.
The comments about the Pro Mini, power supply voltage and speed apply in a number of instances to modeling applications. Devices often work to some degree "out of specification" but when operated out of spec devices may not perform under all documented conditions. For example, they may not operate over their full temperature range. Some functions may not operate the same way or at all.
One very common thing for modelers to do is to use a resistor in series with a LED to light a car or marker directly from a DCC powered track. Technically, this violates the reverse voltage specification of virtually every LED in existence-- BUT IT WORKS! I actually called a LED manufacturer to verify their specification and they did indeed say this was not a good thing to do-- although they could not describe what failure mode of the LED would occur. I still do not know what will happen to LEDs using in this configuration, even today. They may very well fail after some period of time, or under some irregular conditions. ...And yes, I have done it too!
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/
Thank you Geoff
From you work I have 2 of the decoder running the power for my staging tracks. We twicked the prograng a bit and now the decoders are working the 16 relays.
Mike Deverell
Colorado Front Range Railroad
https://www.youtube.com/channel/UCxQthaWz7aYFp_FIu5qqs4w
@Mike D.
Hi Mike,
That's great! Your neat wiring layout will save you some grief some day when you have to return to it to trace future problems.
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/
Im curious what device you
Im curious what device you have on the upper left of your wiring, the one wit hthe two 8-digit displays ?
Im thinking its for display of voltage and current.
Really like the cleanlyness of your cable routing.