Arduino microcontrollers are a great way of automating model railroad layouts due to their low-cost availability, open-source hardware and software and a large community to help you.
For model railroads, Arduino microcontrollers can prove to be a great resource for automating their layouts in a simple and cost-effective way. This project is such an example of automation of a multi-point model railroad layout to run two trains.
This project is an upgraded version of some of my previous point to point model railroad automation projects.
A bit into this project:
This project focusses on automating a multi-point model railroad layout which has three stations. There is a starting station, say 'A' which initially houses both the trains. The mainline track leaving the station branches into two lines which go respectively to the two stations say 'B' and 'C'.
Watch the above video to understand the operation of the layout.
Here is what you will need for this project:
Make sure you have the Adafruit's motor shield v2 library installed in your Arduino IDE, if not, press Ctrl+Shift+I, search for the Adafruit motor shield and download the latest version of the Adafruit Motor Shield v2 library.
Before uploading the code on the Arduino microcontroller, make sure to go through it to get an idea of what all is happening and how.
Make the following connections with the 'sensored' tracks:
Connect the sensor C's output to pin 'A2' of the Arduino board.
Place the trains in the tracks of station A. The train A will be placed on the branch line of station A and the train B on the straight one. Refer to step 4 for more information. A diesel locomotive has been used here to represent train B.
Use of a rerailer tool is recommended, especially for steam locomotives.
If everything was done properly, then you should see the train in the sideline at station 'A' start to move and the operation to carry on as shown in the video in the first step.
If you want you can go ahead and tinker with the Arduino code and make changes to suit your needs. You can expand the layout, add more motor shields to run more trains, increase the complexity of railroad operation such as running two trains simultaneously and so on, there is a very long list of what you can do.
If you want you can also take a look at some different layout automation projects here.