Thursday, April 13, 2017

Cheapest DCC Command Station with Loconet interface

In a previos post I talked about the DCC++ Command Station. This is an open project to build you own DCC command station using the Arduino platform. It's quite simple and easy to mount, and features a full DCC command station with PC interface and compatible with Rocrail and JMRI. This time I want to go a little bit further and be able to build a more standard command station with Loconet interface. There are very cheap and professional command stations like DR5000, for sure much better than this, but building things by your own provides satisfaction, right?

Clicking Here you can read the complete information in my previous post.

Both the protocol and interface of the basic command station project shown in my previous post aren't standard, and despite you can connect to the available Arduino I/O's some sensors, lights or switches, it's not enough for a medium sized layout. Anyway is a good command station to have apart from your layout to program and test locos. It's worth the 12€, for sure.

I took the source code of the DCC++ project (it's open an published in github) and tried (successfully) to add Loconet support, with some goodies like:

  • 3 Led to know the state of the command station (ON, OFF, SHORT CIRCUIT)
  • 2 Buttons to turn on and off the track current
  • 2 relays to switch to the programming track current automatically when a programming command is received
  • Display support, showing CV values when reading or writing and current consumption
  • External emergency button
My new sketch can only work on Arduino Mega. I had to discard Arduino UNO and Arduino NANO support as the program was too big for them, and I wanted to have a better performance with a lower cicle time.

The source code and the sketch to upload to Arduino MEGA can be downloaded from my public GitHub repository:


The PC interface support does not longer exist in this version of the command station, as my intention is to have a pure Loconet command station, exclusively dedicated to manage the trains. I prefer to have individual devices for each function, so for PC interface I use a dedicated Arduino UNO with an Ethernet shield. I'll post the information about how to mount the PC interface for a Loconet network in the next post. All this has the advantage that I can change any device without affecting the other Loconet devices or having to change any setup.

Having an independent PC Interface allows me, for example, to change my Intellibox Basic command station and use my new Arduino Based DCC++, or a DR5000. It's just disconnect one, and connect another. No changes in PC, software, or any other device.

So let's go with the connection diagram:


 You see the base is an Arduino MEGA with the Motor Shield on top and the bridge between pins 2 and 13, exactly as the original DCC++ project.

Then you have the 3 led to indicate "track power connected", "track power disconnected" or "error/fault/shortcircuit".

Two external buttons to turn on or off the track power, plus an extra external emergency button. Pressing this emergency button will provoque sending an emergency stop message through the loconet network, and not a normal power off message like with the normal buttons.

Relays are also optional, but if you use them the isolated track section will have normal current and will switch to programming current just when needed (read or write command received from Rocrail or the program you use). So you don't need to use manual switches or to have a separated track for it.

The display is not exactly the one from the photo, sorry but I couldn't find the right one in Fritzing software, but the connection schema is correct. I'm using an standard Keypad LCD shield from DFRobot (check it here). Two of the keys of the Keypad LCD shield can be used to turn on and off the command station, so the external buttons are not necessary.

Finally, a loconet shield board (like GCA185 from Giling Computer Applications) has to be used, connected to pins 47 and 48 instead of the usual 7 and 8 when you are using an Arduino UNO.

But there is an important issue with Loconet!
Any Loconet network needs a "Loconet Terminator" and a 12V power source to work. This is always provided by the command station, but in this case we need to add this. In this page from RR-Cirkits you can find information about it. 

You can use an old ATX PC power source to supply the 12V to Loconet and build your own "Loconet Terminator".  A "Loconet Terminator" is just a 15 mA pull up constant current source to 12V.:





If you have a LocoBuffer conected to the LocoNet it has also the option to provide this pull up termination by selecting 'Term" option.

Finally there is another solution to the previous issues, this is using a GCA101 from Peter Giling. This a board that provides you 3Amp power to Loconet, so you will never run out of power to connect more and more modules, and the board has also a jumper to activate the "Loconet Terminator" already included in the board. This board also provides you the PC Loconet interface to connect you layout to Rocrail.

This is the command station mounted in a simple electricity box, but we use it in the club and has been proved reliable enough to drive trains during all week end in exhibitions with no errors:



I hope to have more free time to post other Arduino based modules I have developed. Thanks for reading!!!