Friday, April 19, 2024

Automatic Railway Gate for Unmanned Railway Crossing

The aim of this project is to save lives of people who are crossing unmanned railway crossings; by providing an automatic railway gate solution. There are many accidents occurred and lives are lost while crossing the unmanned railway crossings in India.

Materials Used:

  • Wood
  • Thermocol
  • Train and Track,

Electronic components:

  • IC L293D
  • IR Sensor set
  • Arduino Uno
  • DC Motor
  • GSM Module
  • Solar Panel (Next phase of project)
  • Bread Board, wires and Power supply

Circuit operation

Arduino gives a pulse to the ultrasonic sensor. The ultrasonic sensor has a transmit eye and a receive eye. When the Arduino gives a pulse to ultrasonic sensor, the transmit eye transmits an ultrasonic wave. When the train arrives, the ultrasonic wave bounces back. Then the receive eye receives the ultrasonic wave. It gives signal to the arduino; which calculates the distance.

The formula to calculate the distance is to multiply the speed of sound with the time taken for the ultrasonic wave to bounce back and dividing the answer by two.

Then the L293D and the buzzer gets signal from the Arduino and it gives output to the motor. And then Railway gate falls/closes. After the train crosses, the gate goes up/opens. The Motor for Railway gate can also be powered from Solar Panel.

- Advertisement -

Applications & Benefits

If installed in unmanned railway crossings, it prevents accidents and saves lives.

  • Saving lives of people
  • Eco friendly solution.
  • Low cost
  • Can be easily installed


//pin which triggers ultrasonic sound
const int pingPin = 13;

//pin which delivers time to receive echo using pulseIn()
int inPin = 12;

- Advertisement -

//range in cm which is considered safe to enter, anything
//coming within less than 5 cm triggers red LED
int safeZone = 5;

//LED pin numbers
int right = 5;
int left = 2;
int buzzer =10;

void setup() {
// initialize serial communication

void loop()
//raw duration in milliseconds, cm is the
//converted amount into a distance
Int duration, cm;

//initializing the pin states
pinMode(pingPin, OUTPUT);
pinMode(right, OUTPUT);
pinMode(left, OUTPUT)
pinMode(buzzer, OUTPUT);h
digitalWrite(left, LOW);
digitalWrite(right, LOW);

//sending the signal, starting with LOW for a clean signal
digitalWrite(pingPin, LOW);
digitalWrite(pingPin, HIGH);
digitalWrite(pingPin, LOW);

//setting up the input pin, and receiving the duration in
//microseconds for the sound to bounce off the object infront
pinMode(inPin, INPUT);
duration = pulseIn(inPin, HIGH);

// convert the time into a distance
cm = microsecondsToCentimeters(duration);

//printing the current readings to ther serial display

//checking if anything is within the safe
digitalWrite(buzzer, HIGH);
digitalWrite(left, HIGH);
digitalWrite(left, LOW);
digitalWrite(right, HIGH);
digitalWrite(right, LOW);
digitalWrite(buzzer, LOW);

}//void loop ends

int microsecondsToCentimeters(int microseconds)
// The speed of sound is 340 m/s or 29 microseconds per centimeter.
// The ping travels out and back, so to find the distance of the
// object we take half of the distance travelled.
return microseconds / 29 / 2;





Unique DIY Projects

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components