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

geoffb's picture

@Dave O DCC Encoder

Hi Dave,

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?

Absolutely-- YES --The Pro Mini can and has already shown itself capable as a DCC "encoder," that is taking some user direction (like function and speed controls) and issuing the appropriate DCC commands to control a "decoder" like the one I present here. You can see such capability described here:  http://model-railroad-hobbyist.com/node/14762  and in the video here: http://youtu.be/zlcdJKXj_YI?list=FLKzeYLMEPxWGilqZTNuG0JA

A DCC "encoder" is the equivalent of a throttle and a DCC base station in concept. I've built these with the Pro Mini controller -- just as used in the decoder because they are completely capable and cheap. Ken K has already pointed out they have additional capabilities, yet to be fully demonstrated in this blog, but on the way, and they have plenty of memory to do the job. You can get the appropriate library to start experimenting and some starting guidance at railstars.com-- look for the Cmdrarduino library references. There are other implementations which you can search for on the web, but few if any use the Pro Mini, and most are overkill for small independent projects.

I'll be writing up the details of my implementation sometime soon as it is another low cost-- probably less than $5-6 to get started!

Best Regards,

Geoff Bunza

 

Dave O's picture

Thanks Ken and Geoff!

That is good news!  And something that perhaps I can aim for as I gain knowledge and experience with these fascinating devices.  Thanks so much for the responses and links -- I am still very excited about all the possibilities that have been opened up for me.  Cheers.  Dave O

Dave O's picture

Update ...

Today the postman delivered the first of my purchases ... 10 Arduino Pro Mini Boards and the programming cable.  :)

10 boards?

Hi Dave,

What are you planning to do with so many arduinos? 

Btw, I'm looking forward to having fun with these on the layout eventually. If anyone wants a great way to introduce their kids to arduino I can very highly recommend this book:  http://www.amazon.com/Arduino-Adventures-Escape-Gemini-Station/dp/1430246057

i used it it with my 9 year old daughter last year, and with it she designed and programmed (with guidance but not control) a arduino controlled "safety car" that had 2 ultrasonic sensors which triggered a servo that would engage and stop the toy car from rolling before it hit something. It was her science fair project. She learned a bit about stepwise refinement, logic and control structures, and how to integrate with electronics. 

Neil

geoffb's picture

Only 10?

Hi Neil,

Now at $2.25, I've used about 2 dozen or so for background building lighting and animation, crossing signals, signal control, turnout control, DCC control, DCC decoders of 4 sorts, and locomotive automation and animation.

Have a look:

https://www.youtube.com/user/DrGeoffB?feature=mhee

and

http://model-railroad-hobbyist.com/blog/geoff-bunza

Really great fun!

Best Regards,

Geoff Bunza

 

Dave O's picture

Fry them ???

... kidding (I hope).  :p

The place I ordered them sold in quantities of 10 with free shipping ... and of course at that price I figured 10 would be a good number to start with ... so many uses come to mind for this sort of thing.  :)

Building a 17-Function DCC Decoder

Hi Jeoff,

I' am new in this blog. I have tried to reproduce your dcc turnout decoder but without success until now.

I have soldered all the components as it is describe in the schema with outside input (5volts (no regulator and diodes bridges).  During 1 minutes the Arduino pro mini was blinking (I have still not reprogramed it) but after that it stopped to do it. Only de Power light was on. If I discharge all the caps and I power it on again, then it begin to blink again during some time. The only thing I have changed from your original schema is de R17 (5K1). I didn't find it in stores and I substitute it by 2 R in serie: 4K7 +270 ohm= 4k970. Could it be the problem?

Other question is the values of caps: C1 is 22uf or 220uf 25V? I have soldered the last one.

 

Can you help me with my problem? All my illusions have flown away. I wanted to drive about 25 turnout, and I thought this could be the solution.

 

Thank in advance.

Apologize my English. I write from Spain.

Best regard,

 

Jmarben

 

 

 

 

geoffb's picture

@Jmarben re: Questions

Hola Jmarben,

the Arduino pro mini was blinking (I have still not reprogrammed it) but after that it stopped to do it. Only de Power light was on. If I discharge all the caps and I power it on again, then it begin to blink again during some time.

If you have not programmed the Pro Mini then its behavior is unpredictable-- whether of not it blinks at all. When I start to use a new Pro Mini board, the first thing I will do it to attach the programmiing header pins (used to attach to the USB cable), and then load the Blink program to test that everything is working, including your computer, the USB cable itself, and the Pro Mini. It may save you allot of worry later.

It sounds like the way you power your board is more like the description here:

Your R17 resistor substitution should work well.

Good catch! C5 should be 220uf. The original schematic was wrong-- corrected above. While there are few components around the 6N137, double check all the connections are made correctly and that there are no shorts between pins or open connections. For some reason, this is the area where many people have had problems wiring their circuits, and this is very important for proper operation.

Let us know how you do. Su Engiish es muy superior a mi español!

Best regards,

Geoff Bunza

 

 

Hi Jeoff, I' am new in this

Hi Jeoff,

I' am new in this blog. I have tried to reproduce your dcc turnout decoder but without success until now.

I have soldered all the components as it is described in the schema with outside input (5volts (no regulator and diodes bridges).  During 1 minutes the Arduino pro mini was blinking (I have still not reprogrammed it) but after that it stopped to do it. Only de Power light was on. If I discharge all the caps and I power it on again, then it begin to blink again during some time. The only thing I have changed from your original schema is de R17 (5K1). I didn't find it in stores and I substitute it by 2 R in serie: 4K7 +270 ohm= 4k970. Could it be the problem?

Other question is the values of caps: C1 is 22uf or 220uf 25V? I have soldered the last one.

 

Can you help me with my problem? All my illusions have flown away. I wanted to drive about 25 turnout, and I thought this could be the solution.

 

Thanks in advance.

Apologize my English. I write from Spain.

Best regard,

 

Jmarben

 

 

 

 

Oh thank you very much for

Oh thank you very much for your answer. I will check everything you have indicated. You are all right. First of all I have programmed the Arduino with Blinking routine and check it step by step before integration to the board. Everything have been ok until then. I will post you again asap.

Have a happy New Year!

Thanks for your comments about my English, I try to do the best I can.

 

Juan

 


>> Posts index


Journals/Blogs

Recent Blog posts: