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!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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!

Big and Small Contest

Participated in the
Big and Small Contest

Be the First to Share

    Recommendations

    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    9 Discussions

    0
    None
    qf6446f

    Question 3 months ago on Introduction

    why do you show two leads going to the turnouts - shouldn't there be three? I must be missing something.

    1 answer
    0
    None
    KushagraK7qf6446f

    Reply 3 months ago

    The turnouts used in the project are based on a bipolar solenoid mechanism, the direction of the turnout switch can be controlled by momentarily altering the polarity of the current supplied to the turnout's solenoid. The switching direction depends on the polarity of electric current supplied to the turnout.
    I hope it clears your doubt.

    0
    None
    YogeshD34

    Question 8 months ago on Step 4

    How track change gear works, is it controlled by Arduino or motor shield, as I am new to arduino? Please advise.

    4 answers
    0
    None
    KushagraK7YogeshD34

    Reply 8 months ago

    The track turnout change gears used in this project are Kato Unitrack #6 right and left-hand turnouts. These have a solenoid inside them which switches the track by changing the polarity of electric current going to the turnout wires, the current is supplied to the solenoid for a short period of time to switch the track. The motor shield uses an H-bridge motor driver to control the turnouts by controlling the polarity of the electric current flowing to the turnout solenoid.
    I hope it helped. :)

    0
    None
    YogeshD34KushagraK7

    Reply 4 months ago

    Hi Kushagra, hope you are doing well. thanks for your comment above. however i dont have automated turnouts, i am using servo instead. please advise how to code servo turnouts.

    thanks in advance.

    0
    None
    KushagraK7YogeshD34

    Reply 4 months ago

    I'll make the Arduino code for servo-driven turnouts and send them to you if you can provide me with your email address.

    0
    None
    zaki67

    Question 11 months ago

    hi..
    can i change An L298N dual H-bridge motor driver board with An Adafruit motor driver shield? how to make that?
    Regards

    1 answer