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

geoffb's picture

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 )

Comments

pierre52's picture

@dave

Great post Dave. Forgive my ignorance but could this be used for Turnout control a la Tam Valley Quad Pics?

Peter 

The Redwood Sub

Small servos to operate turnouts

Sure thing, Peter - that is what I have done with an automated switchback line on my 8' long HO module - I am not using DCC to move the servos but it is the same idea - for details see:

http://www.trainelectronics.com/Module/

videos are here:

http://www.trainelectronics.com/Module/#Video_of_Automated_Switch-Backs_

and here:

http://www.trainelectronics.com/Module/SwitchbackController/index.html

The whole thing is automated but I may use the DCC unit we have been discussing to start/stop the small engine and to control some animations & sound on the line.  Lots of possibilities!

dave

 

geoffb's picture

@Dave re:servos

Dave, Are you going to implement multiple servo controls?

Best regards,

Geoff

 

Servo options

Geoff - I am not quite sure how to proceed with the software - I am open to suggestions!

For my purposes adding another two servos that move to preset extremes has some value.  I think a circuit that can be used for up to three servos and a relay might be the next step.

Of the two methods of servo control that I outlined on my web page (preset extremes or incremental movements) is one preferable to the other for multiple servo control?

thanks

dave

just thanks

Just wanted to write my first post cause the amazing info you have shared with us, no doubt it will be very useful and why not the beginning of more new dcc home ideas

geoffb's picture

Welcome!

Hi,

'Glad you like it. Try experimenting with it, try alternatives out, ask questions, and share your results. There is great interest in this.

Best regards,

Geoff

 

Turnout control?

Hi Michael,

I've built a module with an arduino controlling a servo which actuates a turnout. It's a simple matter of including the servo library of commands and a couple of variables to designate the stop positions and you're set. Please contact me and I can give you a hand,

 

Mark Bean

Michael T.'s picture

My interest in turnout control...

is through JMRI. My shelf layout has all the Peco turnouts except one within easy reach and I just throw the points with my finger.  Awhile back though, I read about controlling turnouts through JMRI and that tweaked my interest.  If I remember right, one can set whole routes through JMRI. At present I'm not able to afford commercial products to work with  JMRI and my Digitrax system so that was my initial interest and excitement about this project.   However, I'd also be interested in a DIY turnout servo controller  even if it wasn't DCC and used more conventional controls.

Michael

Michael

Original member of the "Gang of Six"

R.I.P. Verne Niner. The time I got to know you was way too short my friend.

"We all model the prototype, to suggest otherwise is ridiculous"

My Pike, https://mrhmag.com/blog/MichaelT

 

Dave O's picture

DCC Encoder?

I've been wandering about the web, trying to educate myself a bit on these Arduino micro-controllers ... and got to thinking ...

It would seem that these controllers could also be used to encode a DCC signal?  Perhaps there is not enough memory on these particular boards to make it worthwhile; however, I can imagine designing special controllers, which could be used to control various features on the layout.  I am thinking in terms of a very simple locomotive controller, that just has the essentials and removes all the excess capacity for use by a "novice" operator in a train show environment?

Arduino uPC Capabilities

Dave O,

With 32 k bytes of flash (program), 2 k bytes of RAM and 1 k byte of EEPROM the Atmel ATmega328 eight bit microcomputer (uPC) used in standard Arduino boards or the Atmega168 with 16 k bytes of flash used in the Pro Mini have more than enough memory for a basic NMRA decoder program. In fact the ATmega88 with only 8 k bytes of flash is designed into several commercial sound decoders. Many of the over ten year old DIY MERG (Model Electronic Railway Group) decoder designs by Mike Bolton used MicroChip PIC 16F872 uPC's with only 2 k bytes of program memory. For MERG DCC schematics, boards, software, etc. see http://www.merg.org.uk/merg_resources/dcc_download.php . Much of the MERG software could be tranlated for use with Atmel uPCs.

As important as memory capacity is the mix of peripherals included in the uPCs. In addition to general purpose outputs which can be used to control lighting and other effects (smoke), the ATmega uPCs have circuits for generating PWM signals for driving DC motors, servos, generating lighting effects and even sound. The chips also have analogue to digital converters (ADC) which can be used for measuring back electromotive force (BEMF) for controlling motor speed or measuring the track voltage or current draw of the motor.

Although eight bit uPCs provide adequate performance for most DCC decoders many manufacturers (and many DIYer) seem to be moving to 16 bit devices which provide additional functionality without increasing the costs. For example the Texas Instruments (TI) Launch Pad MSP430 series of boards (starting cost $9.99 equivalent to the list price of the Pro Mini) utilize 16 bit uPCs and are supported by an Arduino base development system Energia and TI's free high end Integrated Development System (IDE) Code Composer Studio (http://www.ti.com/ww/en/launchpad/software.html). In the US and some other regions for under $50 one can even step into the wireless world (Two 430 boards and a CC110L RF BoosterPack).

Happy Hacking!

Ken K


>> Posts index


Journals/Blogs

Recent Blog posts: