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.
The code for the WS2812b simple signals is on my GitHub.