Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Using Arduino Nano as basic DCC decoder

15195 views
12 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    July 2007
  • From: Yorkton, Sk, Cnd
  • 441 posts
Posted by wvg_ca on Thursday, August 6, 2020 10:51 AM

in my opinion, an arduino doesn't save any space, possibly any time, or any money ...

BUT it's all about having fun, and that's certainly one way of accomplishing that end ..

  • Member since
    July 2006
  • From: Mesa, AZ
  • 16 posts
Posted by DWilde1 on Thursday, August 6, 2020 9:30 AM

An Arduino is a great tool for lots of small projects, including MRR. It's not good or bad, just different. If you think about it, DCC itself is kinda weird compared to most of the other data transmission methods used for computers!

I, myself, wouldn't choose to do much in a small scale like HO or N, but if you go up a bit (I use 3/8"n20, 1:32 on HO track using On30 mechanisms) you can do amazing things.

The important thing to realize is that computerizing things is a) an incredibly useful skill to have (I've made a $six-fig income doing this for decades, without a BSEE or CS), and b) only going to get easier and smaller, and c) a possible way to fascinate kids and get them into the MRR hobby.

What you are suggesting is not difficult, and I guarantee that you'll learn a lot by doing it. There are lots of on-line articles that include code for Arduinos and audio, so use your browser FIRST. Ditto the electronics hardware interfacing, although even Google has a hard time interpreting schematics <wink>. Your first one may take you a week or two, but after that the stars are the limit!

Some people are afraid of 'polluting' MRR with electronics and programming, but it's as much an artistic tool as an airbrush or X-Acto knife. Just tell them "YMMV, but I'm having fun!"

Willdebeast, eh? WildeBEEST was my nick as a kid, because of my name and my long shaggy hair that begged the question... ;-) PM me if you want to chat.

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Thursday, July 23, 2020 9:38 AM

 Which is why so many people who have DCC systems that used polled busses have used Loconet int he past. It's more or less a slower CAN or Ethernet. Not polled. It's slow enough to be supported directly by an Arduino or similar small micro with just a simple hardware interface - a comparator on input and a transistor for the output. And fast enough for even a large layout with lots of detectors and signals. 

                                              --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Thursday, July 23, 2020 6:53 AM

hobbyists (groups.io/g/openlcb/topics) are certainly developing Arduino SW to support CAN and LCC

along with the extra hardware and interafacing to it, recognizing when a transmission is aborted and retransmitting, LCC nodes are intelligent in that they directly communicate (address) messages to other nodes unlike C/MRI-like nodes that are simply slaves.

LCC nodes need to be configurable to generate (address) and respond to messages from other nodes.   The means to configure LCC nodes is yet another consideration although JMRI may support it.

this level of sophistication avoids polling nodes so that it can support very large layouts requiring many more than a 100 nodes. how many of us have such a layout requiring such sophistication

greg - Philadelphia & Reading / Reading

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Wednesday, July 22, 2020 7:16 PM

 CAN on Arduino isn't impossible, there are CAN Shields. The CAN interface chip handles the collision detection and retransmits. First couple I found talk to the Ardunio with SPI - so the speed of the Arduino isn't an issue in managing the connection the CAN bus.

 I mean - you can do Ethernet on an Ardunio....

                                   --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Wednesday, July 22, 2020 10:50 AM

speedybee
Their optocoupler is pointless IMO.

i agree and built a decoder w/o an opto.   Geoff B said you never know what someone might connect to it (??).    did learn the common optos are not fast enough for DCC

greg - Philadelphia & Reading / Reading

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Wednesday, July 22, 2020 10:47 AM

BMMECNYC
Every considered making an LCC node?

CAN requires hardware that immediately recognizes collisions and aborts transmission.

greg - Philadelphia & Reading / Reading

  • Member since
    April 2003
  • 305,205 posts
Posted by Anonymous on Wednesday, July 22, 2020 9:39 AM

Every considered making an LCC node?

  • Member since
    December 2016
  • 168 posts
Posted by speedybee on Wednesday, July 22, 2020 6:56 AM

I think Arduinos make great decoders. I made a couple stationary decoders out of the similar Arduino Pro Mini, and I plan to put a couple in passenger cars for controlled lighting. Yes you can buy decoders that are more compact. But there are a lot of things in this hobby that we could just buy instead of make; making is part of the fun.

 

I looked at the link provided in the first reply... that'd undoubtedly work though both the hardware and the programming are a bit more complicated than mine. Basically all mine is, is four fast diodes to make the rectifier with a voltage regulator to supply power, a fast diode and an NPN transistor to read the DCC signal, and a few prudently placed resistors and ceramic caps. Their optocoupler is pointless IMO. Driving a locomotive would need a few more components but definitely doable.

 

It'd be a fun project if you enjoy tinkering with electronics and programming stuff, however you should have at least basic experience in both those fields before tackling it, lest you find it too difficult to be enjoyable.

  • Member since
    June 2004
  • From: From Golden, CO living in Puyallup (Seattle), WA
  • 751 posts
Posted by Renegade1c on Monday, July 20, 2020 5:09 PM

For the price point of buying at the components needed (as stated in a previous post) you are already at the price point of a pre-fabricated decoder and have a much larger footprint. 

I use them for accesories on the layout but wouldn't consider using the Nano's for a decoder. 


Colorado Front Range Railroad: 
http://www.coloradofrontrangerr.com/

flag

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Monday, July 20, 2020 3:06 PM

 Perhaps as a stationary decoder, where size doesn't matter. For a loco decoder, there is a DIY DCC decoder project out ther you can google for. Best be able to solder SMD, to get it small enough. The processor used in the Nano will work, although there are better choices that are smaller with fewer IO pins, but many can be programmed with the Arduino IDE.

                                       --Randy


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Monday, July 20, 2020 9:26 AM

in addition to the nano, you need a bridge rectifier, probably some tantalum capacitors and an h-bridge or a pair of dual mosfet chips to drive the motor.   the nano is probably larger than the size of most decoders that has at least all these components.

see Geoff Bunza's article

 

 

greg - Philadelphia & Reading / Reading

  • Member since
    July 2020
  • 1 posts
Using Arduino Nano as basic DCC decoder
Posted by willdebeast02 on Sunday, July 19, 2020 11:09 PM

Has anyone ever heard of a method to use an Arduino Nano as a DCC decoder? It is a good candidate because it will fit in many locos with its small size and has many I/O pins for controlling lights and sutch, it also is very affordable. I bought one on Wish for $3. I also have a small audio amplifier module the size of a nickel that could then be used to even add some sound with some work. Does anything like this exist? Or do I have to venture on and do it myself?

Tags: Arduino , DCC

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!