Automated Model Train Layout(Version 1.0)

Introduction: Automated Model Train Layout(Version 1.0)

Model trains are always a fun to have and run. But to control them manually sometimes seems to be a bit boring. So in this instructable, I will show you how you can automate your model railway layout so you can sit back and relax while watching your train run on its own. This can be useful at places where you have to put your layout show and you cannot always be present there to control your trains. So, let's get started!

Step 1: Step 1: Collect All the Stuff!

Before starting, make sure you have all the parts for the build:

An Arduino Mega microcontroller board

An Adafruit motor driver shield(as shown in the picture)

A 16x2 LCD screen

A 10 kOhm potentiometer

A 12v DC wall adapter(recommended max current capacity of 1000mA)

Some wires

Step 2: The Train!

This is a Tomix EF210 N-scale electric locomotive which I bought from Japan. It comes as a set with two container wagons, check it out here:

Let's first just get our locomotive. We will add rolling stock at the end.

Step 3: The Arduino Program

Download it from here:

Step 4: Making the Control Unit

I tried to use as less wiring as possible in order to keep the setup clean. If you want the LCD screen to be wired differently, you can change the pin connections in the Arduino program.

Step 5: Make the Layout!

I made this test layout to run my train using Kato Unitrack, it is one of the best quality model railway tracks I found in the market. You can make your loop as long or short as possible.

Step 6: Install the Train Controller.

I used a sturdy cardboard box with some weights inside it as a platform for the train controller since it also featured an LCD screen. I used two flat-head screws at the rear part to anchor a plastic fiber ruler to support the controller board standing on the platform.

Step 7: Connect the Power Feeder Track's Wires to the Motor Output of the Driver

Remember those header pins which were connected to the motor output? The feeder track's connector can be attached to these long header pins or you can cut away the connector and connect the track's power through bare-end wires.

Step 8: Put the Locomotive on the Track.​

Step 9: Connect 12v DC Power to the Arduino Board and Turn on the Power

Step 10: Check If the Setup Is Working Properly.

The LCD screen should light up and the locomotive should start moving after 5 seconds of powering up the controller. Watch out for loose connections, short circuits, and malfunctioning components. Make sure the rails are cleaned properly to ensure proper electrical contact between the wheels of the locomotive and the rails.

Step 11: Attach Rolling Stock to the Locomotive

Since the locomotive is working perfectly well, let's attach some rolling stock to the locomotive to make it look like a train.

Step 12: Get the Train Running!

Make it Move Contest

Participated in the
Make it Move Contest

1 Person Made This Project!


  • Make It Modular: Student Design Challenge

    Make It Modular: Student Design Challenge
  • Origami Speed Challenge

    Origami Speed Challenge
  • Stick It Challenge

    Stick It Challenge



5 months ago

Respected Mr Kushagra Ji,
This is what I am planning to with small difference. I wanted to run two trains ( each having one loco, wagons and guard compartment) at the same time on HO track. My problem both could not run at the same time. Only one at a time. What could be the reason ? My both the sets are starter sets and each having their own power source, speedometer etc. When ever you have time, you may visit the following link:
This is the first problem.
Secondly I would like to develop now by adding, signals, level crossing into the same. Just let me know whether all (3 signals, 1 level crossing, 2 push buttons for turn out and 1 siren while gate getting open / close to buzz and 1 pair of flashing light on level crossing) work simultaneously with one Arduino (could be Mega) ? If so, you precious advice on this is requested.
Kindly use a simple language as I am a retired person and basically a geologist.
Sushil Damle
26NOV2021@1212 Hrs CA.

DIY Hacks and How Tos

I have always thought that Arduinos would be a great addition to model train sets.