p 7719 automatic control of railway gate control

Upload: sameerdani59

Post on 18-Oct-2015

26 views

Category:

Documents


0 download

DESCRIPTION

ddddddddddddddd

TRANSCRIPT

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    ABSTRACT

    Aim of this project is control the unmanned rail gate automatically

    using embedded platform. Today often we see news papers very often about the railway

    accidents happening at un- attended railway gates. Present project is designed to avoid

    such accidents if implemented in spirit.

    This project utilizes two powerful IR transmitter and two receivers

    one pair of transmitter and receiver is fi!ed at upside "from the train comes# at a level

    higher than human being in e!act alignment and similarly other pair is fi!ed at down side

    of the train direction sensor activation time is so adjusted by calculating the time ta$en

    at a certain speed to cross at least one compartment of standard minimum size of the

    Indian railway normally % seconds.

    The sensors are fi!ed at &''' meters on both sides of the gate we

    call fore side sensor pair for common towards gate train and aft side sensors for the train

    just (rosses the gate. )hen train cross the fore side sensor it gives signal to the gate

    receiver to close the gate. The buzzer is activated to clear the gate area for drivers about %

    seconds. *ate motor is turned on in one direction and gate is closed and stay closed till

    train crosses the gate and reaches aft side sensors when aft side receiver get activated

    motor turns in opposite direction and gate opens and motor stops .

    If there is any problem in the gate means it will operate red signal on

    both side fro the driver indication.

    Train arrival and departure sensing can be achieved by means of Relay

    techni+ues. )hen the wheels of the train moves over both trac$s are shorted to ground

    and this acts as a signal to microcontroller ",(% indicating train arrival. R/ signal

    appears for the road user once the train cuts the relay sensor placed before the %0ms

    before the gate .A buzzer is made on as a pre cautionary measure for the road users.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Chapter 1INTRODUCTION

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    INTRODUCTION

    Present project is designed using AT,(%& microcontroller to avoidrailway accidents happening at unattended railway gates if implemented in spirit. This

    project utilizes two powerful IR transmitters and two receivers1 one pair of transmitter

    and receiver is fi!ed at up side "from where the train comes# at a level higher than a

    human being in e!act alignment and similarly the other pair is fi!ed at down side of the

    train direction. 2ensor activation time is so adjusted by calculating the time ta$en at a

    certain speed to cross at least one compartment of standard minimum size of the Indian

    railway. )e have considered % seconds for this project. 2ensors are fi!ed at &$m on both

    sides of the gate. )e call the sensor along the train direction as 3foreside sensor4 and the

    other as 3aft side sensor4. )hen foreside receiver gets activated the gate motor is turned

    on in one direction and the gate is closed and stays closed until the train crosses the gate

    and reaches aft side sensors. )hen aft side receiver gets activated motor turns in opposite

    direction and gate opens and motor stops. 5uzzer will immediately sound at the fore side

    receiver activation and gate will close after % seconds so giving time to drivers to clear

    gate area in order to avoid trapping between the gates and stop sound after the train has

    crossed.

    The same principle is applied for trac$ switching. (onsidering a situation wherein an

    e!press train and a local train are traveling in opposite directions on the same trac$1 the

    e!press train is allowed to travel on the same trac$ and the local train has to switch on to

    the other trac$. Two sensors are placed at the either sides of the junction where the trac$

    switches. If there4s a train approaching from the other side then another sensor placed

    along that direction gets activated and will send an interrupt to the controller. The

    interrupt service routine switches the trac$. Indicator lights have been provided to avoid

    collisions. 6ere the switching operation is performed using a stepper motor. Assuming

    that within a certain delay the train has passed the trac$ is switched bac$ to its original

    position allowing the first train to pass without any interruption. This concept of trac$

    switching can be applied at &$m distance from the stations.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Gate Control7

    Railways being the cheapest mode of transportation are preferred over allthe other means .)hen we go through the daily newspapers we come across many

    railway accidents occurring at unmanned railway crossings. This is mainly due to the

    carelessness in manual operations or lac$ of wor$ers. )e in this project has come up

    with a solution for the same. 8sing simple electronic components we have tried to

    automate the control of railway gates. As a train approaches the railway crossing from

    either side the sensors placed at a certain distance from the gate detects the approaching

    train and accordingly controls the operation of the gate. Also an indicator light has been

    provided to alert the motorists about the approaching train.

    Track Switching:

    8sing the same principle as that for gate control we have developed a concept of

    automatic trac$ switching. (onsidering a situation wherein an e!press train and a local

    train are traveling in opposite directions on the same trac$1 the e!press train is allowed to

    travel on the same trac$ and the local train has to switch on to the other trac$. Indicator

    lights have been provided to avoid collisions .6ere the switching operation is performed

    using a stepper motor. In practical purposes this can be achieved using electromagnets.

    Signaling using LCD7

    Train arrival and departure message is needed at the platform for the passengers and

    also a announcement is re+uired. 5y detecting the signal at trac$s by sensors a command

    is sent to the micro controller which enables the 9(/ to display the arrival message. )e

    can also use another sensor after the station to display the departure message. And a

    buzzer can be connected across it to give a announcement. A specified delay is given to

    message so that can be displayed for that much time.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    :icro-controllers are also being used increasingly as tools for analysis and design

    of control systems. The control engineer thus has much more powerful tools available

    now than in the past. /igital computers are still in a state of rapid development because

    of the progress in very large-scale integration ";92I# technology. Thus substantial

    technological improvements can be e!pected in the future.

    5ecause of these developments the approach to analysis design and

    implementation of control systems is changing drastically. % years. =or a while it was +uite unrealistic to implement the type of regulators that the

    new theory produced e!cept in a few e!otic mostly in aerospace or advanced process

    control. 6owever due to the revolutionary development of microelectronics advanced

    regulators can be implemented even for basic applications. It is also possible to do

    analysis and design at a reasonable cost with the interactive design tools that are

    becoming increasingly available.

    The purpose of this project wor$ is to present control theory that is relevant to theanalysis and design of :icro-controller system with an emphasis on basic concept and

    ideas. It is assumed that a :icrocontroller with reasonable software is available for

    computations and simulations so that many tedious details can be left to the

    :icrocontroller. The control system design is also carried out up to the stage of

    implementation in the form of controller programs in assembly language.

    :icro-controllers are ?embedded? inside some other device so that they can

    control the features or actions of the product. Another name for a micro-controller

    therefore is ?embedded controller?. :icro-controllers are dedicated to one tas$ and run

    one specific program. The program is stored in R

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    device and often "but not always# has a small 9/ or 9(/ display for output. A micro-

    controller also ta$es input from the device it is controlling and controls the device by

    sending signals to different components in the device.

    1! Sco"e o# "ro$ect7

    This project is developed in order to help the I@/IA@ RAI9)A2 in ma$ing its

    present wor$ing system a better one by eliminating some of the loopholes

    e!isting in it.

    5ased on the responses and reports obtained as a result of the significant

    development in the wor$ing system of I@/IA@ RAI9)A2 this project can be

    further e!tended to meet the demands according to situation.

    This can be further implemented to have control room to regulate the wor$ing of

    the system. Thus becomes the user friendliness.

    This circuit can be e!panded and used in a station with any number of platforms

    as per the usage.

    Additional modules can be added with out affecting the remaining modules. This

    allows the fle!ibility and easy maintenance of the developed system.

    This system consists of following features over manual system7

    There is no time lag to operate the device.

    Accuracy.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    1.3 Contents of the Thesis:

    Chapter 2 describes the block diagram and operation of

    different units like gate control, track switching and etc., with

    block diagrams.

    Chapter 3 describes power supply part that we used in this

    project, with different parts of it, with ratings.

    Chapter 4 presents how the LC interfaced with !"c#1,

    which we used in this project for displaying train status message

    and e$planation for program.

    Chapter # presents stepper motor interfacing and

    e$planation for program written.

    Chapter % presents detailed e$planation about infrared

    sensors and its parts with circuit diagrams.

    Chapter & gi'es detailed presentation of all hardware

    components that we use in this project.

    Chapter ! gi'es the conclusions and future scope of this

    project.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Chapter 2

    BLOC% DIAGRA& ANDG'N'RAL

    D'SCRI(TION

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Block )iagra* an) General )escri"tion

    !1 Block )iagra* intro)uction:

    +IG !1

    The+IG!1shows the general bloc$ diagram of unmanned railway gate control the

    various bloc$s of this are7

    &. Power supply unit

    B. *ate control unit

    >. Trac$ changing unit

    C. 9(/ :essage display unit

    This project uses AT,(%& microcontroller for programming and operation. And

    89@B''> driver.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    The 5loc$ diagram consists of the power supply which is of single-phase

    B>'; ac. This should be given to step down transformer to reduce the B>'; ac voltage to

    lower value. i.e. to ; or &,; ac this value depends on the transformer inner winding.

    The output of the transformer is given to the rectifier circuit. This rectifier converts ac

    voltage to dc voltage. 5ut the voltage may consist of ripples or harmonics.

    To avoid these ripples the output of the rectifier is connected to filter. The filter

    thus removes the harmonics. This is the e!act dc voltage of the given specification. 5ut

    the controller operates at %; dc and the relays and driver operates at &B; dc voltage. 2o

    the regulator is re+uired to reduce the voltage. Regulator D,'% produces %; dc and

    regulator D,&B produces &B; dc. 5oth are positive voltages.

    The supply from D,'% regulator is used for the purpose of trac$ changing which

    consists of a stepper motor driven with 89@B''> the current driver chip. The supply of

    &Bv is given to drive the stepper motor for the purpose of gate control. Through ulnB''>

    2.2 Operation:

    Fig 2.2.shows the of view of model project

    This project utilizes two powerful IR transmitters and two receivers1 one pair

    of transmitter and receiver is fi!ed at up side "from where the train comes# at a level

    higher than a human being in e!act alignment and similarly the other pair is fi!ed at

    down side of the train direction. 2ensor activation time is so adjusted by calculating the

    time ta$en at a certain speed to cross at least one compartment of standard minimum size

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    of the Indian railway. )e have considered % seconds for this project. 2ensors are fi!ed at

    &$m on both sides of the gate. )e call the sensor along the train direction as 3foreside

    sensor4 and the other as 3aft side sensor4. )hen foreside receiver gets activated the gate

    motor is turned on in one direction and the gate is closed and stays closed until the train

    crosses the gate and reaches aft side sensors. )hen aft side receiver gets activated motor

    turns in opposite direction and gate opens and motor stops. 5uzzer will immediately

    sound at the fore side receiver activation and gate will close after % seconds so giving

    time to drivers to clear gate area in order to avoid trapping between the gates and stop

    sound after the train has crossed.

    The same principle is applied for trac$ switching. (onsidering a situation wherein an

    e!press train and a local train are traveling in opposite directions on the same trac$1 thee!press train is allowed to travel on the same trac$ and the local train has to switch on to

    the other trac$. Two sensors are placed at the either sides of the junction where the trac$

    switches. If there4s a train approaching from the other side then another sensor placed

    along that direction gets activated and will send an interrupt to the controller. The

    interrupt service routine switches the trac$. Indicator lights have been provided to avoid

    collisions. 6ere the switching operation is performed using a stepper motor. Assuming

    that within a certain delay the train has passed the trac$ is switched bac$ to its original

    position allowing the first train to pass without any interruption. This concept of trac$

    switching can be applied at &$m distance from the stations.

    In this project Atmel ,c%& :icro controller Integrated (hip plays the main role. The

    program for this project is embedded in this :icro controller Integrated (hip and

    interfaced to all the peripherals. The timer program is inside the :icro controller I( to

    maintain all the functions as per the scheduled time. The 9i+uid crystal /isplay "9(/# is

    interfaced to Atmel ,c%& :icro controller to display the message stepper motors are

    used for the purpose of gate control and trac$ changing interfaced with current drivers

    chip 89@B''> it4s a &E pin ic.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Infrared sensors are used in this for the detection of the train when ever it

    sends a signal to microcontroller the stepper motor should operate or message will be

    displayed on 9(/. It consists of units called transmitter and receiver circuit.

    Infrared sensor circuit consists of I(%%% timer ( %%% is used to construct

    an astable multivibrator which has two +uasi-stable states. It generates a s+uare wave of

    fre+uency >, $6z and amplitude %;olts. It is re+uired to switch 3

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Railways being the cheapest mode of transportation are preferred over all the

    other means .)hen we go through the daily newspapers we come across many railway

    accidents occurring at unmanned railway crossings. This is mainly due to the carelessness

    in manual operations or lac$ of wor$ers. )e in this project have come up with a solution

    for the same. 8sing simple electronic components we have tried to automate the control

    of railway gates. As a train approaches the railway crossing from either side the sensors

    placed at a certain distance from the gate detects the approaching train and accordingly

    controls the operation of the gate. Also an indicator light has been provided to alert the

    motorists about the approaching train.

    The above figure shows the gate controlling unit bloc$ diagram. Its

    operation can be e!plained through that.

    As the figure shows it consists of two pairs of infrared sensors placed at two

    sides of gate. They should $eep at a distance of cm "B$m in usual case# from the gate.

    and a stepper motor is used for the purpose of the gate closing and opening. Interfaced to

    the 89@B''>.

    )hen train reaches the sensor it is detected by IR sensors placed cm before the

    station and led in the sensor will glow because the %%% timer wor$s into +uasi state of

    operation. such that the IR 9/ should glow till the timer wor$s in +uasi state i.e. when

    train passes away the sensors it again into normal state then it receives %v at terminalsthat pin at the ,c%& terminal goes high which enables the power to the stepper motor to

    rotate in steps which drives gate to close similarly when it reaches the second pair of

    sensors it senses and send the signal to the microcontroller to enable the current driver to

    open the gate by rotating the stepper motor in steps to get bac$ in to original position.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    !!! Track changing unit:

    FIG: 2.2.2

    8sing the same principle as that for gate control we have developed a

    concept of automatic trac$ switching. (onsidering a situation wherein an e!press train

    and a local train are traveling in opposite directions on the same trac$1 the e!press train is

    allowed to travel on the same trac$ and the local train has to switch on to the other trac$.

    Indicator lights have been provided to avoid collisions .6ere the switching operation is

    performed using a stepper motor. In practical purposes this can be achieved using

    electromagnets.

    =or the ease of description we are considering only two plat forms thus

    this can be implemented to any number of platforms. )hen train reaches the platform

    before a &'cm distance apart a set of sensors are placed to detect the train and two pair of

    sensors are placed on each of trac$ at platforms. )hen the train is at the first pair of

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    sensors it sends a signal to microcontroller to $now the availability of plat form. 6ere

    after chec$ing availability microcontroller operates stepper motor to change the trac$.

    The mechanism is arranged as shown in fig. but in this case the trac$ changing is done

    due to second sensor that used to open the gate.

    It consists of %v driven stepper motor 89@ B''> current driver chip and

    pulley for trac$ changing mechanism.

    !!, Announce*ent unit:

    8sually announcement made at the station for the information of train arrival and

    departure. In this model we are using a buzzer for the announcement and 9(/ for the

    purpose of display message. 9(/ is interfaced to ,(%& microcontroller.

    The announcement and display message is according to the second sensor

    which should be used for the purpose of gate opening.

    !!,1 Train arri-al )etection77

    /etection of train approaching the gate can be sensed by means of sensors

    R& RB R>HRC placed on either side of the gate. In particular direction of approach R&

    is used to sense the arrival1 R> is used to sense the departure of the train. In the same way

    RCHRB senses arrival and departure in the other direction. Train arrival and departure

    sensing can be achieved by means of relay techni+ue. A confined part of parallel trac$ is

    supplied with positive voltage and ground. As wheels of the train is made up of

    aluminum which is a conducting material it shorts two parallel trac$s. )hen the wheels

    of the train moves over it both trac$s are shorted to ground and this acts as a signal tomicrocontroller ",(% indicating train arrival. The train detection in the other direction

    is done in the same way by the sensors R& H RC. These sensors are placed five

    $ilometers before the gate.

    !!,! warning #or roa) users:At that moment the train arrival is sensed on either of

    the gate road users are warned about the train approach by R/ signal placed to caution

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    the road users passing through the gate .R/ signal appears for the road user once the

    train cuts the relay sensor placed before the %0ms before the gate .A buzzer is for train

    when there is any obstacle1 signal is made R/ for train in order to slow done its speed

    before %$m from gate.

    !!,, Train )e"arture )etection:/etection of train is also done using relay techni+ues

    as e!plained the head of train arrival detection. 2ensor R>HRB respectively considering

    direction of train approach do train departure.

    A message is displayed on 9(/ when train reaches the platform. 2ensed

    by IR sensors.

    +uture enhance*ent7 In our techni+ue though it has many merits but still the power

    supply of BB>; A( P

    AT,(%& A@/ IR sensors.

    !!/ Initial signal )is"la0:

    2ignals are placed near gate each at a specified distance. Train may be

    approaching gate at either direction so all four signals are made R/ initially to indicate

    gate is

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    *R@ so that they freely move through gate. 5uzzer is

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    3.1 Circit Diagra' an( intro(ction:

    +IG: ,1

    Power supply unit consists of following units

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    i# 2tep down transformer

    ii# Rectifier unit

    iii# Input filter

    iv# Regulator unit

    v# '; A( to lower value. This B>' A( voltage cannot be used directly thus it is stepped

    down. The Transformer consists of primary and secondary coils. To reduce or step down

    the voltage the transformer is designed to contain less number of turns in its secondary

    core. The output from the secondary coil is also A( waveform. Thus the conversion from

    A( to /( is essential. This conversion is achieved by using the Rectifier (ircuit8nit.

    ,, R'CTI+I'R UNIT:

    The Rectifier circuit is used to convert the A( voltage into its corresponding /(

    voltage. There are 6alf-)ave =ull-)ave and bridge Rectifiers available for this specific

    function. The most important and simple device used in Rectifier circuit is the diode. The

    simple function of the diode is to conduct when forward biased and not to conduct inreverse bias.

    The =orward 5ias is achieved by connecting the diode4s positive with positive of

    the battery and negative with battery4s negative. The efficient circuit used is the =ull

    wave 5ridge rectifier circuit. The output voltage of the rectifier is in rippled form the

    ripples from the obtained /( voltage are removed using other circuits available. The

    circuit used for removing the ripples is called =ilter circuit.

    ,. IN(UT +ILT'R7

    (apacitors are used as filter. The ripples from the /( voltage are removed and

    pure /( voltage is obtained. And also these capacitors are used to reduce the harmonics

    of the input voltage. The primary action performed by capacitor is charging and

    discharging. It charges in positive half cycle of the A( voltage and it will discharge in

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    negative half cycle. 2o it allows only A( voltage and does not allow the /( voltage. This

    filter is fi!ed before the regulator. Thus the output is free from ripples.

    ,/ R'GULATOR UNIT7

    +IG ,1! 234/ Regulator

    Regulator regulates the output voltage to be always constant. The output voltage

    is maintained irrespective of the fluctuations in the input A( voltage. As and then the A(

    voltage changes the /( voltage also changes. Thus to avoid this Regulators are used.

    Also when the internal resistance of the power supply is greater than >' ohms the output

    gets affected. Thus this can be successfully reduced here. The regulators are mainly

    classified for low voltage and for high voltage. =urther they can also be classified as7

    i# Positive regulator

    &---J input pin

    B---J ground pin

    >---J output pin

    It regulates the positive voltage.

    ii# @egative regulator

    &---J ground pin B---J input pin

    >---J output pin

    It regulates the negative voltage.

    ,5 OUT(UT +ILT'R:

    The =ilter circuit is often fi!ed after the Regulator circuit. (apacitor is most often

    used as filter. The principle of the capacitor is to charge and discharge. It charges during

    the positive half cycle of the A( voltage and discharges during the negative half cycle. 2o

    it allows only A( voltage and does not allow the /( voltage. This filter is fi!ed after the

    Regulator circuit to filter any of the possibly found ripples in the output received finally.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    6ere we used '.&K= capacitor. The output at this stage is %; and is given to the

    :icrocontroller.

    Chapter 4

    %CD INT#RF)CING "IT* )T+C-1

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    LCD INT'R+ACING IT6 AT37C/1

    .1 D'SCRI(TION

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    FIG: .1.

    9(/ is used in this project for the purpose of displaying message at the station.

    9(/ interfacing consists of several parts li$e AT,(C%& microprocessor B L &E

    line 9(/ are main components needed. AT,(%& is a C' pin /IP micro processor. 9(/

    is a B line &E pin device B lines means it contains B rows to display.

    To develop a protocol to interface this 9(/ with ,(%& first we have to understand

    how they functions.

    These displays contain two internal byte-wide registers one for command and second

    for characters to be displayed. There are three control signals called R) /IR2 and n.

    2elect 5y ma$ing R2/I signal ' you can send different commands to display. These

    commands are used to initialize 9(/ to display pattern to shift cursor or screen etc.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    AT,(%& can be divided in to C ports and each port consists of , pins. All the

    data lines of 9(/ are connected with port P&. i.e. data lines /'-/& are connected to port

    P& i.e. to pin numbers & to , through a 2I9 2I9 is a few ohms of resistance connected to

    withstand the large voltages and currents.

    3@4 pin is connected with PB.' 3/I4 "R2# is connected with PB.& and R) pin is

    connected with PB.B. i.e. the three pins are connected to the port two. The operation of

    9(/ depends upon these three pin only.

    =or the pins &, and & a crystal oscillator circuit is connected to generate cloc$

    signals to the micro processor to enable its pins. And B'thpin is grounded with oscillator.

    C'thpin is given to the ;cc i.e. supply lines. And PB.E is given to out put terminals of IR

    sensors. And ground terminal of IR sensor is given to B'thpin.

    .! Descri"tion o# LCD inter#acing "rogra*:

    A (-language program is written to interface the 9(/ with AT,(%& is written

    in $eel c software.

    Initially all the variables and pins are set to zero i.e. initialized all the re+uired

    codes to write this program are in reg%&.h header file.

    =irst the data lines are initialized to byte of pins i.e. to a port using 2=R

    instruction. And R2 R) @ 2@2 and 9/ variables are initialized to pB.' pB.&

    pB.B pB.% and pB.D simultaneously. A delay of B% is given after the each e!ecution of the

    instruction. And port ' is initialized as output port.

    In the program a separate function is written for display message. )hen R>

    RC sensor senses the signal to the microcontroller then the variable 2@2 set to 3logical

    high4 i.e. to &. And R2M& and R) M'. Then first display function calls for display on

    first line of 9(/. After that it calls for display message on second line of the 9(/. @ow

    the message is displayed and reached the station. 2o it stays for some time. A delay of

    B%'' sec is given to run program to display the message.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    /uring this 9(/ displays4 a message li$e

    FTRAI@ I2 (

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Chapter #

    $T#!!#R /OTOR INT#RF)CING "IT*)T+C-1 U$ING U%N2003

    $tepper 'otor interfacing ith )T+C-1

    -.1. intro(ction:

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Fig -.1.2hows the complete diagram of a stepper motor interfacing

    =ig shows the stepper motor interfacing with AT,(%& using 89@B''>.

    The interfacing of stepper motor consists of several parts li$e AT,(%&

    microcontroller stepper motor and 89@B''> current driver chip.

    This can be used in this project for the purpose of gate control and trac$

    switching. =or the gate control a &Bv stepper motor is used and for the purpose of trac$

    switching %v stepper motor is used.

    89@B''> is a current driver chip used for supply control to the stepper motor1

    it is a &E pin dip.

    AT,(%& is a C' pin dip micro controller can be divided in to four ports it is

    driven by %v supply.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    +ig/11shows the two stepper motors interfaced with AT,(%& using 89@B''> for the

    purpose of this project.

    6ere a stepper motor is used for controlling the gates and trac$ switching.

    A stepper motor is a widely used device that translates electrical pulses into mechanical

    movement. They function as their name suggests - they FstepG a little bit at a time.

    2teppers don4t simply respond to a cloc$ signal. They have several windings which need

    to be energized in the correct se+uence before the motor4s shaft will rotate. Reversing the

    order of the se+uence will cause the motor to rotate the other way.

    The bloc$ diagram of stepper motor interfacing is shown bellow7

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    +ig /1!The connections according to the )iagra*shown can be as follows7

    The two output terminals of sensors are given to the port one terminals & and

    B. Remaining two terminals are grounded at B'th pin and the buzzer terminals are given

    at C and % pins of micro controller and E

    th

    is given to 9/ which operates for two trainsopposite case. thpin is reset pin through capacitor parallel with resistor. &,thand &thpins

    are given to the crystal oscillator for the purpose of generating cloc$ signals and B' thpin

    is grounded. C'thpin is given to supply i.e. ;cc. Port ' is given to current driver chip

    89@B''> through a C-pin real connector for which middle two pins are grounded and

    one is given to %v supply line and another is to &Bv supply line.

    Port B is given to another 89@B''> chip to drive another stepper motor.

    These two chips connected to microcontroller through a source in line (alled SIL.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    +ig /1, shows connection diagram of stepper motor with 89@B''>.

    89@B''> is a &E pin dip. Its connections can be e!plained as follows7

    =irst C-pins of chip are connected to microcontroller pin at >D-C' pins and second at

    B&-BC pins. And ,thpin of chip is grounded. A stepper contains % terminals C winding

    wires and a power supply wire. These C winding wires are connected to chip and another

    to supply. in this circuit too the four pins ?(ontroller pin &?B> and C will control the

    motion and direction of the stepper motor according to the step se+uencesent by the

    controller.

    http://www.8051projects.net/stepper-motor-interfacing/step-sequence.phphttp://www.8051projects.net/stepper-motor-interfacing/step-sequence.php
  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    /! Descri"tion o# C8"rogra* #or gate control9 track switching9 an) two trains

    o""osite case:

    A (-language program is written to interface the 9(/ with AT,(%& is written

    in $eel c software.

    Initially all the variables and pins are set to zero i.e. initialized all the re+uired

    codes to write this program are in reg%&.h header file.

    Two sensors are initialized with variables sense& senseB at port pins p&.' and

    p&.&. with buzzers buzzer& and buzzerB as buz& buzB at p&.C and p&.%. and the led is

    connected at pins pB.D.

    In the program port& is set as output port and all sensor and buzzer variables are

    initialized to zero.

    =or gate opening the program e!ecution will be as follows7

    The sense& pin goes high with detection of first pair of sensors

    then it sends a signal to dri'e stepper motor. (hen automatically the gate

    opens.

    =or gate closing the program e!ecution will be as follows7

    The senseB pin goes high with detection of first pair of sensors then it

    sends a signal to drive stepper motor. Then automatically the gate closes. 5y rotating the

    stepper motor in reverse direction.

    =or two trains opposite case the e!ecution of program will be as follows7

    The sense& and senseB pins goes high at a time and the buzzer gives alarm

    and gate closes because we are doing this at that part of the module. And us gives a user

    or the person at control should ta$e this to them.

    The e!ecution of program for trac$ changing as follows7

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    )hen senseB pin goes high the microcontroller should operate the stepper

    motor for trac$ changing which by use of pulley helps in changing trac$ to avoid

    accidents. This mechanism can be used for two purposes one in the case of two trains

    opposite case and another in the case of auto signaling at the platforms.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Chapter %

    INFR)R#D $#N$OR$

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Infrare( sensors

    .1.0 intro(ction:

    This infrared sensor also called as IR sensors consists of two parts7

    &. IR transmitter circuit

    B. IR receiver unit

    The transmitter unit consists of an infrared 9/ and its associated circuitry.

    511 IR Trans*itter unit:

    The IR transmitter circuit is shown in the #igure 511.

    The transmitter circuit consists of the following components7

    &. I( %%%

    B. Resistors

    >. (apacitors

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    C. IR 9/

    The IR 9/ emitting infrared light is put on in the transmitting unit. To

    generate IR signal %%% I( based astable multivibrator is used. Infrared 9/ is driven

    through transistor 5( %C,.

    I( %%% is used to construct an astable multivibrator which has two

    +uasi-stable states. It generates a s+uare wave of fre+uency >,$6z and amplitude %;olts.

    It is re+uired to switch 3

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    The receiver unit consists of a sensor and its associated circuitry. In receiver section the

    first part is a sensor which detects IR pulses transmitted by IR-9/. )henever a train

    crosses the sensor the output of IR sensor momentarily transits through a low state. As a

    result the monostable is triggered and a short pulse is applied to the port pin of the ,'%&

    microcontroller.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Chapter &*)RD")R# D#$CRI!TION

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    #/#DD#D $&$T#/$

    4.1 intro(ction:

    A system is something that maintains its e!istence and functions as a whole

    through the interaction of its parts. .g. 5ody Access (ontrol etc. An embedded system

    is micro controller-based software driven reliable real-time control system. :icro

    controllers and :icroprocessors are widely used in embedded system products. An

    embedded product uses a :icro controller to do one tas$ only. A Printer is an e!ample of

    embedded system that it is getting the data and printing it.

    N mbedded 2ystem is a combination of hardware and software used to achieve a

    single specific tas$.

    N mbedded systems are computer systems that monitor respond to or control an

    e!ternal environment.

    N nvironment connected to systems through sensors actuators and other IB EC 5it (ontrollers used with

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    &icrocontroller

    2! intro)uction7

    A computer-on-a-chip is a variation of a microprocessor which combines the

    processor core "(P8# some memory and I< "inputoutput# lines all on one chip. The

    computer-on-a-chip is called the microcomputer whose proper meaning is a computer

    using a "number of# microprocessor"s# as its (P8s while the concept of the

    microcomputer is $nown to be a microcontroller. A microcontroller can be viewed as a

    set of digital logic circuits integrated on a single silicon chip. This chip is used for only

    specific applications.

    2!1 ADANTAG'S O+ USING A &ICROCONTROLL'R O'R

    &ICRO(ROC'SSOR7

    A designer will use a :icrocontroller to

    &. *ather input from various sensors

    B. Process this input into a set of actions

    >. 8se the output mechanisms on the :icrocontroller to do something useful

    C. RA: and R

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    37c/1 &icrocontroller IC

    The AT,(%& is a low-power high-performance (:

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    2!! (in )escri"tion o# AT&'L At37c/17

    Fig: 4.2. 2

    The AT ,c%& micro controller is a C'-pin I(. The C'th pin of the controller is ;cc pin

    and the %; dc supply is given to this pin. This B' thpin is ground pin. A &B :6O crystal

    oscillator is connected to &,

    th

    and &

    th

    pins of the AT ,c%& micro controller and two BBpfcapacitors are connected to ground from &,thand &thpins. The thpin is Reset pin.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    (ort 4

    Port ' is an ,-bit open-drain bi-directional I< port. As an output port each pin can sin$

    eight TT9 inputs. )hen &s are written to port ' pins the pins can be used as high

    impedance inputs. Port ' may also be configured to be the multiple!ed low order

    addressdata bus during accesses to e!ternal program and data memory. In this mode P'

    has internal pull-ups. Port ' also receives the code bytes during =lash programming and

    outputs the code bytes during program verification. !ternal pull-ups are re+uired during

    program verification.

    (ort 1

    Port & is an ,-bit bi-directional I< port with internal pull-ups. The Port & output buffers

    can sin$source four TT9 inputs. )hen &s are written to Port & pins they are pulled high

    by the internal pull-ups and can be used as inputs. As inputs Port & pins that are

    e!ternally being pulled low will source current "II9# because of the internal pull-ups. Port

    & also receives the low-order address bytes during =lash programming and verification.

    (ort !

    Port B is an ,-bit bi-directional I< port with internal pull-ups. The Port B output buffers

    can sin$source four TT9 inputs. )hen &s are written to Port B pins they are pulled high

    by the internal pull-ups and can be used as inputs. As inputs Port B pins that are e!ternally

    being pulled low will source current "II9# because of the internal pull-ups. Port B emits

    the high-order address byte during fetches from e!ternal program memory and during

    accesses to e!ternal data memory that uses &E-bit addresses ":

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    2pecial =unction Register. Port B also receives the high-order address bits and some

    control signals during =lash programming and verification.

    (ort ,

    Port > is an ,-bit bi-directional I< port with internal pull-ups. The Port > output buffers

    can sin$source four TT9 inputs. )hen &s are written to Port > pins they are pulled high

    by the internal pull-ups and can be used as inputs. As inputs Port > pins that are

    e!ternally being pulled low will source current "II9# because of the pull-ups. Port > also

    serves the functions of various special features of the AT,(%& as listed below7

    (ort (in Alternate +unctions

    P>.' R/ "serial input port#

    P>.& T/ "serial output port#

    P>.B I@T' "e!ternal interrupt '#

    P>.> I@T& "e!ternal interrupt

    P>.C T' "timer ' e!ternal input#

    P>.% T& "timer & e!ternal input#

    P>.E )R "e!ternal data memory write strobe#

    P>.D R/ "e!ternal data memory read strobe#

    Port > also receives some control signals for =lash programming and verification.

    R$T

    )eset input. * high on this pin for two machine cycles while the oscillator is

    running resets the de'ice.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    AL';(ROG

    Address 9atch nable output pulse for latching the low byte of the address during

    accesses to e!ternal memory. This pin is also the program pulse input "PR

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    &B-volt programming enable voltage ";PP# during =lash programming for parts that

    re+uire &B-volt ;PP.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Rela5 (ri6ers

    4.3 intro(ction:

    IC9 ULN!44,A )escri"tion7 #ig: 2,4

    Pins @o. of7&E

    Temperature

    Input Type7TT9 (:

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    7.3.1 PIN CONNECTIONS OF ULN2003:

    Fig: 7.3.1

    The 89@B''&A 89@B''BA 89@B''> and 89@B''CAare high ;oltage high

    current /arlington arrays each containing seven open collector /arlington pairs with

    common emitters. ach channel rated at %''mAand can withstand pea$ currents of

    E''mA.2uppressiondiodesare included for inductive load driving and the inputs are

    pinned opposite the outputs to simplify board layout.

    These versatile devices are useful for driving a wide range of loads

    including solenoids relays /( motors1 9/ displays filament lamps thermal print heads

    and high power buffers. The 89@B''&AB''BAB''>A and B''CA are supplied in &E pin

    plastic /IP pac$ages with a copper lead frame to reduce thermal resistance. They are

    available also in small outline pac$age "2/B''C/.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    4.3.2 $che'atics of Darlington7s pair:

    Fig: 4.3.2

    /arlington pairs are bac$ to bac$ connection of two transistors with some

    source resistors.

    Fig:4.3.3 shows the /arlington pair connection of transistor.

    The circuit above is a 3/arlington Pair4 driver. The first transistor4s emitter feeds into the

    second transistor4s base and as a result the input signal is amplified by the time it reaches

    the output.

    The important point to remember is that the /arlington Pair is made up of two transistors

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    and when they are arranged as shown in the circuit they are used to amplify wea$ signals.

    The amount by which the weak signal is amplified is called the +*-/. .

    4.3.3 +'ATUR'S O+ DRI'R:

    2even /arlington4s per pac$age

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    IC --- TI/#R$

    4..0 Description:

    Fig4..0 shos +8pin (ip for IC --- ti'er

    I( %%% TI:R used in this project for the purpose of IR sensor circuits.

    It can operate in several modes its internal circuit and description is as e!plained below7

    2tandard %%% and %%E I(s create a significant glitch on the supply when their output

    changes state. This is rarely a problem in simple circuits with no other I(s but in more

    comple! circuits a smoothing capacitor "e.g. &''K=# should be connected across the S;s

    and '; supply near the %%% or %%E.

    The input and output pin functions are described briefly below and there are fuller

    e!planations covering the various circuits7

    Astable - producing a s+uare wave

    :onostable - producing a single pulse when triggered

    5istable - a simple memory which can be set and reset

    http://www.kpsec.freeuk.com/555timer.htm#astablehttp://www.kpsec.freeuk.com/555timer.htm#monostablehttp://www.kpsec.freeuk.com/555timer.htm#bistablehttp://www.kpsec.freeuk.com/555timer.htm#astablehttp://www.kpsec.freeuk.com/555timer.htm#monostablehttp://www.kpsec.freeuk.com/555timer.htm#bistable
  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    5uffer - an inverting buffer "2chmitt trigger#

    In"uts o# ///7

    Trigger input7 when U &>;s "active low# this ma$es the output high "S;s#. It monitors

    the discharging of the timing capacitor in an astable circuit. It has a high input impedance

    J B: .

    Threshold input7 when J B>;s "active high# this ma$es the output low "';#V. It

    monitors the charging of the timing capacitor in astable and monostable circuits. It has a

    high input impedance J &': .

    V providing the trigger input is J &>;s otherwise the trigger input will override the

    threshold input and hold the output high "S;s#.

    Reset input7 when less than about '.D; "active low# this ma$es the output low "';#

    overriding other inputs. )hen not re+uired it should be connected to S;s. It has an input

    impedance of about &'$ .

    (ontrol input7 this can be used to adjust the threshold voltage which is set internally to be

    B>;s. 8sually this function is not re+uired and the control input is connected to '; with

    a '.'&K= capacitor to eliminate electrical noise. It can be left unconnected if noise is not a

    problem.

    The discharge pin is not an input but it is listed here for convenience. It is connected to

    '; when the timer output is low and is used to discharge the timing capacitor in astable

    and monostable circuits.

    Out"ut o# ///

    The output of a standard %%% or %%E can sin$ and sourceup to B''mA. This is more than

    most I(s and it is sufficient to supply many output transducers directly including 9ed4s

    "with a resistor in series# low current lamps piezo transducers loudspea$ers "with a

    capacitor in series# relay coils "with diode protection# and some motors "with diode

    http://www.kpsec.freeuk.com/555timer.htm#bufferhttp://www.kpsec.freeuk.com/components/ic.htm#sinksourcehttp://www.kpsec.freeuk.com/555timer.htm#bufferhttp://www.kpsec.freeuk.com/components/ic.htm#sinksource
  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    protection#. The output voltage does not +uite reach '; and S;s especially if a large

    current is flowing.

    To switch larger currents you can connect a transistor.

    The ability to both sin$ and source current means that two devices can be connected to

    the output so that one is on when the output is low and the other is on when the output is

    high. The top diagram shows two 9ed4s connected in this way. This arrangement is used

    in the 9evel (rossingproject to ma$e the red 9ed4s flash alternately.

    2.1 /// ti*ers as asta=le:

    An astable circuit produces a s+uare wave41 this is a digital waveform with sharp

    transitions between low "';# and high "S;s#. @ote that the durations of the low and high

    states may be different. The circuit is called an astable because it is not stable in any

    state7 the output is continually changing between low and high.

    The time period "T# of the s+uare wave is the time for one complete cycle but it is

    usually better to consider fre+uency"f# which is the number of cycles per second.

    T M '.D L "R& S BRB# L (& and f M&.C

    "R& S BRB# L (&

    T M time period in seconds "s#

    f M fre+uency in hertz "6z#

    R& M resistance in ohms " #

    RB M resistance in ohms " #

    (& M capacitance in farads "=#

    The time period can be split into two parts7 T M Tm S Ts

    :ar$ time "output high#7 Tm M '.D L "R& S RB# L (&

    2pace time "output low#7 Ts M '.D L RB L (&

    http://www.kpsec.freeuk.com/trancirc.htm#ichttp://www.kpsec.freeuk.com/projects/levelc.htmhttp://www.kpsec.freeuk.com/acdc.htm#propshttp://www.kpsec.freeuk.com/acdc.htm#propshttp://www.kpsec.freeuk.com/trancirc.htm#ichttp://www.kpsec.freeuk.com/projects/levelc.htmhttp://www.kpsec.freeuk.com/acdc.htm#propshttp://www.kpsec.freeuk.com/acdc.htm#props
  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    :any circuits re+uire Tm and Ts to be almost e+ual1 this is achieved if RB is much larger

    than R&.

    fig

    #ig 2.1

    =or a standard astable circuit Tm cannot be less than Ts but this is not too restricting

    because the output can both sin$ and source current. =or e!ample an 9/ can be made to

    flash briefly with long gaps by connecting it "with its resistor# between S;s and the

    output. This way the 9/ is on during Ts so brief flashes are achieved with R& larger

    than RB ma$ing Ts short and Tm long. If Tm must be less than Ts a diode can be added

    to the circuit as e!plained underduty cyclebelow.

    (hoosing R& RB and (&

    R& and RB should be in the range &$ to &: . It is best to choose (& first because

    capacitors are available in just a few values.

    (hoose (& to suit the fre+uency range you re+uire "use the table as a guide#.

    (hoose RB to give the fre+uency "f# you re+uire. Assume that R& is much smaller

    than RB "so that Tm and Ts are almost e+ual# then you can use7

    RB M'.D

    f L (&

    http://www.kpsec.freeuk.com/555timer.htm#dutycyclehttp://www.kpsec.freeuk.com/555timer.htm#dutycyclehttp://www.kpsec.freeuk.com/555timer.htm#dutycycle
  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    (hoose R& to be about a tenth of RB "&$ min.# unless you want the mar$ time

    Tm to be significantly longer than the space time Ts.

    If you wish to use a variable resistor it is best to ma$e it RB.

    If R& is variable it must have a fi!ed resistor of at least &$ in series

    "this is not re+uired for RB if it is variable#.

    Asta=le o"eration

    )ith the output high "S;s# the capacitor (& is charged by current flowing through R&

    and RB. The threshold and trigger inputs monitor the capacitor voltage and when it

    reaches B>;s "threshold voltage# the output becomes low and the discharge pin is

    connected to ';.

    +ig 2.11

    The capacitor now discharges with current flowing through RB into the discharge pin.

    )hen the voltage falls to &>;s "trigger voltage# the output becomes high again and the

    discharge pin is disconnected allowing the capacitor to start charging again.

    This cycle repeats continuously unless the reset input is connected to '; which forces the

    output low while reset is ';.

    An astable can be used to provide the cloc$ signal for circuits such as counters.

    A low fre+uency astable "U &'6z# can be used to flash an 9/ on and off higher

    fre+uency flashes are too fast to be seen clearly. /riving a loudspea$er or piezo

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    transducer with a low fre+uency of less than B'6z will produce a series of clic$s "one

    for each lowhigh transition# and this can be used to ma$e a simple metronome.

    An audio fre+uency astable "B'6z to B'$6z# can be used to produce a sound from aloudspea$er or piezo transducer. The sound is suitable for buzzes and beeps. The natural

    "resonant# fre+uency of most piezo transducers is about >$6z and this will ma$e themproduce a particularly loud sound.

    Dut0 c0cle

    The duty cycle of an astable circuit is the proportion of the complete cycle for which the

    output is high "the mar$ time#. It is usually given as a percentage.

    =or a standard %%%%%E astable circuit the mar$ time "Tm# must be greater than the space

    time "Ts# so the duty cycle must be at least %'W7

    uty cycle 0T'

    T' 9 Ts

    R1 9 R2

    R1 9 2R2

    ;

    Fig4..1.2shows the ### timer in astable operation with )2.

    To achie6e a (t5 c5cle of less than -0

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    T' 0.4 = R1 = C1 ignoring .&5 across diodeTs 0.4 = R2 = C1 unchanged

    (t5 c5cle ith (io(e 0T'

    T' 9 Ts

    R1

    R1 9 R2

    7.4.2 555 Monostab!

    Fig: 4..2.0* monostable circuit produces a single output pulse when triggered. -t is calleda monostable because it is stable in just one state 6output low6. (he 6outputhigh6 state is temporary.

    (he duration of the pulse is called the time period ( and this is determinedby resistor )1 and capacitor C1

    time period, T 1.1 = R1 = C1

    ( 0 time period in seconds s)1 0 resistance in ohms C1 0 capacitance in farads 7(he ma$imum reliable time period is about 1 minutes.

    ### monostable output, a single pulse

    ### monostable circuit with manual trigger

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Choose C1 firstthere are relati'ely few 'alues a'ailable.

    Fig 4..2.1

    (hoose R& to give the time period you need. R& should be in the range &$ to

    &: so use a fi!ed resistor of at least &$ in series if R& is variable.

    5eware that electrolytic capacitor values are not accurate1 errors of at least B'W

    are common.

    5eware that electrolytic capacitors lea$ charge which substantially increases the

    time period if you are using a high value resistor - use the formula as only a very

    rough guideX

    2.!1 &onosta=le o"erationThe timing period is triggered "started# when the trigger input "%%% pin B# is less than&>;s this ma$es the output high "S;s# and the capacitor (& starts to charge throughresistor R&.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    The reset input "%%% pin C# overrides all other inputs and the timing may be cancelled at

    any time by connecting reset to '; this instantly ma$es the output low and discharges the

    capacitor. If the reset function is not re+uiredthe reset pin should e connected to S;s.

    7.4.3 555"55# In$!%ting &'((!% )S*+,itt t%igg!%- o% NOT gat!

    Fig: 4..3.0the buffer circuits input has a very high impedance "about &: # so it re+uires only a fewKA but the output can sin$ or source up to B''mA. This enables a high impedance signal

    source "such as an 9/R# to switch a low impedance output transducer "such as a lamp#.

    It is an inverting buffer or@;s# ma$es output high S;s

    Input high "J B>;s# ma$es output low ';

    )hen the input voltage is between &>andB>;s the output remains in its present state.

    This intermediate input region is a dead space where there is no response a property

    called hysteresis it is li$e bac$lash in a mechanical lin$age. This type of circuit is called

    a 2chmitt trigger.

    If high sensitivity is re+uired the hysteresis is a problem but in many circuits it is a

    helpful property. It gives the input a high immunity to noise because once the circuit

    ### in'erting buffer circuita 8( gate

    8( gate symbol

    http://www.kpsec.freeuk.com/gates.htm#nothttp://www.kpsec.freeuk.com/gates.htm#not
  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    output has switched high or low the input must change bac$ by at least &>;s to ma$e the

    output switch bac$.

    7.4.5 555 timer to modulate infrared (IR) light

    An IR emitter is going to be modulated using an astable %%% timer in this electronics

    e!ercise. The IR emitter needs to be modulated by a fre+uency of >, $6z since the

    detector used in this e!ercise only detects >, $6z modulated IR. The detector is set to

    only see >, $6z modulated IR because there are random IR sources such as overhead

    lights the sun heaters etc. in most environments that can cause interference if using un-

    modulated IR.

    The following two circuits shown in =ig.C and =ig. % are modulated IR

    transmitter and receivers. ach circuit should be soldered on separate proto-boards.

    Fig. 7.4.5.0 modulated IR transmitter

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Fig.7.4.5.1 modulated IR receiver

    ;erify with the TA that everything is soldered correctly. Then apply

    power to the transmitter circuit. 8se an oscilloscope to observe the signal at node A.

    Adjust the &'$Y variable resistor until the signal at node A is a >, $6z series of pulses.

    Apply power to the receiver circuit Point the IR light emitting diode "9/# on the

    transmitter to the detector on the receiver. )hen the pushbutton is depressed the visible

    9/ on the receiver should blin$. If the visible led is blin$ing randomly put e!posed >%

    mm camera film around the IR detector.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    $tepper 'otor

    4.-.1 Description:

    A stepper motor "or step motor# is abrushless synchronous electric motorthat

    can divide a full rotation into a large number of steps. The motors position can be

    controlled precisely without any feedbac$ mechanism "see open loopcontrol#. 2tepper

    motors are similar to switched reluctance motors"which are very large stepping motors

    with a reduced pole count and generally are closed-loop commutated#.

    +ig 2/11

    7.5.2 Fundamentals of Operation

    2tepper motors operate differently from normal /( motors which rotate when voltage is

    applied to their terminals. 2tepper motors on the other hand effectively have multiple

    ?toothed? electromagnets arranged around a central gear-shaped piece of iron. The

    electromagnets are energized by an e!ternal control circuit such as a microcontroller. To

    ma$e the motor shaft turn first one electromagnet is given power which ma$es the gears

    teeth magnetically attracted to the electromagnets teeth. )hen the gears teeth are thus

    aligned to the first electromagnet they are slightly offset from the ne!t electromagnet. 2o

    when the ne!t electromagnet is turned on and the first is turned off the gear rotates

    slightly to align with the ne!t one and from there the process is repeated. ach of those

    slight rotations is called a ?step? with an integral number of steps ma$ing a full rotation.

    In that way the motor can be turned by a precise angle.

    http://en.wikipedia.org/wiki/Brushless_DC_electric_motorhttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Open_loophttp://en.wikipedia.org/wiki/Reluctance_motorhttp://en.wikipedia.org/wiki/Brushless_DC_electric_motorhttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Open_loophttp://en.wikipedia.org/wiki/Reluctance_motor
  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    7.5.3 Stepper motor characteristics

    2tepper motors are constant power devices. As motor speed increases tor+ue decreases.

    The tor+ue curve may be e!tended by using current limiting drivers and increasing the

    driving voltage. 2teppers e!hibit more vibration than other motor types as the discrete

    step tends to snap the rotor from one position to another. This vibration can become very

    bad at some speeds and can cause the motor to lose tor+ue. The effect can be mitigated by

    accelerating +uic$ly through the problem speed range physically damping the system or

    using a micro-stepping driver. :otors with a greater number of phases also e!hibit

    smoother operation than those with fewer phases.

    7.5.4 Open-loop versus closed-loop commutation

    2teppers are generally commutated open loop i.e. the driver has no feedbac$ on where

    the rotor actually is. 2tepper motor systems must thus generally be over engineered

    especially if the load inertia is high or there is widely varying load so that there is no

    possibility that the motor will lose steps. This has often caused the system designer to

    consider the trade-offs between a closely sized but e!pensive servomechanism system

    and an oversized but relatively cheap stepper.

    A new development in stepper control is to incorporate a rotor position feedbac$ "eg. an

    encoderor resolver# so that the commutation can be made optimal for tor+ue generation

    according to actual rotor position. This turns the stepper motor into a high pole count

    brushless servo motor with e!ceptional low speed tor+ue and position resolution. An

    advance on this techni+ue is to normally run the motor in open loop mode and only enter

    closed loop mode if the rotor position error becomes too large -- this will allow the

    system to avoid hunting or oscillating a common servo problem.

    http://en.wikipedia.org/wiki/Servomechanismhttp://en.wikipedia.org/wiki/Encoderhttp://en.wikipedia.org/wiki/Resolverhttp://en.wikipedia.org/wiki/Servomechanismhttp://en.wikipedia.org/wiki/Encoderhttp://en.wikipedia.org/wiki/Resolver
  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    7.5.5 Types

    There are three main types of stepper motors7

    Permanent :agnet 2tepper

    6ybrid 2ynchronous 2tepper

    ;ariable Reluctance 2tepper

    Two-phase stepper motors

    (here are two basic winding arrangements for the electromagnetic coils in a

    two phase stepper motor bipolar and unipolar.

    Uni"olar *otors

    A unipolar stepper motor has logically two windings per phase one for each direction of

    magnetic field. 2ince in this arrangement a magnetic pole can be reversed without

    switching the direction of current the commutation circuit can be made very simple "e.g.

    a single transistor# for each winding. Typically given a phase one end of each winding is

    made common7 giving three leads per phase and si! leads for a typical two phase motor.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    In the construction of unipolar stepper motor there are four coils. . half coil e!citation

    8nipolar stepper motors with si! or eight wires may be driven using bipolar drivers by

    leaving the phase commons disconnected and driving the two windings of each phase

    together Zdiagram needed[. It is also possible to use a bipolar driver to drive only one

    winding of each phase leaving half of the windings unused Zdiagram needed[.

    Bi"olar *otor

    5ipolar motors have logically a single winding per phase. The current in a winding needs

    to be reversed in order to reverse a magnetic pole so the driving circuit must be more

    complicated typically with an 6-bridge arrangement. There are two leads per phase

    none are common.

    2tatic friction effects using an 6-bridge have been observed with certain drive topologies

    5ecause windings are better utilized they are more powerful than a unipolar motor of the

    same weight.

    http://en.wikipedia.org/wiki/H-bridgehttp://en.wikipedia.org/wiki/H-bridge
  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    38lea) ste""er

    An , lead stepper is wound li$e a unipolar stepper but the leads are not joined to

    common internally to the motor. This $ind of motor can be wired in several

    configurations7

    8nipolar.

    5ipolar with series windings. This gives higher inductance but lower current per

    winding.

    5ipolar with parallel windings. This re+uires higher current but can perform better

    as the winding inductance is reduced.

    5ipolar with a single winding per phase. This method will run the motor on only

    half the available windings which will reduce the available low speed tor+ue but

    re+uire less current.

    7.5.6 Theory

    A step motor can be viewed as a synchronous A( motor with the number of poles "on

    both rotor and stator# increased ta$ing care that they have no common denominator.

    Additionally soft magnetic material with many teeth on the rotor and stator cheaply

    multiplies the number of poles "reluctance motor#. :odern steppers are of hybrid design

    having both permanent magnets and soft iron cores.

    To achieve full rated tor+ue the coils in a stepper motor must reach their full rated

    currentduring each step. )inding inductance and reverse := generated by a moving

    rotor tend to resist changes in drive current so that as the motor speeds up less and less

    time is spent at full current -- thus reducing motor tor+ue. As speeds further increase the

    current will not reach the rated value and eventually the motor will cease to produce

    tor+ue.

    http://en.wikipedia.org/wiki/Current_(electricity)http://en.wikipedia.org/wiki/Current_(electricity)
  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    (ull8in tor>ue

    This is the measure of the tor+ue produced by a stepper motor when it is operated without

    an acceleration state. At low speeds the stepper motor can synchronize itself with an

    applied step fre+uency and this Pull-In tor+ue must overcome friction and inertia.

    (ull8out tor>ue

    The stepper motor Pull-

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    2teppers should be sized according to published tor+ue curve which is specified by the

    manufacturer at particular drive voltages andor using their own drive circuitry. It is not

    guaranteed that you will achieve the same performance given different drive circuitry so

    the pair should be chosen with great care.

    +ig 2/54

    2/2 R(& calculation:8

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    In same manner as you change delay the PR= will be changed and it will change RP:\

    2/3 A""lications

    (omputer-controlled stepper motors are one of the most versatile forms of positioning

    systems. They are typically digitally controlled as part of an open loop system and aresimpler and more rugged than closed loopservosystems.

    Industrial applications are in high speed pic$ and place e+uipment and multi-a!is

    machine(@(machines often directly driving lead screwsorball screws. In the field of

    lasers and optics they are fre+uently used in precision positioning e+uipment such aslinear actuators linear stages rotation stages goniometers and mirror mounts.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    LCD )is"la0

    25 Descri"tion:

    9i+uid crystal display "9(/# has material which combines the properties of both li+uid

    and crystals. They have a temperature range within which the molecules are almost as

    mobile as they would be in a li+uid but are grouped together in an order form similar to a

    crystal

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    +ig:2/24

    More

    Control Signals It?s #unction

    R)M ' )rites character in display

    M & Reads from display

    R2/I

    M ' 2elects command register

    M & 2elects /ata register to display

    character

    n

    M ' /isables the display

    M & nables the displa

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Fig:7.5.7.1

    microcontroller devices are using smart 9(/ displays to output visual information. The

    following discussion covers the connection of a 6itachi 9(/ display to a PI(

    microcontroller. 9(/ displays designed around 6itachis 9(/ 6/CCD,' module are

    ine!pensive easy to use and it is even possible to produce a readout using the , ! ,'

    pi!els of the display. 6itachi 9(/ displays have a standard A2(II set of characters plus

    ]apanese *ree$ and mathematical symbols.

    This display contains two internal byte-wide registers one for command and

    second for characters to be displayed. There are three control signals called R) /IR2

    and n. The table given below will tell you what the use of these three signals is.

    5y ma$ing R2/I signal ' you can send different commands to display. These commands

    are used to initialized 9(/ to select display pattern to shift cursor or screen etc. The

    different commands and their functions are as given below

    =or an ,-bit data bus the display re+uires a S%; supply plus && I< lines. =or a

    C-bit data bus it only re+uires the supply lines plus seven e!tra lines. )hen the 9(/

    display is not enabled data lines are tri-state which means they are in a state of high

    impedance "as though they are disconnected# and this means they do not interfere with

    the operation of the microcontroller when the display is not being addressed.

    The 9(/ also re+uires > ?control? lines from the microcontroller.

    nable "# This line allows access to the display through R) and R2 lines. )hen this line

    is low the 9(/ is disabled and ignores signals from R) and R2. )hen "#

    line is high the 9(/ chec$s the state of the two control lines and responds

    accordingly.

    Read)rite "R)# This line determines the direction of data between the 9(/ and

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    microcontroller. )hen it is low data is written to the 9(/. )hen it is high

    data is read from the 9(/.Register select

    "R2#

    )ith the help of this line the 9(/ interprets the type of data on data lines.

    )hen it is low an instruction is being written to the 9(/. )hen it is high a

    character is being written to the 9(/.

    5its

    R2/IR) /D /E /% /C /> /B /& /'=unction

    ' ' ' ' ' ' ' ' ' & (lear 9(/ memory 6ome cursor

    ' ' ' ' ' ' ' ' & ' (lear and 6ome cursor only

    ' ' ' ' ' ' ' & I< ss M &' 7 2hift screencursor I< M &'

    7 shift R9

    ' ' ' ' ' ' & / ( 5

    / M &' 7 2creen

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    and writing characters from left to right. )hen the 9(/ is initialized it is ready to

    continue receiving data or instructions. If it receives a character it will write it on the

    display and move the cursor one space to the right. The (ursor mar$s the ne!t location

    where a character will be written. )hen we want to write a string of characters first we

    need to set up the starting address and then send one character at a time. (haracters that

    5efore we access // RA: after defining a special character the program must set the

    // RA: address. )riting and reading data from any 9(/ memory is done from the last

    address which was set up using set-address instruction.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    2tandard Type

    )or$s with almost any :icrocontroller

    *reat ;alue Pricing

    :a!imum input voltage7 %.>;/(

    .C?9 ! &.B?) ! '.%?T

    '*=e))e) C Co*"iler7

    A@2I ( - full featured and portable

    Reliable - mature field-proven technology

    :ultiple ( optimization levels

    An optimizing assembler

    =ull lin$er with overlaying of local variables to minimize RA: usage

    (omprehensive ( library with all source code provided

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Includes support for BC-bit and >B-bit I floating point and >B-bit long data

    types

    :i!ed ( and assembler programming

    8nlimited number of source files

    9istings showing generated assembler

    Runs on multiple platforms7 )indows 9inu! 8@I :ac

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Ca"a=ilit0:ou can do things in assembly which are difficult or impossible in

    6igh-level languages.

    Si*ulator:

    2imulator is a machine that simulates an environment for the purpose of training or

    research.

    Co*"iler:A compiler is a program that reads a program in one language the source

    language and translates into an e+uivalent program in another language the target

    language. The translation process should also report the presence of errors in the source

    program.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Chapter !

    $OFT")R# !ROGR)//ING

    So#tware

    1 "rogra* #or gate control9 track changing9 an) two rains o""osite case7

    _includeUreg%&.hJ

    void :2/elay "unsigned int value#1

    sbit sense&MP&`'1

    sbit senseBMP&`&1

    sbit buz&MP&`C1

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    sbit buzBMP&`%1

    sbit ledMPB`D1

    void main "#

    int i1

    P&M'!f'1

    buz&M'1

    buzBM'1

    ledM'1

    while "

    if "sense&MM& HH senseBXM

    buz&M&1

    ledM&1

    for "iM'1iUMB1iSS#

    PBM'!EE1

    :2/elay "&'#1

    PBM'!((1

    :2/elay "&'#1

    PBM'!1

    :2/elay "&'#1

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    PBM'!>>1

    :2/elay "&'#1

    sense&M'1

    if "senseBMM& HH sense&XM

    buz&M'1

    ledM'1

    for "iM'1 iUMB1iSS#

    PBM'!EE1

    :2/elay "&'#1

    PBM'!>>1

    :2/elay "&'#1

    PBM'!1

    :2/elay "&'#1

    PBM'!((1

    :2/elay "&'#1

    for"iM'1iUMB1iSS#

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    P'M'!EE1

    :2/elay "&'#1

    P'M'!((1

    :2/elay "&'#1

    P'M'!1

    :2/elay "&'#1

    P'M'!>>1

    :2/elay "&'#1

    senseBM'1

    if "sense&MM& HH senseBMM

    buzBM&1

    :2/elay "B''#1

    buzBM'1

    sense&M'1

    senseBM'1

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    void :2/elay "unsigned int value#

    unsigned int !y1

    for"!M'1 !U&BD%1!SS#

    for"yM'1yUvalue1ySS#1

    ! "rogra* #or )is"la0ing *essage on LCD7

    _includeUreg%&.hJ

    _includeUstdio.hJ

    _include Ustring.hJ

    void lcdcmd "unsigned char value#1

    void lcddata "unsigned char value#1

    void :2/elay "unsigned int time#1

    void /isp:sg "char V/isp#1

    void /isp(har "char (6AR#1

    sfr ldataM'!'1

    sbit rsMPB`'1

    sbit rwMPB`&1

    sbit enMPB`B1

    sbit senseMPB`%1

    sbit ledMPB`D1

    void main "#

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    unsigned char str ZB'[ str& ZB'[1

    int a b total1

    aMB1 bM%1

    totalMaVb1

    P'M'!''1

    sprintf"str&?TRAI@ I2 (

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    senseM'1

    if "sensesMM

    lcdcmd "'!,'#1

    :2/elay "B%#1

    /isp:sg "str

    lcdcmd "'!c%#1

    lcdcmd "'!c'#1

    :2/elay "B%#1

    /isp:sg "str#1

    :2/elay "B%'#1

    :2/elay "B%''#1

    senseM'1

    void lcdcmd "unsigned char value#

    ldataMvalue1

    rsM'1

    rwM'1

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    enM&1

    :2/elay "

    enM'1

    return1

    void lcddata "unsigned char value#

    ldataMvalue1

    rsM&1

    rwM'1

    enM&1

    :2/elay "

    enM'1

    return1

    void :2/elay "unsigned int itime#

    unsigned int ij1

    for"iM'1iUitime1iSS#

    for "jM'1jU&''1jSS#1

    void /isp:sg "char V/isp#

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    while "V/isp#

    /isp(har "V/ispSS#1

    void /isp(har "char (6AR#

    lcddata "(6AR#1

    Conclsion:

    A new approach for improving safety at 9(s on IR has been suggested. =ormats have

    been given to maintain records of 9( inventories accidentincident reports. ach 9(

    should be assigned a hazard rating and the priority of safety enhancement wor$s be

    decided accordingly. A regular assessment of safety performance should be done. This

    approach should be able to bring down the rising trend in accidents at 9(s.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    Sco"e o# "ro$ect

    This project is developed in order to help the I@/IA@ RAI9)A2 in ma$ing its

    present wor$ing system a better one by eliminating some of the loopholes e!isting in

    it.

    5ased on the responses and reports obtained as a result of the significant development

    in the wor$ing system of I@/IA@ RAI9)A2 this project can be further e!tended

    to meet the demands according to situation.

  • 5/28/2018 p 7719 Automatic Control of Railway Gate Control

    This can be further implemented to have control room to regulate the wor$ing of the

    system. Thus becomes the user friendliness.

    This circuit can be e!panded and used in a station with any number of platforms as

    per the usage.

    Additional modules can be added with out affecting the remaining modules. This

    allows the fle!ibility and easy maintenance of the developed system.

    This system consists of following features over manual system7

    There is no time lag to operate the device.

    Accuracy.

    2imulation is provided to reflect the present status of the system.

    nd user can operate this without $nowing about electronics.

    References:

    1. Kenneth.J.AyalaThe 89C51 Microcontroller Architecture

    programming and Applications, en ram !nternational.

    2. ".#oychoudary and $ail Jain%.!.C, &e' Age !nternational.

    3. (rinciples o) *lectronics +y .K.M*-TA.

    4. (Communication $ystems +y $imon -a'ins.