Automatic Railway Crossing Using Arduino

Introduction: Automatic Railway Crossing Using Arduino

About: i am an electronic lover who want to make something superb.

This is a simple college project. It automatically turn off the railway gate when train arrival and after train departure.

Step 1: Collect the Material

1. Arduino UNO (Or other)
2. L293d motor driver ic or shild
3. Two IR sensor
4. one Dc geared motor 30 RPM
5. 12volt Power supply (SMPS)
6. A toy train
7. A cardboard (as base)
8. solder
9. hot melt gun
10. A buzzer
11. A wooden or plastic rod for gate
12. some wires, screws

Step 2: Fix the Material on Cardboard

1. fix the track on cardboard as shown in pic or in my youtube video, link shown below
https://youtu.be/1Oc5R_yByNw
you can fix this by using hot melt glue, screw, rubber strip.

2. fix the moter on cardboard as shown in pic by screw or rubber strip.

3. connect a plastic or wooden rod to motor's axis, this is used as gate.

4. fix two IR sensor in both side of gate(motor) and should be at equal distance as shown in my video
https://youtu.be/1Oc5R_yByNw

5. Remove the LED's from circuit of sensor and fix opposite to PHOTO TRANSISTOR and connect by wires


Step 3: Circuit Connection and Wiring

circuit diagram is shown in pic.
1. connect the IR sensor's Vcc and GND pin to Arduino

2. connect the output pins of IR sensors to Arduino's pin no 2 and 3

3. connect the pin no 4 and 5 of Arduino to L293D's input pins as shown in circuit.

4. connect the motor as shown in circuit.

5. connect all the connection as shown in circuit.

6. also connect the buzzer to both motors pins.

Step 4: #program and Code

here code is shown
just copy and paste it

int sensor1=2;
int sensor2=3;
int motor1=4;
int motor2=5;

void setup(){
pinMode(sensor1,INPUT);
pinMode(sensor2,INPUT);
pinMode(motor1,OUTPUT);
pinMode(motor2,OUTPUT);
}

void loop(){
C:
if(sensor1==LOW){
digitalWrite(motor1,HIGH);
digitalWrite(motor2,LOW);
delay(500);
digitalWrite(motor1,HIGH);
digitalWrite(motor2,HIGH);
A:
if(sensor2==LOW){
digitalWrite(motor1,LOW);
digitalWrite(motor2,HIGH);
delay(500);
digitalWrite(motor1,HIGH);
digitalWrite(motor2,HIGH);
delay(1000);
goto C;
}goto A;
if(sensor2==LOW){
digitalWrite(motor1,HIGH);
digitalWrite(motor2,LOW);
delay(500);
digitalWrite(motor1,HIGH);
digitalWrite(motor2,HIGH);
B:
if(sensor1==LOW){
digitalWrite(motor1,LOW);
digitalWrite(motor2,HIGH);
delay(500);
digitalWrite(motor1,HIGH);
digitalWrite(motor2,HIGH);
delay(1000);
goto C;
}
goto B;
}
}
}

here 500ms delay is used because gate is closed in this time. you can change this according to practical response

Step 5: Look My Video for More Information

guys this is my first instructable and here I write this "short and sweet". you can see my video on youtube, if you like then hit a like and subscribe. and give a feedback. Thanks a lot.
https://youtu.be/1Oc5R_yByNw

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    57 Discussions

    1
    Rahul_972
    Rahul_972

    3 years ago

    after dumping the code and connecting its not working how can i over come it can u provide exact circuit diagram instead of that please....have to submit my project

    1
    monusuthar2016
    monusuthar2016

    Reply 3 years ago

    Hello rahul
    I will add another circuit diagram tomarrow

    0
    Rahul_972
    Rahul_972

    Reply 3 years ago

    yeah thank you hope u add quickly so that i can complete my project

    0
    Ankit-35
    Ankit-35

    Reply 10 months ago

    Please give me the correct circuit diagram.

    0
    madhavich
    madhavich

    Reply 1 year ago

    Please give me a proper circuit diagram

    0
    Rahul_972
    Rahul_972

    Reply 3 years ago

    what happend provide me the circuit diagram

    0
    Ankit-35
    Ankit-35

    10 months ago on Introduction

    Please sir give me the proper circuit diagram and program code, this is note working quickly

    0
    Ankit-35
    Ankit-35

    10 months ago

    Please sir give me the proper circuit diagram and program code, this is not working please.

    0
    AmitP160
    AmitP160

    1 year ago

    Hi Sir.. Can you pls send the circuit diagram for the same ?

    2
    Surisurendra
    Surisurendra

    1 year ago

    Hii
    Send me proper code and circuit diagram
    This not working the wast project

    0
    AkashS_7
    AkashS_7

    Question 1 year ago on Step 1

    How do i remove the led and and connect it across the photo transistor? Can anybody send a proper circuit diagram for this

    0
    Hla Win Aung
    Hla Win Aung

    2 years ago

    Broher, I had seen your program is used motor 1 and motor 2. But , in the ckt is used one motor. Why, explain me please.

    0
    ChandrakantI
    ChandrakantI

    2 years ago

    Plz send the proper circuit diagram

    0
    ChandrakantI
    ChandrakantI

    Question 2 years ago on Introduction

    Hello the connections are not looking properly plz send the clear Vedio or picture

    0
    dgoel26
    dgoel26

    Question 2 years ago on Introduction

    hi

    could you please provide a better circuit diagram.

    it is very difficult to complete the circuit with this diagram

    0
    IramN
    IramN

    2 years ago

    Plz send me the circuit diagram of this project in my inbox.

    0
    IdongesitW
    IdongesitW

    2 years ago on Introduction

    Big brother, I am very interested in this project. I need it for my training but we dont have the material in my country. Please how can you send a complete kit to me? Please reply to my inbox. Thank you.

    0
    RaviP125
    RaviP125

    Answer 2 years ago

    Go to SP road , u will get all components in cheap prices

    0
    KesanaH
    KesanaH

    3 years ago

    how did u connected a buzzer and didnt mention in the code