Introduction: Automatic Railway Crossing Using Arduino

Picture of Automatic Railway Crossing Using Arduino

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

Picture of 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

Picture of 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

Comments

ujjalm2 (author)2017-09-14

I have done as mention you but it not work why?

almasa1 (author)2017-03-13

brother could you please upload a C language code for above project plzz as early as possible.

monusuthar2016 (author)almasa12017-03-13

What do you mean by c language code ???? I think you are try to saying Embedded C code. This is Arduino code embedded C code is not applicable for this board

he probably means that he wants the program in regular C as most likely, he isn't using an arduino, but probably a pic or a bare atmega...

LikhitK (author)2017-04-20

i uploaded the code and it is not working. can you please upload another circuit diagram

Rahul_972 (author)2017-04-19

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

monusuthar2016 (author)Rahul_9722017-04-19

Hello rahul
I will add another circuit diagram tomarrow

Rahul_972 (author)monusuthar20162017-04-20

what happend provide me the circuit diagram

Rahul_972 (author)monusuthar20162017-04-19

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

almasa1 (author)2017-03-14

without using micro controller code use only C code

almasa1 (author)2017-03-14

its not embedded C code nd it is only C language

PrathiA (author)2017-02-20

I need circuit diagram ...dr

monusuthar2016 (author)PrathiA2017-02-20

Hello
Circuit Diagram is available in step3

hello i need know the name of sensors that you used ,pls.

and that circuit in board

thank you.

i used this sensor http://clgproject.com/infrared-sensor?search=ir

If you want to purchase this project click on the link

http://clgproject.com/index.php?route=product/product&product_id=81&search=railway

http://clgproject.com/index.php?route=product/product&product_id=81&search=railway

KushP14 (author)2017-01-24

Please give clean circuit diagram.

zk222 (author)2016-10-17

Reply as soon as possible

zk222 (author)2016-10-17

Can you please give me the full details about this project

AbhineshwarA (author)2016-08-12

i've a doubt in the railway gate control circuit's breadboard connection.what is that ,two black colored components which lies on the right hand side of the arduino board ?is it an IR-sensor circuit or anything else? pls reply me ASAP

They are IR sensors
For more information message me on hangout man.suthar2012@gmail.com

AbhineshwarA (author)2016-08-07

ok ,then i have a doubt to be cleared.while setting up this circuit in the breadboard

should we connect the IR SENSOR as such on the breadboard or remove the IR LED' s from it. pls reply me ASAP.!

It is depend upon your sensor some gives logical HIGH and some give logical LOW.
first of all check your senaor: give power to sensor and chack voltage between OUT and GND, In this condition if voltge is around zero volt then logical HIGH otherwise logical LOW. KEEP IN MIND DONT PLACE ANYTHING IN FRONT OF SENSOR.

if your sensor is logical HIGH then you must remove LED, otherwise not need to remove.
you can make the changes in program as your need.

AbhineshwarA (author)2016-08-07

i mean the IR SENSOR circuit in my previous comment

AbhineshwarA (author)2016-08-05

could you pls send me a detailed video on connecting this circuit in the breadboard.

pls its very urgent. i have to submit the project the folowing week(monday -8/08/16)

Hello
I already uploaded a video on you tube, you can search by name "dream sky". I explaned the circuit in video, but that is not fully explaned.
and I am sorry, I can not make a video on breadboard because I am busy and I have not electronic components now.

AbhineshwarA (author)2016-08-05

pls send me ur reply as soon as possible!!!

prasadhope (author)2016-03-29

Dude how to connect the motor driver?

ozan123 (author)2016-03-08

can you teach me to make this project?

monusuthar2016 (author)ozan1232016-03-28

yess
sorry for late reply

monusuthar2016 (author)2016-01-16

yeah dude

DIY Hacks and How Tos (author)2016-01-15

This is really cool. I know a couple of model train enthusiasts that would love something like this.

About This Instructable

19,382views

22favorites

Bio: i am an electronic lover who want to make something superb.
More by monusuthar2016:Solar TrackerPOV Fidget SpinnerArduino Tutorial Hindi/ Urdu
Add instructable to: