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!