Automated Point to Point Model Railroad With Yard Siding

604

2

Arduino microcontrollers open great possibilities in model railroading, especially when it comes to automation. This project is an example of such an application. It is a continuation of one of the previous projects. This project comprises of a point to point model railroad layout with a yard siding to house a train. All of the operations are controlled by an Arduino microcontroller board with the help of feedback mechanism and the train and the turnout is controlled by an Adafruit motor shield.

Supplies:

Step 1: Watch the Video

Watch the video to get an idea of how this works. So, now you know what's going on, let's get started!

Step 2: Get All the Stuff

Here is what you will require for the build:

  • An Arduino board compatible with Adafruit motor shield v2.3.
  • An Adafruit motor shield v2.3.(Click here for more information.)
  • An expansion shield(Optional, recommended to expand the +5V and GND pins of the Arduino board in order to connect the sensors.)
  • 3 'sensored' tracks.
  • 4 male to male jumper wires(2 to connect track power and others to connect the turnout.)
  • 3 sets of 3 male to female jumper wires(A total of 9 wires used for connecting the 3 pins of each sensor to the Arduino board and power.)
  • A 12-volt DC power source with a current capacity of at least 1A(1000mA).
  • A suitable USB cable to connect the Arduino board to the computer.
  • A computer to program the Arduino microcontroller.
  • A screwdriver.

Step 3: Program the Arduino Microcontroller

Make sure you have the Adafruit motor shield library installed in your Arduino IDE. You can get full documentation about the motor shield and necessary software from this link.

Step 4: Make a Test Layout

Kato Unitrack is great for making temporary layouts, especially for testing purposes. Click on the image for more information. Make a layout as shown in the above image. The length of the track in the mainline(Between points A and B can be made of any length possible.) Make sure all the rail joints are properly made and the track rails are cleaned properly.

Step 5: Install the Motor Driver Shield on the Arduino Board and Connect It to Track Power and Turnout

Install the shield carefully on the Arduino board by aligning the pins of the shield with the headers of the Arduino board. Do it gently and make sure no pins of the shield get bent.

Connect the output pins of the shield marked as M4 to the track power wires and those marked as M3 to the turnout wires. Make note that the setup is compatible with only two wire solenoid type turnouts.

Step 6: Wire Up the 'sensored' Tracks

Install the expansion shield on the motor shield and connect the sensors' GND and power wires to GND and +5V rails of the shield respectively. Make the following pin connections:

  • Connect the output of the sensor in the yard to the Arduino board's pin A0.
  • Connect the output of the sensor in the point A track to the Arduino board's pin A1.
  • Connect the output of the sensor in the point B track to the Arduino board's pin A2.

Make sure no pins are loose to avoid malfunctioning of the system.

Step 7: Connect the Arduino Board to Power and Turn It On

Connect a 12V DC power source to the Arduino using a barrel jack and power it up.

Step 8: Place Your Locomotive in the Siding and Slide It Over the 'sensored' Track

The Arduino board is programmed to start the layout operation only after the locomotive has been placed in the yard and it gets to 'know' this only through the feedback from the 'sensored' track. Make sure you watch the video, in the first step, to understand it better.

After the 'sensored' track detects the locomotive, you should see that the turnout will switch to the siding if it is not and the locomotive will start to move forward.

If the turnout switches to a wrong direction, reverse the polarity of the wires connecting the turnout to the motor shield. Do the same for track power if the locomotive starts to move in the wrong direction.

Step 9: Watch Your Train Go!

If everything was done correctly, your train should start to move from the yard siding on the mainline and proceed as shown above.

Step 10: Done for Now?

Got your train running? Don't stop here! Try upgrading the setup to run the train between more points, change the acceleration and deceleration rate of the train, tweak with the Arduino code, there is a lot to do. All the best!

Arduino Contest 2019

This is an entry in the
Arduino Contest 2019

Share

    Recommendations

    • Party Challenge

      Party Challenge
    • Woodworking Contest

      Woodworking Contest
    • Gardening Contest

      Gardening Contest

    Discussions