Вы находитесь на странице: 1из 12

Railway Track Gate Control

Report
Devin Clarke
Tomislav Drempetic

CIRD 3131
January 2015
Acknowledgments
Our project Railway Track Gate Control is mainly concerned with designing of the circuit and
implementing it on the breadboard. Our heartiest thanks go to Rao Gorantla/ Mr. Louis Bertrand/ Phil

Jarvis/ Chhaya A under whose guidance the entire project was conducted. We are grateful to Mr. Dave
Mackey who is very helpful in sourcing various components needed for the project. Besides we would
like to thank the faculty of the Electronics for their support.
John White
Cory Brown
Jimmy Black
Maureen Green

Abstract
A Railway track Gate control is designed with 3 main sections: the Arduino microcontroller to interpret
the input signals and desired perform logic functions, the IR transmitter and receiver to sense
obstructions on the track/proximity of the train, and the Gate controls operated by a servo motor and
various LEDs.

Keywords

Microcontroller Arduino Uno


Servo motor SG92R Micro servo
IR LED IR_TX_E406C
Phototransistor IR_RX_R3208

Introduction
We know that 60 seconds equal to 1 minute and 60 minutes equal to 1 hour. Hence the minute section
is derived by second section and hour section by the minute section. Each of the minute and second
section has been designed to give a count from 00 to 59 after which it resets to 00 and the hour section
to give a count from 00 to 23 hours after which it resets to 00. For each cycle of 00 to 59 in second
section the minute section increases its count by 1. Similarly for each cycle of 00 to 59 in minute section
the hour section increases its count by 1. In this way when the clock reaches 23hrs. 59mins. 59secs.
each of the section resets to 00 giving us a display 00.00.00 popularly known as the 0th hour.
The following sections deal with the design of various modules of the system (refer to [1-3]).

Module Structure
The entire project has been divided into four modules. They are as follows:
Arduino Code
Write Arduino code for the functioning of overall circuit.
Proximity/Obstruction Sensors
Wire IR transmitter and receiver into circuit.
Write code to interpret information from IR sensors.
Gate & Lights
Properly wire Servo into circuit
Wire LEDs (red and green) into circuit.
Write code to provide the proper functions from the obstruction and proximity sensors,
Assembly and Test

Ensure the proper functioning of IR sensors


Test proper functioning of Servo
Upload code to Arduino and confirm logic works as expected

Block Diagram
The basic block diagram of the Train level crossing proposed to be designed and implemented is
shown in Fig. 1

Fig. 1: Block diagram of basic Train level crossing.


It is evident from the block diagram that for each of Second and Minute section we require a Decade
Counter for the units place and a Mod 6 counter for the tens place. For the second and minute
sections the situation is identical with the units place counting from 0-9-0 and repeats whereas the
tens place counts from 0-5-0 and repeats. For the Hour section we require the counter for the units
place to count 0-3-0 and for the tens place it counts 0-2-0 and repeats. The circuit could have been
easily designed with an IC 7476 i.e. a dual J-K Flip-Flop but to maintain parity between the components
used we stick to the basics by using IC- 7490 (details mentioned later).

Components used
Based on the block diagram, the following (see Table 1) components needed to implement the circuit:
Table 1: Components used
Components
Quantity
2
IR LED IR_TX_E406C
Phototransistor
2
IR_RX_R3208
1
SG92R Micro Servo
2
Resistances 330
2
Resistances 10k
4

Component description
The details of the components used in the project are discussed below:
7490 Digital IC
Fig.2 and Fig 3 show the pin and internal details of the decade counter 7490.

Fig. 2: 7490 Pin Details

Fig. 3: 7490 Internal details

The IC 7490 is a 4-bit, ripple-type Decade counter. The device consists of four master-slave flip-flops
internally connected to provide a divide-by-two section and a divide-by-five section. Each section has a
separate clock input to initiate state changes of the counter on the Highto-Low clock transition. State
changes of the Q outputs do not occur simultaneously because of internal ripple delays. Therefore
decoded output signals are subject to decoding spikes and should not be used for clocks or strobes.
A gated AND asynchronous Master Reset (MR1 , MR2) is provided which overrides both clocks and
resets (clears) all the flip-flops. Also provided is a gated AND asynchronous Master Set (MS 1, MS2),
which overrides the clock and the MR inputs, setting the output to nine (HLLH).
N.B.: In the fig. Master Reset and Master Set have been denoted by R1, R2 & S1, S2 respectively.
IC 7447 & 5501 (Seven-segment Display)
According to the Pin configuration as shown in Fig. 4, Fig. 5 and Fig. 6: LT=Lamp Test After doing
every connection between the chip and the segment if this terminal (LT) is grounded then all segment
will glow. In the working mode LT should always be High.

Fig. 4: 7447 decoder pin details

Fig. 5: Display unit

Fig.6: Seven segments

BI/RBO=Blanking input/Ripple blanking Output when this terminal is grounded the display will be
blank immediately.
RBI=Ripple Blanking input. When this terminal is grounded and the input code is set for zero display
then the display will be blank immediately and zero will come out independent of LT.
5

In the IC a, b, c, d, e, f, g are the pins which are connected to the 5501 seven-segment display and the
parts which blink for these connections are shown above.

Module Details

Arduino Code: The next section outlines the code used for the operation of the
gate controls. The code is utilizing several components including an if/else statement, a
servo motor control script, and digital input readings in order to make the whole gate
control system work in unison.
Sketch (Arduino Coding)
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos1 = 90; // variable to store the servo position
int pos2 = 0; // variable to store the servo position
int ledPin1 = 11;
int ledPin2 = 10;
int ledPin3 = 7;
int ledPin4 = 6;
int obstruction = 4;
int proxy = 3;
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(obstruction,INPUT);
pinMode(proxy,INPUT);
Serial.begin(9600);
}
void loop()
{
{
Serial.println(digitalRead(3)); //Script to check the operation of the IR sensor
delay(10);
}
if ((digitalRead(4)) == HIGH)
{
for(pos1 = 0; pos1 < 90; pos1 += 1) // goes from 0 degrees to 90 degrees
{
// in steps of 1 degree
myservo.write(pos2);
// tell servo to go to position in variable 'pos'
delay(15);
}
digitalWrite(ledPin1, HIGH);
delay(100);
digitalWrite(ledPin1, LOW);
delay(100);
6

digitalWrite(ledPin2, HIGH);
delay(100);
digitalWrite(ledPin2, LOW);
delay(100);
}
else if ((digitalRead(3)) == HIGH)
{
for(pos2 = 0; pos2 < 90; pos2 += 1) // goes from 0 degrees to 90 degrees
{
// in steps of 1 degree
myservo.write(pos1);
// tell servo to go to position in variable 'pos'
delay(15);
}
digitalWrite(ledPin3,HIGH);
digitalWrite(ledPin4,LOW);
}
else
{
for(pos2 = 90; pos2>=1; pos2-=1) // goes from 90 degrees to 0 degrees
{
myservo.write(pos1);
// tell servo to go to position in variable 'pos'
delay(15);
}
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, HIGH);
}
delay(1);
}

Proximity/Obstruction Sensors

Gates and Lights


7

Figure X: Servo gate and indicator LED circuit

Circuit Diagram (IR sensors and Servo motor connections)


In the following section we have the completed circuit for the Railway track Gate control
(Fig 8).

Fig. 8: Full Circuit of railway gate control

Assembling the three sections


The clock design work is completed as discussed in the above sections. The next step is to assemble
the three sections (seconds, minute and hour) to get the Digital Clock. The 5V power is supplied using
a power supply unit and 1Hz clock is taken from a function generator. The clock was found to operate
smoothly.

Conclusion
The Circuit was purely designed with the basic knowledge on sequential circuit designing with the
components available. The Clock has been implemented as discussed in the report. The clock is
supplied from a function generator. It worked as planned. During the bread boarding and testing of the
circuit, a number of problems were encountered such as: improper display, mod k counters doesnt
count up to k and improper resting of hours section.
These problems were resolved by careful tracing of circuits with neatly drawn circuit diagrams. Each
section is tested separately.
The accuracy of the time shown depended on the function generator frequency accuracy. However, a
more accurate clock can be constructed in the following two ways:
The clock signal can be extracted from the 60-Hz oscillations in a normal power line. Many
clocks that get their power from a wall socket use this technique because it is cheap and easy.
The 60-Hz signal on the power line is reasonably accurate for this purpose (refer to [2]).
Another way is to use a crystal oscillator. Obviously, any battery-operated clock or wristwatch
will use this technique instead. It takes more parts, but is generally much more accurate.
The 60-Hz signal is divided down using a counter. When building your own clock, a typical TTL part to
use is a 7490 decade counter. This part can be configured to divide by any number between 2 and 10,
and generates a binary number as output. So you take your 60-Hz time base, divide it by 10, divide it
by 6 and now you have a 1-Hz (1 oscillation per second) signal. This 1-Hz signal is perfect for driving
the "second hand" portion of the display. So far, the clock looks like this in a block diagram

This project can be extended to include AM/ PM display, fast set for minutes and hours, and alarm.
Arduino could be used not only for these additional functions but also as a source of digital clock signal.

References
1.
2.

Rao Gorantla , (2014). Digital I lecture Notes, Durham College, Oshawa.


William Kleitz, (2011, Digital Electronics, Prentice Hall (book).

Railway Track Gate Control Project


The aim of this project is design and implement a microcontroller based controller required to control a
railway gate with Red and Green lights by sensing the output of a proximity senor. The Red and Green
lights warn the train driver to stop in case if there are any obstructions on the track as shown in Fig.1

g. 1. Automated Level crossing system


The arrival of train is detected by the sensor placed on either side of the gate at about 5km from the
level crossing. Once the arrival is sensed, the sensed signal is sent to the microcontroller and it checks
for possible presence of vehicle between the gates, again using sensors (obstruction sensors).
Subsequently, buzzer indication and light signals on either side are provided to the road users
indicating the closure of gates. Once, no vehicle is sensed in between the gate the motor is activated
and the gates are closed. But, for the worst case if any obstacle is sensed it is indicated to the train
driver by signals (red) placed at about 2km and 180m, so as to bring it to halt well before the level
crossing.
The controller consists of three main parts:
1. Microcontroller Arduino, Raspai, or any other controolers as the main function controller.
2. IR sensors: To detect the arrivalof the train or any obstructions on the track as shown in Fog.2
10

Fig.2 IR dtection Cirucit


Note: Infrared light isn't visible to naked eye, but you can see it thru a digital camera, it helps to
see if the LED is working or not.
3. The third part of the controller is the servo controller. A servomotor is DC motor whose speed and
rotation can be digitally controlled as shown in Fig.3

Fig.3 Servomotor controols.


The position of the servo motor is set by the length of a pulse. The servo expects to receive a pulse
roughly every 20 milliseconds. If that pulse is high for 1 millisecond, then the servo angle will be zero,
if it is 1.5 milliseconds, then it will be at its centre position and if it is 2 milliseconds it will be at 180
degrees. The end points of the servo can vary and many servos only turn through about 170
degrees. You can also buy 'continuous' servos that can rotate through the full 360 degrees.

11

DC Motors: Fast, continuous rotation motors Used for anything that needs to spin at a high RPM
e.g. car wheels, fans etc.
Servo Motors: Fast, high torque, accurate rotation within a limited angle Generally a high
performance alternative to stepper motors, but more complicated setup with PWM tuning. Suited for
robotic arms/legs or rudder control etc.
Stepper Motors: Slow, precise rotation, easy set up & control Advantage over servo motors in
positional control. Where servos require a feedback mechanism and support circuitry to drive
positioning, a stepper motor has positional control via its nature of rotation by fractional increments.
Suited for 3D printers and similar devices where position is fundamental.

Report Guidelines
1. Design the controller circuit as discussed above. You may add more features. Test each circuit.
2. Develop the code needed and test it.
3. Write the report by following the digital clock report. Include all your circuits and also the code
developed.

12

Вам также может понравиться