I very often see sad videos on the Internet as the lonely train monotonous and boring move on a circle on an excellently making railway layout. You can change this trend, and it's really simple with an Arduino! I'm going to tell you how make a railway interlocking system. But first I'll show you how fun it is.
Interlocking add "live" train traffic scenarios as dynamic changes like dispatching of routes, complex maneuvers and more. At first glance, interlocking system is too difficult to understand. So please watch the next video, I hope that relays your very understandable fears.
In this example, a simple and clear system is built, but you can easily scale it to any size, making several systems between stations or adapt it to your railroad. There are no restrictions in the URB project, just re code Arduino sketches.
🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)
The Railway Interlocking System is a masterpiece of state-machine programming. It takes the "Traffic Light" project to the extreme by introducing moving mechanical hazards. For model train enthusiasts (HO or N scale), this automation completely replaces manual switch throwing.
The Block System (Fail Safes)
The track is divided into "Blocks."
- A train must never enter a Block if another train is already inside it.
- The Sensors: TCRT5000 IR Sensors or Hall Effect Sensors are buried under the track at the entrance of Block A and Block B.
- The Interlock: When Train 1 enters Block A, the entrance sensor triggers. The Arduino immediately turns the signal light at the entrance to "Red".
Automated Switching (Turnouts)
- If Train 2 approaches Block A and the light is Red.
- The Arduino must quickly engage a Micro Servo or a solenoid attached to the physical track switch (Turnout).
- The track switches, forcing Train 2 onto a side track (Block B).
- The signal light for Block A only returns to "Green" when the exit sensor for Block A confirms Train 1 has completely cleared the section!
Massive I/O Expansion
A large train set requires perhaps 15 sensors, 15 servos, and 30 LEDs. An Arduino Uno only has 14 digital pins!
- You must use 74HC595 Shift Registers to drive the dozens of LEDs using only 3 data pins from the Arduino.
- You must use a PCA9685 I2C Servo Driver Module to control 16 servos simultaneously utilizing only the Arduino's
SDA/SCLpins.
This project is true Systems Architecture Engineering!