This project spawned in the context of a university course. We built an Arduino-based controller for Märklin model trains, implementing the Motorola track protocol on custom-built hardware with proof-of-concept autonomous train driving.
Watch our YouTube demo!
The system consists of two sub-systems: The sensorboard monitors train positions via switches that are embedded in the tracks. The controllerboard controls the trains, making sure that every track segment is only occupied by at most one train at a time. It also provides a very simple serial console that allows to stop trains or change their speed. The two systems are connected by a CAN bus that allows to extend the setup.
You can check out the project with documentation and source code on GitHub.