Introduction: Automated Model Railway Layout Running Two Trains
I made an Automated Model Train Layout with Passing Siding a while back. Upon request from a fellow member, I made this Instructable. This is somewhat similar to the project mentioned earlier. The layout accommodates two trains and runs them alternatively. So, without further ado, let's get started!
Step 1: Get All the Necessary Stuff!
For this project, here is the parts list:
- An Arduino microcontroller board(UNO, MEGA, Leonardo, and similar ones are recommended).
- An L298N dual H-bridge motor driver board.
- 4 male to female jumper wires(to connect the digital outputs of the Arduino board to the inputs of the motor driver board).
- 4 male to male jumper wires to connect the turnouts to the motor driver board.
- 2 male to male jumper wires to connect track power to the motor driver.
- A 'sensored' track.
Step 2: Program the Arduino Board
If you don't have Arduino IDE on your computer, download it from here. The library for the Adafruit motor driver shield can be found here, in case you don't have it in your IDE. Make sure you install this in your IDE before compiling the program. If you need help installing a library, check this link out.
Make sure you go through the Arduino program before uploading it on your Arduino board. Since a large part of the operation is based on timing(that is why we managed it with a single sensor!). You may need to change some values since the size of the layout can affect how may trips the train will make around the layout, where the trains will stop, and so on. You will get an idea of how it works and you may even modify it to do whatever you can.
Step 3: Set Up the Layout
Step 4: Study the Circuit Schematic
Make sure you go through all of the details before proceeding.
Step 5: Make the Wiring Connections
Make sure no wiring connections are loose.
Step 6: Place the Locomotives on the Tracks
Let's just use the locomotives for testing purposes. Make sure the tracks are cleaned properly before starting the test to prevent stalling of locomotives.
Step 7: Power Up the Setup
Connect the 12-volt DC adapter to the Arduino board's power input, plug in the adapter and turn the power on.
Step 8: It's Done!
Step 9: Have You Done?
If you have made this project and if you can, share yours below for others to see your work. Go ahead! All the best!