Академический Документы
Профессиональный Документы
Культура Документы
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
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
Block Diagram
The basic block diagram of the Train level crossing proposed to be designed and implemented is
shown in Fig. 1
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.
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.
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
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.
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