SPROG & RaspberryPI

As long as model railroad locomotives do not listen to the Wifi network itself, the DCC signal on the track is still needed to drive them. Trying to avoid the big and expensive central station, I recently discovered “SPROG”. Originally, the small SPROG box (half the size of a raspberryPI !) could be used together with JMRI to program DCC decoders. Then its firmware was enhanced to also send standard DCC track signals.

In the meantime the SPROG 3 is capable to drive 2.5A which is enough for a home O-scale layout with 2 sound equipped locos running both at the same time. The only problem with SPROG is that it is (when used as a “command station”) only transmitting a single (one time) DCC packet which it has received via USB.

Therefor the computer must add some logic to repeat the messages, keep track that not too many locos are controlled etc. Together with a raspberryPI this is a ~110 € wireless model railroad control system (you can even turn the raspberryPI into an access point and have the wireless network independent of your home network).

Yes, JMRI can also generate the DCC packets SPROG needs. However, this program is meant for using a display and a mouse and takes more than a minute to start up on the raspberryPI – because it is a pretty big (and capable!) Java program.

That’s why I developed a small “nodejs” program, which

  • receives the UDP lanbahn commands on port 27027,
  • translates a LOCO control message into a DCC packet,
  • and sends it to SPROG via USB (using the node module “serialport”)

The code is open source, it’s not more than 200 lines of code (not counting nodejs core and modules) – and you find it on github.com/michael71/Lanbahn-Sprog.

A LANbahn throttle for Android is already available.