Why I built it
This project began with a friend whose model railway layout had an outdated control system. I had an old Raspberry Pi on hand, so I used it to build a new controller.
The layout
The layout has two tracks, an inner and an outer main line. Each track has a station with two platforms, reached through a turnout (switch). Two trains can run on one track.
How the trains run
One train waits at the station until the other has arrived. The controller then waits for the turnout to switch and accelerates the waiting train to its maximum speed. When a train approaches a platform, it slows down and comes to a stop.
Identifying the trains
A scanner built into the track identifies each train. A sticker with a code (a barcode or a QR code, which I am still testing) is on the underside of the train, where there is little space between the wheels. The controller looks up the passing train’s characteristics in a database, so each train behaves realistically.
Detecting the position
The position of a train, which is needed for slowing down and stopping, is detected with IR dots (infrared sensors).