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
(very) Basic Q's ...
Geoff, in addition to opening the door to whole 'nother world, you may think that perhaps you've opened a can of worms as well ...
I've always been "interested" in doing these sorts of things; but honestly, have never actually gotten around to doing it ... just so many "unknowns" from the initiates perspective. So, now that you have posted something that looks useful in-and-of itself as well as something that has huge expansion possibilities for future applications; I am seriously thinking of testing the waters ....
I've looked at the components that you have listed ... and they are available and not too expensive. What I have questions about are the "extras" that you and others probably don't give much thought to (just reach in your bins and pull out what you need); but for someone such as myself, there are too many options to make an educated choice. Could you perhaps make some recommendations as to what types of components I should procure to complete the project?
1. Capacitors. These come in many flavors (ceramic, film, aluminum, etc. as well as different tolerances) and I'm not sure which flavor is best for this application (C6 (220uf 25V) has been included in your parts list):
2. Resistors. You specify that all are 1/8 W; what sort of tolerances should I be looking for?
3. Diodes. The Schottky Diodes (D1 and D2) are included in the parts list.
4. LED's. Any recommendations?
5. Board ... ugh! Double sided? Plated through hole? Pitch? Pads? .... Any recommendation?
Sorry for the noob questions ... perhaps I need to learn a bit more of the basics before jumping in? Dave O
Educated Guess says Yes
Dear Dave HVT,
As an Educated Guess, I'm going to say (on Dr Geoff's behalf) Yes.
based on the following:
- Logix is a macro/scripting language which works within JMRI.
It is effectively Input/Command hardware and Output/action hardware agnostic
- At it's simplest, Logix allows "If Input Condition A = true, then do something to Output A" behaviour.
- As far as Dr Geoff's decoder is concerned,
it does not care what the device is that is sending a command,
as long as the command is sent in "DCC language",
and is validly addressed to the decoder/channel in question.
- Ergo, as long as your JMRI rig (PC hardware + JMRI software)
is talking to your DCC command station/booster hardware
(IE Logix is able to "speak correct DCC language")
and the Logix script itself is written and running correctly
Then there should be no reason why a Logix script can't trigger a response from Dr Geoff's decoder.
Happy Modelling,
Aim to Improve,
Prof Klyzlr
Nice work and Thanks for sharing
Mr. Bunza,
That is rather brilliant. Arduinos are great fun. I have been trying to work with one to make it onto a route controller. But have gotten stuck. If you wouldn't mind, drop and email. Amazing work, simply amazing!
Jason R.
jasonlreis (at) Hotmail {d0t} com
@Dave's Basics
No problem Dave, I constantly told my boys and my students "questions demonstrate interest... They are one way to learn."
You bet! First, there are really no super critical components used. So my first recommendation is buy cheap! These should work fine: Digikey example parts
P5149-ND CAP ALUM 22UF 25V 20% RADIAL 0.20
445-8421-ND CAP CER 0.1UF 25V 10% RADIAL 0.29
BC1018CT-ND CAP CER 270PF 50V 5% RADIAL 0.35
CF14JT10K0CT-ND RES 10K OHM 1/4W 5% CARBON FILM 0.10
CF14JT5K10CT-ND RES 5.1K OHM 1/4W 5% CARBON FILM 0.10
1N5819-TPCT-ND DIODE SCHOTTKY 40V 1A DO41 0.39
LEDs: try looking for some at Surplusgizmos.com like Part Number LBT30W2C-CUA-C 3mm LED 20ma Bright White 15,000 MCD 0.30 or at Allelectronics.com like CAT# LED-83 3mm diameter T-1 LED. Ultrabright white 0.95
I usually buy white LEDs and then color them with Clear Tamiya paint to suit the situation.Learn more about using LEDs here: http://model-railroad-hobbyist.com/magazine/mrh-2012-02-feb/points_of_light
The boards I use can be found here: http://tinyurl.com/lkhpkmd They're cheap, double sided with plated through holes.
Dave, there are lots of sources for these kinds of parts, most similar ones will work. Don't use lower Voltage Caps than 25V. Most any Schottky diodes will work that can handle at least 400 ma. You can probably lower these costs even more by hunting through electronic surplus providers on line and on ebay.
'Hope this helps. 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/
Thanks Prof!
Hi John!
Thanks for educating us! Sounds like it should work fine as an output device. I think I'll have to look into this more myself.
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/
RE: N Scale...
What I am thinking is could someone take the project as you have put it together now and extend it to be a fully fledged decoder for use in a loco (control the loco speed, direction, lights, etc)... I have doubts that even with just the Arduino board though it wouldn't fit in any N scale locos though.
Now, for the general all scales support.... If you added some storage medium and added a an additional library or two you could in theory drive a speaker from this decoder for background sounds or perhaps factory sounds... maybe even sounds driven by random logic via JMRI (think birds making noise or cars honking etc)..
Decoded Decoders-- Size and Capability
Hi,
Well... yes, you're describing what a commercial decoder really is! N-scale decoders are designed with reduced size in mind, with more components specifically selected for size and performance-- that's the design criteria vendors need to meet. And it can be tough, especially when modelers don't want to pay a premium for a tiny decoder. When you throw away these criteria (and a whole lot more, like I did) you can use components that drop costs. What you see in this project are the basic, comparable guts to a decoder you can purchase off the shelf and neatly packaged. You might be surprised to learn that the Pro Mini 328P processor is actually far more capable than some internal processors extant in commercial decoders.
You are quite right. You might what to look here:
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!
That is really what I needed to get moving forward ... going to try and source all of this stuff... sort of excited about this (might be a good project for "rainy days"?).
I really like the idea of the "DCC Function Tester"; a very useful tool and simple project to get started with. I'll then try and work up a "DCC controlled building" -- starting with loading bay doors that can open and close ... with sound!? And that gate on the fence ... and the rail crane ... yeah, you get the idea! :)
For the Professor -- could one of these project DCC decoders be used to trigger sounds from the Pricom Dream Player (seems that the Dream Player has been designed with that in mind)? Wondering "how" it would/could be done?
Thanks again for this post ... pretty exciting news for me! :)
Dream Player Triggers
Dave,
I have used the Pro Mini to trigger Pricom Dreamplayers. To quote from the Pricom manual"
The dreamplayer is relatively easy to interface to, with no additional hardware-- a very high quality gadget!
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/
Geoff - many thanks for
Geoff - many thanks for publishing this information. I have been exploring do-it-yourself DCC for many years and this circuit is a welcome addition to my tool kit!
I cobbled together a unit yesterday using parts that I have on hand and have it working to an extent but not as you describe. Perhaps you can lend a hand.
If I change the "0" at the end of this line:
to a "1" so that it reads
I get serial data to my serial terminal that shows:
the data string is described in the file named NmraDcc.cpp indicates that it is getting info for address 17
Receiving this data stream tells me that my circuit and my Arduino are OK but the LEDs don't toggle when I change function keys using "17" as the DCC address - The LEDs do toggle during the initialization tests.
Do you have any suggestions?
Again, this has the potential to add a great bit of utility to our club's modular layout and I thank you for bringing it to my attention!
Thanks!
dave ( http://www.trainelectronics.com )