LocoNet | Arduino Interface

Since I don’t really have space for a model rail layout, I tend to mess about with small model rail related projects. One of the aspects about model rail I genuinely enjoy is the automation side. Interfacing the physical with the digital world is a heck of a lot of fun. Using European Uhlenbrock equipment goes hand in hand with LocoNet.

Loconet is part of a DCC train control system designed by Digitrax to control a model train layout. LocoNet is a Peer to Peer Local Area Network (LAN) designed for very high traffic capacity and free-form wiring as well as future system expandability and ease of upgrade. It is a separate circuit from the track power used to run model trains.
Digitrax developed LocoNet to handle the communications between throttles, stationary decoders, and other devices that need to communicate with the command station.

Digitrax works with companies that build LocoNet Compatible Products. This gives LocoNet users more choices in hardware & software for creating the layout you want. To be able to produce a LocoNet product you need a license from Digitrax. Fortunately for us, Digitrax also has a personal edition license.

Interfacing an Arduino to LocoNet is quite simple using the Model Railroading with Arduino library. The hardware side of things isn’t rocket science either. But building it up on a breadboard, wires sticking out all over, gets old real fast.

I have two GCA185 LocoNet shields by Peter Giling. They work like a charm but the standard Arduino form factor is a bit too big for my taste.

So using Eagle Cad I designed an interface print for the Arduino Nano. I discarded the D-SUB9 connectors and added i2c pull-up resistors. They are selectable by a jumper. This means that you can use this interface to connect to almost any i2c device. Think of an MCP23008 or MCP23016 for I/O, an OLED or LCD screen.

I also added a connector for a PCA9685. The PCA9685 is and i2c-controlled PWM driver with a built in clock. That means that, unlike the TLC5940 family, you do not need to continuously send it signal tying up your microcontroller, it’s completely free running!

It is 5V compliant, which means you can control it from a 3.3V microcontroller and still safely drive up to 6V outputs (this is good for when you want to control white or blue LEDs with 3.4+ forward voltages)
6 address select pins so you can wire up to 62 of these on a single i2c bus, a total of 992 outputs – that’s a lot of servos or LEDs

I also made the i2c SDL/SCL swappable to D5 and D6 by setting jumpers. In the youtube below I have used this to connect a few WS2812b RGB LEDs to make some cheap signals. Perfect for usage in a sub level staging area.

LocoNet PCB 01The LocoNet Interface PCB I designed.

LocoNet PCB 02The blue connector for left to right: 5V – SCL/D5 – SDA/D6 – GND

LocoNet PCB 04Looking good.

LocoNet PCB 05WS2812b LEDs soldered together to make simple signals.

LocoNet PCB 06Individually controllable for the Arduino.

The code for the WS2812b simple signals is on my GitHub.

7 Replies to “LocoNet | Arduino Interface”

  1. L.S.,

    Is an layout and/or gerber file (EAGLE ?) available of this “The LocoNet Interface PCB” ? (latest version 1.x)

    Regards and thanks in advance,

    Theo.

  2. Hello,

    interesting work, thank you for sharing the code. Can you please share the schematics for the pcb and the breadbord?

    Kind Regards

    Andreas

  3. Hello Timo,

    Fantastic posts and loving the Arduino + LocoNET on your YouTube channel, would it be possible if you could give me an email?

    Cheers

    Des

  4. Hello,
    I had 10 of the version 2 pcb made. Can you please explain how to get the servo’s or led’s working on the PCA9685 ?
    How do I trigger them using the loconet or DCC signal ?
    You also mention the oled lcd. How do I get that working ?

Leave a Reply

Your email address will not be published. Required fields are marked *