Simple Automated Model Railway Layout | Arduino Controlled

5,683

12

8

Introduction: Simple Automated Model Railway Layout | Arduino Controlled

Arduino microcontrollers are a great addition to model railroading, especially when dealing with automation. Here is a simple and easy way to get started with model railroad automation with Arduino.

So, without any further ado, let's get started!

Step 1: Watch the Video

Step 2: Get All the Stuff

Here is the list of all the parts and components required for this project:

  • An Arduino microcontroller
  • An L293N motor driver module
  • A 'sensored' track
  • A 12-volt DC power source with a current capacity of at least 1A(1000mA)
  • 6 male to female jumper wires (3 to connect the motor driver's signal inputs to the output pins of the Arduino board and the other 3 to connect the 'sensored' track's terminals to the Arduino board.)
  • 4 male to male jumper wires(2 to connect the motor driver board to power and the other two to connect the motor drive's outputs to track power.)
  • A crosshead screwdriver
  • A computer(obviously ; )
  • A suitable USB cable to connect the Arduino board to the computer

Step 3: Program the Arduino Microcontroller

Make sure to go through the program carefully to understand how it works, later it will be fun to tweak it and make your own modifications.

Step 4: Set Up the Layout

Make an oval loop of track as shown in the picture.

Step 5: Make Wiring Connections to the Motor Driver

Remove the jumper connector from the pin marked 'ENB'.

Make the following connections:

  • Connect the 'ENB' pin to pin D10 of the Arduino board.
  • Connect the 'IN 3' pin to the pin D8 of the Arduino board.
  • Connect the 'IN 4' pin to the pin D9 of the Arduino board.

Step 6: Connect Track Power Wires to the Motor Driver

Connect the output terminal's wires to the power feeder connector.

Step 7: Connect the 'sensored' Track to the Arduino

Make the following wiring connections:

  • Connect the VCC pin to +5-volt pin of the Arduino board.
  • Connect the GND pin to the GND pin of the Arduino board.
  • Connect the OUT pin to the A0 pin of the Arduino board.

Step 8: Place the Train on the Tracks

Use a re-railer to make sure that the wheels of the train sit perfectly well on the tracks.

Step 9: Connect to Power and Turn It On

Make sure no wiring connections are loose. Connect the Arduino boards power input to the power supply and turn it on.

Step 10: Sit Back and Watch Your Train Running

Step 11: Upgrade the Project

If you want to go ahead and make this project more complex, you can do a lot, add a yard siding, a passing siding, add some coupling and uncoupling action, make another loop to run two trains and so on.

1 Person Made This Project!

Recommendations

  • Pocket-Sized Speed Challenge

    Pocket-Sized Speed Challenge
  • Super-Size Speed Challenge

    Super-Size Speed Challenge
  • Audio Challenge 2020

    Audio Challenge 2020

8 Discussions

0
sonnykidd8
sonnykidd8

Question 7 months ago on Introduction

how does one get the software for this project

thanks in advance

0
KushagraK7
KushagraK7

Answer 7 months ago

To program the Arduino microcontroller, you need to have the Arduino IDE installed on your computer. You can download it from here:https://www.arduino.cc/en/main/software
You can find the code to be uploaded to the Arduino microntoroller in the step 3.

1
tannenba
tannenba

1 year ago

Hi, Since this was a simple automation, did it with an ATtiny85 instead of an Uno. Works like a charm.

0
KushagraK7
KushagraK7

Reply 12 months ago

Clever!

1
YogeshD34
YogeshD34

1 year ago

Hi Kushagra, i am trying to achieve same result, however my train is not running. i am getting motor sound from train. please advise

0
KushagraK7
KushagraK7

Reply 1 year ago

Search for this in the Arduino code:
void loop() {
// put your main code here, to run repeatedly:
for(s=0;s<=30;s++){ //Providing low voltage to the tracks to just turn on th locomotive's lights.
motor_go();
delay(10);
}

Replace '30' with a bit higher number like '40' and try uploading the code again on the Arduino microcontroller.