jschiefer / BeagleChoo

Experimental model train controller using BeagleBone

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BeagleChoo

BeagleChoo is an experimental model train controller using BeagleBone, more specifically a BeagleBone Blue. The idea is to control a Märklin 60116 Digital Connector Box through its front panel connector, make some of this capability available over the network and enable technical experimentation.

This is work in progress and far from complete. You have been warned!

Background

I run a Märklin M-track model railroad, and would like digital control with it. The full-blown Märklin contollers are more expensive than the budget allows, so I am looking for a more affordable option. Also, there is a lot of unrealized potential for STEM education in model trains, particularly if you combine it with Open Source, modern embedded computing and building electronic hardware. This project tries to explore some of these areas.

Previous work

From what I can determine, the original idea of building a controller out of a Märklin 60116 Digital Connector Box and some external software came from Stefan Krauß (Homepage in German), who proposed "Gleisbox als Zentrale" and wrote the first implementation GBox2Eth in 2010. Since then, this idea has become the basis of a lot of good work, for example by Michael Bernstein and Gerhard Bertelsmann (github).

Märklin 60116 Digital Connector Box

image of Marklin 60116

The Märklin 60116 Digital Connector Box provides an attractive and cost-effective interface to a model railroad. It is designed to be used in conjunction with a Märklin 60657 Mobile Station (also known as "MS2"). The MS2 is a handheld controller that talks to the 60116 over a CAN bus link, using a format that has been published by Märklin (in German). The 60116 works as a track protocol processor. The protocol spec calls this a Gleisformat Prozessor, and I will use GFP as an acronym in this document. The GFP translates CAN bus messages from the system or GUI processor to one of the communication formats on the track. The formats supported by the GFP include the MM2, mfx (sometimes also called M4) and DCC formats. Not all of these formats are documented.

The physical connection to the CAN bus is via one of two available 10-pin mini-DIN connectors on the front panel. Unfortunately these connectors are really hard to obtain, so I will take some liberties and solder directly to the PCB.

BeagleBone Blue

Image of BeagleBone Blue

The BeagleBone Blue is a member of the BeagleBone family of single board computers, and it is focused on robotics. It basically consists of a BeagleBone with an integrated Robotics Cape. The hardware design is is open-sourced on Github. Software support for the rebotics-related components is available via librobotcontrol. Just like the BeagleBone Black, the board is based around the Octavo OSD3358-512M-BAS, which is a System-in-Package (SiP), which combines a Texas Instruments Sitara ARM® Cortex®-A8 AM3358 Processor, 512MB DDR3L RAM, a TPS65217C Power Management IC (PMIC) and a TL5209 Voltage Regulator.

Compared to other members of the BeagleBoard family, the BeagleBone Blue is unfortunately somewhat underdocumented, particularly in its differences in pinout and connectivity. The reason I am using the BeagleBone Blue for this project is that I had one laying around that wasn't used for anything else at the time, and it conveniently has a CAN interface chip already available on the board. It also has a lot of hardware drivers and I/O brought out to connectors, and has a lot of potential for other related experiments. But in principle, all of this could be adapted to other (most likely cheaper) members of the BeagleBone family.

While the BeagleBone Blue would be capable enough to also include the GFP functionality, I will make no attempt to do so. The Märklin 60116 is sold at a fair price for the functionality provided; there would be very little point in replicating all these capabilities.

System Overview

The system is connected as follows: The GFP is connected to power (18 V DC, 2-3 A), the railroad track, and to the BeagleBone Blue via the CAN connector.

Implementation ideas

Here is a loose collection of ideas of where this project may go. Then again, it may not.

  • Configure BeagleBone for CAN bus
  • Write Wireshark disector for Märklin CS2 protocol in Lua
  • Port/adapt/integrate control software
  • Integrate with JMRI
  • Rewrite control software in Rust, maybe?
  • Build capture interface for tracing track protocols with Wireshark
  • Write appropriate disectors
  • Add user interface hardware (RPG, display, buttons and knobs)
  • Drive servos for train gates, etc.

Resources

BeagleBone

PRU Programming

About

Experimental model train controller using BeagleBone

License:GNU General Public License v3.0


Languages

Language:Rust 81.9%Language:Lua 18.1%