กลับไปหน้ารวมไฟล์
automated-model-railway-layout-with-passing-siding-28859b-en.md

Making model train layouts is a great hobby, automating them will make it a lot better! Let us take a look at some of the advantages of its automation:

  • Low-cost operation: The whole layout is controlled by an Arduino microcontroller, using an L298N motor driver, their cost is almost nothing as compared to traditional train control throttles and power packs.
  • Ideal to put up at a display: Since no human interference is required to keep a control on the layout, you can use it at a display where you cannot be always present to control the train and the turnouts.
  • Great for microcontroller hobbyists: If you are or want to start with Arduino and programming, this is a great project for you to practice your skills.

If you are interested, you can also check the previous version of this project which is even simpler.

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

Step 1: Watch My Project Working

Step 2: Get All the Parts and Components

Parts and components

To start, make sure you have all of the following:

Step 3: Upload the Program to the Arduino Board

Arduino IDE

Download the Arduino IDE from here if you don't have it on your computer. Then download and open the given file.

Step 4: Lay the Tracks and Make the Layout

Track layout

Make an oval loop with a passing siding somewhat as shown above. Make sure the distance between the sensor track and the first turnout the train will cross after crossing the sensor track is greater than the length of the train such that no part of the train is over the sensor track when it crosses the turnout.

Step 5: A Circuit Schematic Is Always Helpful

Circuit schematic

Make sure you go through the full circuit schematic and all of the details before proceeding.

Step 6: Connect the Turnouts to the Output of the L298N Driver Board

Turnout wiring 1 Turnout wiring 2

Connect the red and the black wires of both the turnouts respectively to each other, resulting in a parallel connection. Then, connect the red wires to the out4 and the black wires to the out3 terminal of the motor driver board.

Step 7: Connect the Power Feeder Track to the Remaining Output of the L298N Driver Board

Power feeder connection

Connect the power feeder's white wire to the out1 and the blue wire to the out2 terminal of the motor driver board.

Step 8: Connect the L298N Driver Board to the Power Pins of the Arduino Board

Power connections

Connect the 12-volt pin to the VIN pin of the Arduino board, the GND pin to the GND pin of the Arduino board, and preferably, the 5-volt pin of the motor driver to the 5-volt pin of the Arduino board.

Step 9: Connect the Sensor to the Arduino Board

Sensor connection

Connect the VCC pin of the sensor to the 5-volt pin of the Arduino board, GND pin to GND pin of the Arduino board, and the OUT pin to the A0 pin of the Arduino board.

Step 10: Connect the Input Pins of the Motor Driver to the Arduino Board

Motor driver input connections

Connect the digital pins of the Arduino board to the input pins of the motor driver board as follows:

  • D9 to IN1
  • D10 to IN2
  • D11 to IN3
  • D12 to IN4

Step 11: Place the Train on the Tracks

Train on siding

After checking all of the wiring connections, place the train on the siding.

Step 12: Power Up the Setup

Powered setup

Power up the setup and make sure the turnouts get switched to the siding, if not then just reverse the connections of the turnouts made with the motor driver. Also, make sure the train starts to move to forward direction. Reverse the feeder track's connection with the motor driver if the train moves in the wrong direction.

Step 13: It's DONE!

The project is complete, for now. You can tinker with the Arduino code to change the functionality of the layout, add more sidings, etc. It's all customizable! I would love to know about any modifications you make to this project. Let me know in the comments below. All the best!

EXPANDED TECHNICAL DETAILS

Moving beyond standard block spacing, the Automated Passing Siding addresses a specific geometry problem in model railroading: a single-track loop containing two trains running in opposite directions. The system must automatically detect an impending head-on collision, switch one train onto a side track, hold it, and release it once the express train passes.

Multi-Stage Boolean Logic

The Arduino acts as the central dispatch tower, maintaining incredibly complex state awareness using boolean variables.

  1. The Approach Sensors: A Reed Switch or Hall Effect sensor is placed 3 feet before the switch.
  2. bool Train1_Approaching = true; (Magnet on bottom of train triggers sensor).
  3. The logic checks the status of the main track: if (Main_Track_Occupied == true) { Route_To_Siding(); }
  4. The Switch Throw: A Micro Servo physically throws the mechanical turnout switch left. The Arduino cuts 12V DCC power specifically to the Siding track using a relay, physically trapping Train 1!

Unlocking the Mainline

Train 2 (on the main track) speeds past the siding.

  1. An exit sensor detects Train 2 has cleared the chokepoint. Main_Track_Occupied = false;
  2. The Arduino commands the 12V relay to restore power to the Siding track.
  3. Train 1 roars back to life!
  4. The Arduino waits 5 seconds, then commands the Micro Servo to return the physical track switch to the "Straight/Mainline" position.

Requisite Architecture for Advanced Expansion

  • Arduino Mega: Crucial for tracking massive amounts of boolean variables and handling dozens of I/O interrupts simultaneously in larger layouts.
  • Hall Effect or Reed Switch Sensors (x6 or more).
  • Micro Servos (SG90) mounted beneath the model track.
  • Multi-Channel 5V Relay Boards (To selectively cut 12V power to specific track blocks).
  • A reliable 12V, 2-to-3 Amp power supply for the locomotives.

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino IDE"
author: "Tech_build"
category: "Motors & Robotics"
components:
  - "1x Dual H-Bridge motor drivers L298"
  - "1x IR proximity sensor"
  - "6x Male/Male Jumper Wires"
  - "1x 12V DC 1000mA (1A) switching power supply"
  - "7x Male/Female Jumper Wires"
  - "1x Arduino UNO"
  - "1x 12V DC 5A switching power supply"
description: "The ultimate dispatcher! Program an array of Hall Effect sensors and Servo-driven turnouts to automatically route twin trains into passing sidings without collisions."
difficulty: "Intermediate"
documentationLinks: []
downloadableFiles:
  - "https://projects.arduinocontent.cc/828dc83f-d491-4aa9-98dd-48512ebd880c.ino"
encryptedPayload: "U2FsdGVkX1/o8NXkZae+7+PiV/LtN4gCHKaCTA7PTjOTpwjalo8rIMqhYPdSYM33Ll7LG5yDo5yHyou66MNP4Ky2o8nVcBxLBBRv6mQ+Ld8="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/automated-model-railway-layout-with-passing-siding-28859b_cover.jpeg"
lang: "en"
likes: 39
passwordHash: "3281b7bf7991c93bf6d7ec579acf8d5369594f817fab40bf9ef26ca27b3ef207"
price: 1120
seoDescription: "Build an automated Model Railway layout with a passing siding and automated train sequences."
tags:
  - "dc motor"
  - "motor"
  - "automation"
  - "trains"
title: "Automated Model Railway Layout with Passing Siding"
tools: []
videoLinks:
  - "https://www.youtube.com/embed/aYDaJm61_qI"
  - "https://www.youtube.com/embed/NXI8Z7KKXjk"
views: 35477