The Train Platform Sentinel project is designed to enhance safety at train platforms by preventing passengers from getting too close to the edge. It utilizes an ultrasonic sensor to detect the presence of people near the platform’s danger zone. When a passenger is detected within a predefined distance from the platform edge, the ultrasonic sensor sends a signal to the system, which then activates a servo motor. The servo motor, in turn, controls barriers or warning indicators to alert passengers or physically block them from getting too close to the edge, preventing accidents.
This system is fully automated, making it an efficient way to improve platform safety. The ultrasonic sensor continuously monitors the platform edge and ensures that the system only activates when necessary. Additionally, it can be integrated with other warning systems, such as LEDs or buzzers, to provide both visual and auditory alerts for enhanced awareness. The Train Platform Sentinel is particularly useful in busy train stations, where overcrowding can increase the risk of accidents.
Components List:
1. Ultrasonic Sensor (HC-SR04) – Detects the distance of passengers from the platform edge.
2. Servo Motor – Controls barriers or safety mechanisms.
3. Microcontroller (e.g., Arduino) – Processes sensor data and controls the servo.
4. Jumper Wires – For connecting components.
5. Power Supply – Provides power to the system.
6. Barriers or Warning Indicators – Optional for physical or visual alerts.
#include <Servo.h>
Servo servo;
int trigPin = 5;
int echoPin = 6;
int servoPin = 9;
long duration, dist;
void setup() {
Serial.begin(9600);
servo.attach(servoPin);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
servo.write(0); //close cap on power on
}
void measure() {
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(15);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
dist = (duration / 2) / 29.1; //obtain distance
}
void loop() {
measure();
if (dist < 20) {
servo.write(90);} // rotate servo motor to 90 degree
else{
servo.write(0);
}
Serial.println(dist);
}