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
Basic requirement for Starter
Hi Geoff,
Thanks for the interesting artical
I have been trying to get into Model railroad for last couple of years but now I am pretty much ready as my basement is almost ready for this.
As a newbie I have following questions :
1- When I purchase a Locomotive do we need a DCC Decoder or not for this to work?
If we do need a DCC Decoder on the Loco then what's the point?
2-If we don't need DCC decoder on the loco then do we need a DCC controller to control this Stationary Decoder
3- Can we use the Arduino DCC++ Controller with this and how do we connect them together
4- Can we modify this code to accommodate Sound and Smoke other bells and whistles or do we have the ready made code to accommodate this.
5 Can this also be use to identify location of a train and direction.
While still doing my homework My plane is to run a larger rail operation (Automatic) with multiple locos
I am planing to use Arduino DCC ++ as controller ,IR as block detector RFID as Train identifier and Lots of turnouts and lots of signals in multi year time.
Any advise will be helpful
Thanks
@sahar_ca re:Questions
Hi sahar_ca (name?),
Please let me preface my response by pointing out that this blog entry on which you posted these questions was the first of a series of articles on this series of decoders with the most current being SMA20 New Low Cost 17 Channel DCC Decoders & Dual Motor,LED, & Servo Control Updated: 6 Ftns/Pin & New Features http://model-railroad-hobbyist.com/node/24316 which you should read to get up to date information. Now to your questions:
These decoders described here and in SMA20 operate as independent DCC decoders unto themselves, as do most all DCC decoders. I originally built these to control my animation projects which are literally operated independently on my layout. Using DCC equipped locos on your layout is a matter of personal choice -- many do, I do, others use DC loco control. The latest version of these in SMA20 can provide very simple motor control.
Yes, to control any DCC decoder you will need some form of DCC controller (sometimes in 2 parts -- a DCC base station and a corresponding DCC throttle). "Stationary" can sometimes be misleading -- a mobile decoder can be used in a stationary model (they usually have motor control) and so called stationary (accessory) decoders could also be placed in moving rail cars.
Yes, absolutely. You can find my experimentation with DCC++ here:SMA25 Tinkering with DCC++ Base Stations: JMRI To Track Connections, Accessories & Fun http://model-railroad-hobbyist.com/node/27318
You would connect the DCC++ operating track connections to the 2 DCC connection pins on any/all decoders. This is a very low cost option, but does have limitations compared to a commercial offering.
There is no ready-made code to accomplish this, but this could certainly be done in whole or in part depending on what you want to accomplish and your skill level. Some modelers have modified these to activate small sound modules, for example.
I suppose, but that is beyond the scope of this work. Arduinos have been used with RFID readers for example.
That's an ambitious project. Take it a step at a time, and good luck.
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 for the quick turn
Thanks for the quick turn around I will review your suggestions and follow them
Arduino CMRI library
Hello Geoff.
This is a great article so firstly thanks for letting us all into your project.
I was just wondering could you not do all this using the CMRI library on the arduino. i apologies for my ignorance as i am new to Arduino's, but i will explain what I have done.
using the CMRI library on the arduino it can now accept addresses from JMRI which can be dedicated to lights or turnouts etc. When the arduino receives this address which is i believe in the format of bit's, I can check if it is 1 or 0 and if 1 change position of the servo and if 0 return servo to original position ( or turn an LED on/off ).
By doing it this way, i can attach it to the turnout on the JMRI layout drawing and control the turnouts with a click of the icon on the screen like any other decoder board.
Like i said I am new to this and only done one servo as this is currently all i have. i believe CMRI will allow for 48 outputs and 24 inputs, so i could also have occupied current sensors all on one card. not sure how many servos i can run on one arduino card.
If my theory is correct using a Arduino Mega i could control most of my turnouts and occupied sensors from one or two arduino.
Is there a big difference with this and what you are doing. I understand you are using function controls for your input to the Arduino. But this would mean having to do all the controlling with a throttle.
I understand you are very tallented in programming and i expect you already know about the CMRI program. am i missing something.
@Steve re: Using CMRI
Hi Steve,
I am not a CMRI expert, and have never used or implemented anything with it. It was a great inspiration to me quite some years back. I personally consider it a milestone in model railroading. I'm sorry, but I don't feel knowledgeable enough to map this work into the CMRI world.
Here are 2 things to consider: You can configure these decoders to work as accessory decoders and hence you operate them via accessory switch commands, not throttle functions.
Second, you can easily use an arduino to generate DCC signals on a separate bus from your DCC base station layout bus with either DCC++: SMA25 Tinkering with DCC++ Base Stations: JMRI To Track Connections, Accessories & Fun http://model-railroad-hobbyist.com/node/27318 or with my DCC function generator: SMA22 – Low Cost DCC Controller/Function Generator for Animation, Test Tracks, Absolute Stopping Blocks for Keep-Alive DCC Locos http://model-railroad-hobbyist.com/node/25045 for independent DCC control. The DCC++ approach has the distinct advantage of being able to interface to JMRI, which may be of importance to you.
By the way, this article is an old entry that has been updated here: SMA20 New Low Cost 17 Channel DCC Decoders & Dual Motor,LED, & Servo Control Updated: 6 Ftns/Pin & New Features http://model-railroad-hobbyist.com/node/24316 with more current information.
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/
I'm so excited I have found
I'm so excited I have found this thread. First a whole hearted thanks goes out to Geoff for the increadable work he has done. Then to share as he is here is truely grand.
Now, thanks to Dave I'm seeing just what I wanted to do with my Arduino and servos I picked up. I'm going to hold off with questions until I've read all the post here as well as the page on Dave's site.
I do know I will have questions but I can't wait to get into this project and read everything
Thanks guys,
Dave
@Dave re: Starting Point
Hi Dave,
I hope you enjoy you projects. Since you are doing your background reading, please take note that this entry is actually the oldest one in the series. You might want to direct your attention to the most recent and up to date entry here:
SMA20 New Low Cost 17 Channel DCC Decoders & Dual Motor,LED, & Servo Control Updated: 6 Ftns/Pin & New Features: http://model-railroad-hobbyist.com/node/24316
But, if you can wait until the February issue of MRH comes out in 2 weeks or so, you will get the latest info with a couple of new surprises!
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!
Dear Geoff Bunza.
I've just found this blog, and it's intriguing.
I have a couple of posts about my layout which is largely still at the planning stage. I was intending to automate a few of the functions that are to do with the elements that aren't to do with the actual fun, the operations. I have a stack of relays which I can use to latch a few sequences to get trains running automatically in the background.
I do have experience with electronics (studied physics at uni) but it is rusty and nowhere near the standard that is needed for programming this kind of equipment. I have made my own simple controllers using darlington drivers and a power transistor, but prefer a botch from old battery drills these days!!
My point in asking is would it be worth my time exploring your ideas for automated switching, rather than concoct my own battery of relays? My 698 (my cat wants to join in) My way of developing things is to try a little bit, get it working and move on to the next; your concept would be one big leap for me.
In short, I know practically nothing about what you're dealing with, so would need a lot of hand holding - or pointing to the appropriate posts to explore.
I will be exporing your blog for ideas, and look forward to your article next month.
Gem xx
@Gem re: New Opportunities
Hello Gem!
Automated switching of any sort is a big jump from nothing or even from simple DC train control, no matter how you go about it. I personally find it great fun in so many ways. This particular article (and the most recent SMA20 New Low Cost 17 Channel DCC Decoders & Dual Motor,LED, & Servo Control Updated: 6 Ftns/Pin & New Features http://model-railroad-hobbyist.com/node/24316 ) uses DCC control and communication, If you are not using DCC control with your N scale modeling this will be a large learning experience, which I would encourage you to investigate if you are heading to automatic train control in any form. Also take a good look at JMRI, not just from programming DCC decoders, but look at scripting and all the other capabilities which may increase your enthusiasm even more. You need to make a basic set of decisions as to how much you want to build yourself vs. use commercial products. For me, it's usually an issue of "do I want to spend my time doing "this" or "that," and what my budget will tolerate.
Get involved "small" with a project you can complete-- say a single track shuttle train or trolley -- even on a meter of track. It does not have to be permanent. Look at it as an experiment or a learning experience, and have fun with it. For example, once you get a single shuttle running, then add a passing track and a second shuttle! Make your own rules about what is acceptable to you, but see if you can make it work. You may be surprised at how easy some parts are, and at how difficult other things are. When you get each step working, you can look at your accomplishments with great satisfaction, enjoy a beer or a cup of coffee, and immediately jump to "what more can I do?" This is a good way to test what directions you want to move with your automated switching. Move into it at a speed with which you are comfortable.
Last, the MRH forum has a very wide variety of very skilled people from all over the world that are willing to offer other enthusiastic, courteous modelers with a myriad of alternatives and share their own experiences very likely dealing with issues similar to those you will face. Learn to use it and it will be a great resource for you.
I hope these comments make some sense and are of help. If I have missed your point, please ask again.
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/
17 Function DCC Decoder
Geoff,
I would like to give this a go. But, I was wondering if its ok to substitute a Pro Micro instead?
Also I opened the "sites/model-railroad-hobbyist.com/files/users/geoffbfiles/new-dual-multifunction-decoderv5_4.zip"
but cannot see a .ino file anywhere for the arduino dev platform. What am I missing?
Craig Shaw