Automated Railway Gate Controlled by PIC16F877A

By | October 1, 2013

Here I give you my project on Automated Railway Gate Controlled by PIC16F877A . It is very good project and if it is implemented by railway then they can save lots of money to paying salary for this purpose. This project is well accepted for btech Final year project also. I received lots of students request for that project. So I try to do this project simple way by PIC microcontroller. For that project I use PIC16F877A, LCD display, two pressure Sensor (situated in rail line) ,Traffic light and motor (For closing and opening the railway gate).

Automated Railway Gate Controlled by PIC16F877A


Project Detail:

Now lets start discussion the project details. Here I use two pressure sensor places in rail line (lets imagine 1 km way) from both side of rail gate. When train is come and touch the first pressure sensor the motor is start rotating. Now the gate which is attach with motor, it slowly down and close the door. Before close the door rail traffic light which facing towards road turn red form green. And rail traffic light which facing towards rail line become green form red. Now train cross the gate after crossing gate it will touch other pressure sensor which is situated 1 Km way from other side of crossing. Now motor start anticlockwise rotating and gate slowly opening and after complete opening of the gate road traffic light will green and railway signal will red. I used LCD to display the total status of railway gate control.

I use Proteus to simulate my project and Micro c pro for writing the embedded C . In bellow found the embedded code which I used.

See embedded Code

Embedded C Code
// Name : Automated Railway Gate Controlled
// Purpose : Automated Railway Gate Controlled
// Author : Subham Dutta
// Date : 01-10-13
// Website :
sbit LCD_RS at RD2_bit;
sbit LCD_EN at RD3_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISD3_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
void main() {TRISd=0x00;
lcd_out(1,1,”Railway Crossing”);
lcd_out(2,1,”nbcafe Gate”);
if (portc==1){
lcd_out(1,1,”Attantion train”);
lcd_out(2,1,”Near to crossing”);
lcd_out(1,1,”Please Wait”);
lcd_out(2,1,”Gate is Closed”);
if (portc==2){
lcd_out(1,1,”Star yor Car”);
lcd_out(2,1,”Gate is Opening”);
lcd_out(1,1,”Thank you”);
lcd_out(2,1,”Gate is Open”);


Must See the simulation to understand the project.

3 thoughts on “Automated Railway Gate Controlled by PIC16F877A

  1. naeem

    sir ..can you give me the copy of simulation at protoues for gate control ..then i will be thnk full

  2. mamun ustc

    good.I want elaborate program and circuit diagram ….

  3. kumlachew

    please how can i make it bidirectional?
    it work for one direction. pls give me ans. quickly


Leave a Reply

Your email address will not be published. Required fields are marked *