Site icon Circuit Ideas for You

Railway Track Accident Prevention Circuit using Arduino

Railway accidents happen because obstacles come on railway track.

Many trains cannot stop fast.

This project uses Arduino Uno, ultrasonic sensor, relay and motor or servo to give warning or stop mechanism.

The system checks distance.

If object comes close, relay activates and motor moves barrier or alarm system.

This helps to avoid accidents in simple low-cost way.

This Railway Track Accident Prevention Circuit using Arduino is easy to build.

Arduino Coding:

const int trigPin = 9;
const int echoPin = 10;
const int relayPin = 7;
const int servoPin = 6;

long duration;
int distance;

#include <Servo.h>
Servo myservo;

void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(relayPin, OUTPUT);
myservo.attach(servoPin);
myservo.write(0);
digitalWrite(relayPin, LOW);
Serial.begin(9600);
}

void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;

Serial.println(distance);

if (distance < 20) {
digitalWrite(relayPin, HIGH);
myservo.write(90);
} else {
digitalWrite(relayPin, LOW);
myservo.write(0);
}
delay(200);
}

Coding Explanation:

Circuit Working:

Parts List:

ItemQuantity
Arduino Uno1
Ultrasonic Sensor HC-SR041
5V Relay Module1
Servo Motor (SG90)1
DC Motor 1

Arduino gives 5V power to ultrasonic sensor and to servo.

Trig pin sends pulse.

Echo pin reads reflection.

Relay module gets 5V and signal from Arduino digital pin.

Relay can drive a DC motor or alarm.

When object is detected close then relay activates and motor or alarm starts.

The servo rotates to show gate closing.

All devices share common ground.

Formulas:

Ultrasonic distance formula:

Distance = (time x speed of sound) / 2

Speed of sound in air approx 340 meter per second

In microseconds speed about 0.034 cm per microsecond

So distance = duration x 0.034 / 2

Division by 2 because pulse travels to object and back.

How to Build:

To build a Railway Track Accident Prevention Circuit using Arduino follow the below steps:

Conclusion:

This project for Railway Track Accident Prevention Circuit using Arduino gives simple method to avoid railway accidents.

System detects object on track using ultrasonic sensor.

Arduino controls relay and servo to give warning or close barrier.

Cost is low and working is stable.

It can be installed on small rail crossings or demo models.

It increases safety and reduces human error.

References:

Prevention of Railway Accident using Arduino Based Safety System: A case Study of Addis Ababa Light Rail Transit

Exit mobile version