automatic railway gate controll

Upload: rajesh-chandan

Post on 14-Apr-2018

241 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Automatic Railway Gate Controll

    1/47

    MICROCONTROLLER BASED AUTOMATIC RAILWAY GATE CONTROL

    INTRODUCTION:-The objective of this paper is to provide an automatic railway gate at a

    level crossing replacing the gates operated by the gatekeeper. It deals

    with two things. Firstly, it deals with the reduction of time for which the

    gate is being kept closed And secondly, to provide safety to the road

    users by reducing the accidents.

    By the presently existing system once the train leaves the station, the

    stationmaster informs the gatekeeper about the arrival of the trainthrough the telephone. Once the gatekeeper receives the information, he

    closes the gate depending on the timing at which the train arrives.

    Hence, if the train is late due to certain reasons, then gate remain closed

    for a long time causing traffic near the gates.

    By employing the automatic railway gate control at the level crossing

    the arrival of the train is detected by the sensor placed near to the gate.

    Hence, the time for which it is closed is less compared to the manually

    operated gates and also reduces the human labor. This type of gates canbe employed in an unmanned level crossing where the chances of

    accidents are higher and reliable operation is required. Since, the

    operation is automatic error due to manual operation is prevented.

    Automatic railway gate control is highly economical microcontroller

    based arrangement, designed for use in almost all the unmanned level

    crossings in the country.

    In this paper we are concerned of providing an automatic railway gate

    control at unmanned level crossings replacing the gates operated by gate

    keepers and also the semi automatically operated gates. It deals with two

    things. Firstly, it deals with the reduction of time for which the gate is

    being kept closed. And secondly, to provide safety to the road users by

    reducing the accidents that usually occur due to carelessness of road

    users and at times errors made by the gatekeepers.

  • 7/30/2019 Automatic Railway Gate Controll

    2/47

    By employing the automatic railway gate control at the level crossing

    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 then MC activate the gate

    motor to close the gate automatically after crossing the level cross at thattime train sensed the second sensor second sensor then sensor send a

    signal to MC then MC again activate the motor to open the level

    crossing gate.

    BLOCK DIAGRAM OF THIS PROJECT

  • 7/30/2019 Automatic Railway Gate Controll

    3/47

    This project contain 7 section ie

    1.Power supply section

    2.Motor driver section

    3.Motherboard section

    4.Relay driver section

    5.Buzzer driver section

    6.IR transmitter section

    7.IR receiver section

    8.NOT gate section

  • 7/30/2019 Automatic Railway Gate Controll

    4/47

    COMPONENTS USED IN POWER SUPPLY CIRCUIT

    COMPONENTS NAME SPECIFICATION

    Diode IN4007

    Capacitor 1000f,25V

    Resistor 1.5k quarter watt

    Regulator IC 7812,7805

    COMPONENTS USED IN IR SENSOR

    COMPONENTS NAME SPECIFICATION

    Transistor BC 547

    IC LM393

    Resistor 1K ,10K

    PHOTO DIODE

    LED

  • 7/30/2019 Automatic Railway Gate Controll

    5/47

    COMPONENTS USED IN RELAY DRIVER CIRCUIT

    COMPONENTS NAME SPECIFICATION

    Transistor BC 547

    PCB PRINTED CKT BOARD

    Resistor 1.5k

    Diode IN4007

    RELAY

    COMPONENTS NAME SPECIFICATION

    Relay 12v,10amp

    TRANSFORMER

    COMPONENTS NAME SPECIFICATION

    Transformer Step down 230V-12V

    0-12,1A

  • 7/30/2019 Automatic Railway Gate Controll

    6/47

    CIRCUIT DESCRIPTION

    4.1 POWER SUPPLY(+ive)

    Circuit connection: - In this we are using Transformer (0-12) v,1Amp,LED & resistors. Here 230V, 50 Hz ac signal is given as

    input to the primary of the transformer and the secondary of thetransformer is given to the bridge rectification diode.

    Circuit Explanations: - When ac signal is given to the primary ofthe transformer, due to the magnetic effect of the coil magneticflux is induced in the coil(primary) and transfer to the secondarycoil of the transformer due to the transformer action. Transformeris an electromechanical static device which transformer electrical

    energy from one coil to another without changing its frequency.Here the diodes are connected in a bridge fashion. Thesecondary coil of the transformer is given to the bridge circuit forrectification purposes. During the +ve cycle of the ac signal thediodes D2 & D4 conduct due to the forward bias of the diodes anddiodes D1 & D3 does not conduct due to the reversed bias of thediodes. Similarly during the ve cycle of the ac signal the diodesD1 & D3 conduct due to the forward bias of the diodes and thediodes D2 & D4 does not conduct due to reversed bias of thediodes. The output of the bridge rectifier is not a power dc alongwith rippled ac is also present. To overcome this effect, acapacitor is connected to the o/p of the diodes (D2 & D3). Whichremoves the unwanted ac signal and thus a pure dc obtained.Here we need a fixed voltage, thats for we are using ICregulators. The o/p of the bridge rectifier is given as input to theIC regulator through capacitor with respect to GND and thus afixed o/p is obtained. The o/p of the IC regulator (7805 & 7812) is

    given to the LED for indication purpose through resistor. Due tothe forward bias of the LED, the LED glows ON state, and the o/pare obtained .

  • 7/30/2019 Automatic Railway Gate Controll

    7/47

    POWER SUPPLY CIRCUIT

  • 7/30/2019 Automatic Railway Gate Controll

    8/47

    4.2LED INDICATOR

    The indicator section consists of a light emitting diode andits driver circuit is designed on the basis of current

    required to glow the light emitting diode. Here the drivercircuit is required for the following functionality. TheMicrocontroller cannot provide adequate current forglowing the LED. The LEDs requires a current between10mA to 20mA of current to glow. The driver circuitprovides current to the load from a separate source, sothe load current used not pass through theMicrocontroller.

  • 7/30/2019 Automatic Railway Gate Controll

    9/47

    IR TRANSMITTER (transmitter zone)

    The IR LED is also light emitting diode but the

    junction is made out of such material that the transitionof electron between the bands emits quanta of energy(

    E=h) having a particular frequency which is having aparticular characteristic. When a diode emits aparticular characteristic signal having frequency in therange of infrared then, that diode is called a infraredemitting diode. The IR data transmitter is a highintensity IR signal transmitter. There are two diodes

    connected in parallel to increase the intensity to avoiddata corruption receiver end. In this section our aim isto protect the zone/door/almira etc. from theunauthorized entry or interruption, for that we needsome element that should not be visible to theunauthorized person. For that we have taken elementsas IR LED as a source and photo diode as a

    destination. Generally, we have taken IR because IR isinvisible to the eye, where as in case of LASER, whichis easily visible to the human eye by which will, alert theunauthorized person. That is why we have taken IR asa transmitter which will transmit a continuously IRsignal. At the receiver end the photodiode will receivethe IR signal. if somebody tries to interrupt the IR signal

    at the transmitter end, the receiver will decide theabsence of the IR signal at the receiver end.

  • 7/30/2019 Automatic Railway Gate Controll

    10/47

    Operation

    IR transmitter consist of resister ,IR diode and connected

    according above the fig. when the +Ve 12 V is fed to the IR

    diode through 150E resistor ir diode get +ve from DC supply

    and also IR diode get Ve from Ve terminal of DC voltage.

    When IR diode gets +Ve andVE then it transmit a IR beam .

  • 7/30/2019 Automatic Railway Gate Controll

    11/47

    4.2 IR RECEIVER

    Introduction

    A PHOTO DIODE is light sensitive device the junction ofthe photo diode is such that it generates carriers whenthe light falls on it. There are different type of diodes,which generates carriers in different magnitudes atdifferent frequency this depends on the nature and dopingof the junction. The liberation of carriers are very small in

    magnitude which is very much dependant on thefrequency and intensity of the light signal falling on the

    junction. In the forward biased condition the majoritycarrier current is so high that the current generated due tofall of light signal is very negligible. The photonbombardment cause the avalanche break down of the

    junction and generate current which is in the order of 100s

    micro ampere to few 10s of mA, due to the abovementioned causes the photo diodes to connected in thereverse biased condition. In the reverse biased conditionthe normal current is always in the order of fewmicroamperes, the current generated due to fall of lightsignal on the junction is also in the order of microampereso the net current through the diode is appreciablyincreased. The same current pass through the resistance

    connected in series and drop across the resistance isincreased. There are two types of arrangements verymuch widely used in the circuits, as shown in the Fig.1and Fig.2.

  • 7/30/2019 Automatic Railway Gate Controll

    12/47

    If the diode junction is exposed with visible light or invisiblelight like Infrared / Laser in the circuit shown in fig.2, thediode current will rise, possibly to as high as 1mA,producing a significant output across R. In use, thephotodiode is reversed biased and the output voltage istaken from across a series-connected load resistor.

    CIRCUIT DIAGRAM OF IR RECEIVER

    R

    VCC

    D1 Vout

    D1

    Vout

    Fig.1

    R

    VCC

    Fig.2

  • 7/30/2019 Automatic Railway Gate Controll

    13/47

    Operation

    In this project in the data receiving section, the photodiode

    is used as signal (data) detector purpose to detect the IRsignal (data) from the IR transmitter LED section.Whenever the signal is transmitted from the IR transmitterLED, the signal is received at the photodiode receivingsection. The receiving signal is very weak in strength, forthat we used an amplifier. The output of the photodiode isgiven as input to the amplifier (Op-amp LM351) through a

    filtering capacitor (0.01uF) which is configured as anComparator and the reference voltage is set at non-inverting terminal of the operational Amplifier. There is a10K variable resistor which is connected between +5 Voltand Ground and the variable terminal is connected to theOP-AMP for providing the Threshold value. The output ofthe LM351 swings in between +Vsat andVsat, even fora small variation of signal across the threshold value. Thatoutput signal is not Compatible with the Micro controllerbecause of the high current; that output from the Op-ampis given to the signal conditioning i.e. the signal is given tothe base of the Transistor through a base resistancebetween 1K 43K and the collector is connected to Vcc=+5Volt in series with a 10K resistance and the output istaken from the collector. The emitter is grounded. The

    transmitted data is received at the receiving section. Thetransmitted signal must fall pin pointed to the photodiode

    junction in order to receive the Signal.

  • 7/30/2019 Automatic Railway Gate Controll

    14/47

    RELAY DRIVER :

    A relay is an electrically operated switch. Many relaysuse an electromagnet to operate a switching mechanism, but

    other operating principles are used. Relays find applications

    where it is necessary to control a circuit by a low-power

    signal, or where several circuits must be controlled by one

    signal. The first relays were used in long distance telegraph

    circuits, repeating the signal coming in from one circuit and

    re-transmitting it to another. Relays found extensive use in

    telephone exchanges and early computers to perform logical

    operations. A type of relay that can handle the high power

    required to directly drive an electric motor is called a

    contractor. Solid-state relays control power circuits with no

    moving parts, instead using a semiconductor device

    triggered by light to perform switching. Relays with

    calibrated operating characteristics and sometimes multiple

    operating coils are used to protect electrical circuits fromoverload or faults; in modern electric power systems these

    functions are performed by digital instruments still called

    "protection relays".

    http://en.wikipedia.org/wiki/Electrichttp://en.wikipedia.org/wiki/Electrichttp://en.wikipedia.org/wiki/Switchhttp://en.wikipedia.org/wiki/Switchhttp://en.wikipedia.org/wiki/Contactorhttp://en.wikipedia.org/wiki/Contactorhttp://en.wikipedia.org/wiki/Switchhttp://en.wikipedia.org/wiki/Electric
  • 7/30/2019 Automatic Railway Gate Controll

    15/47

    Relay Switch Characteristics

    Relays provide a way for one electric current to

    control another electric current.

    Switches control the flow of electricity, and relays areswitches that are operated by the flow of electricity.

    Relays are devices whereby one electric current can

    control another electric current. The control part of a

    relay is just an electromagnet. The switch part of the

    relay is a metal piece that can be moved by the

    electromagnet to close a circuit. Relays can becharacterized by poles and throws like any switch, as

    well as by other characteristics.

    Poles and Throws

    Like all switches, relays are characterized by poles andthrows. Throws is really a way of saying how many

    different circuits the relay can control. If there is onethrow, the relay opens and closes one switch, and

    controls one circuit. Two throws indicates that the relay

    opens and closes two mechanically linked switches, and

    so controls two circuits. Poles are the number of current

    carrying positions the switches can be in. A single pole

    switch only opens and closes a circuit. A double pole

    switch diverts a current into one of two possible paths.Both poles and throws are usually only one or two, but

    higher numbers are sometimes seen.

    http://i.ehow.co.uk/images/a06/u8/dh/relay-switch-characteristics-1.1-800X800.jpghttp://i.ehow.co.uk/images/a06/u8/dh/relay-switch-characteristics-1.1-800X800.jpghttp://i.ehow.co.uk/images/a06/u8/dh/relay-switch-characteristics-1.1-800X800.jpghttp://i.ehow.co.uk/images/a06/u8/dh/relay-switch-characteristics-1.1-800X800.jpghttp://i.ehow.co.uk/images/a06/u8/dh/relay-switch-characteristics-1.1-800X800.jpg
  • 7/30/2019 Automatic Railway Gate Controll

    16/47

    Normally Open or Closed

    Single pole relays are characterized as normally open ornormally closed. This refers to the position of the switch

    when the electromagnet is not activated. If the relay isnormally open, activating the electromagnet will close

    the switch and activate another circuit. If the relay is

    normally closed, some circuit is active and activating

    the electromagnet will deactivate this previously active

    circuit. Normally open relays are found when a tiny

    current is used to control a bigger current; activating

    the electromagnet closes the switch that carries thelarger current. Normally closed relays are found in

    burglar alarms, with the circuits that controls the

    electromagnet that holds the switch open running

    through the doors and windows of a home. When a door

    or window is opened, it stops the current to the

    electromagnet which causes the switch to close and sets

    off an alarm. Cutting the wires to this relay also sets offthe alarm.

    Latching Relays

    Latching relays are a way of making a switch with memory.The circuit that is controlled by a latching relay also runs

    through the electromagnet. When the electromagnet operates

    the normally open switch, it controls some circuit, but it also

    energizes the electromagnet. If the electromagnet is activated,even by a single pulse, it latches so it stays closed even when

    the original circuit that activated the switch is no longer active.

    The only way to unlatch the switch is to break, even

    temporarily, the circuit that includes the electromagnet.

  • 7/30/2019 Automatic Railway Gate Controll

    17/47

    Latching relays are used when machines are turned on and off

    by push buttons.

    Relay driver sectionRelay driver is consists of capacitor 10f, diode IN4007,

    resister and NPN transistor BC547 which is connected

    according the below diagram. Before going to the relay

    driver first we should know that about Relay. Relay is an

    electrical and electronics SWITCH which is ON and OFF by

    the help of voltage and current which depends upon

    transistor switching circuit and digital IC. Here transistoracts as a switching circuit .when the high voltage is fed to the

    base of the transistor through resister then the transistor is

    ON that means it conducts and the relay coil get +12V from

    the 12V power supply but it does not get the ve power

    supply so it cant be ON. When the transistor is ON then the

    relay gets VE power and the relay is ON. After getting VE

    power relay come out from its normal condition to the ON

    condition , which ON the device which is connected through

    the relay in other words which depends on relay for ON and

    OFF. Here diode and capacitor works for freewheeling

    purpose.

  • 7/30/2019 Automatic Railway Gate Controll

    18/47

    The above circuit is the relay driver by this above circuit we

    can on or off the relay easily.

    RELAY DRIVER

    This application is in some ways a continuation of he

    discussion introduced for diodes how the effects of inductive

    kick can be minimized through proper design. In the below

    figure (a), a transistor is used to established the current

    necessary to energize the relay in the collector circuit. With no

    input at the base of the transistor, the base current, collector

    current, and the coil current are essentially 0A, and the relaysits in the unenergized state (normally open, NO).

    However when a positive pulse is applied to the

    base, the transistor turns ON, establishing sufficient current

    through the coil of the electromagnet to close the relay.

    Problem can be now develop when the signal is removed from

    the base to turn OFF the transistor and de-energized the relay.

    Ideally, the current through he coil and the transistor will

    quickly drop to zero, the arm of the relay will be released, and

    the relay will simply remain dormant until the next ON signal.

    However we know from our basic circuit courses that the

    current through the coil cannot change instantaneously, and in

    fact the more quickly changes, greater the induced voltage

    across the coil as defined by,

    VL = L (diL / dt).

    In this case, the rapid changing current through the coil will

    develop a large voltage across the coil with the polarity shown

  • 7/30/2019 Automatic Railway Gate Controll

    19/47

    in figure (a), which will appear directly across the output of the

    transistor. The chances are likely that its magnitude will

    exceeds the maximum ratings of the transistor, and the

    semiconductor device will be permanently damaged. Thevoltage across the coil will not remain at its highest switching

    level but will oscillate as shown until its level drops to zero as

    the system settles down.

    The destructive action can be subdued by placing a diode

    across the coil as shown in below figure (b). During the ON

    state of the transistor, the diode is back biased: it sits like an

    open circuit and does not affect the thing. However, when thetransistor turns OFF, the voltage across the coil will reverse

    and will forward biased the diode, placing the diode in its ON

    state. The current through the inductor established during

    ON state of the transistor can then continue to flow through

    the diode, eliminating the severe change in current level.

    Because the inductive current is switched to diode almost

    instantaneously after the OFF state is established, the diodemust have a current rating to match the current through the

    inductor and the transistor when is in ON state. Eventually,

    because of the resistive elements in the loop, including the

    resistance of the coil windings and the diode, the high

    frequency (quickly oscillating) variation in voltage level across

    the coil will decay to zero and the system will settle down.

  • 7/30/2019 Automatic Railway Gate Controll

    20/47

    Overload Relays

    SIRIUS overload relays with screw-type, spring-loaded or

    ring cable lug connections reliably protect loads as well as

    other switching and protective devices in the respective load

  • 7/30/2019 Automatic Railway Gate Controll

    21/47

    feeder against overload, phase imbalance and phase failure.

    Thanks to ATEX certification, they can be used in many

    different applications, even under the particularly harsh

    conditions of the process industry. The overload relays caneasily be used with the contactors of the modular SIRIUS

    system.There are two versions of overload relays: thermal

    and electronic.

    In the main circuit, the SIRIUS 3RU thermal overload

    relays are responsible for current-dependent overload

    protection of electrical loads (e.g. motors). The 3RU2

    overload relays are available with spring-loaded, screw-type

    and ring cable lug connections - for a particularly flexible

    implementation. In the 3RU2 overload relays, the power

    losses are 5 to 10 % lower than for the previous models

    thanks to a new bimetal technology. Therefore, the

    temperature within the control cabinet can be reduced as

    well.

    The 3RB electronic overload relay ensures real commercial

    added value: In the main circuit, the electronic overload

    relays for standard applications are responsible for current-

    dependent overload protection of electrical loads (e.g.

    motors). Due to the wide current setting ranges, completeseries of motors are covered with just a few types. An

    electrical remote reset has been added to the already

    extensive basic functions of the 3RB31 version.

  • 7/30/2019 Automatic Railway Gate Controll

    22/47

    For demanding applications, a modular variant of the

    electronic overload relay even offers full motor protection

    by also sensing the temperature of the motor.

    In addition, optimized, uniform accessories are available for3RU2 and 3RB3. This reduces the costs for the ordering

    process and for maintaining stocks.

    Electronic overload relay SIRIUS 3RB24 for IO-Link

    With the new communication-capable electronic

    overload relay SIRIUS 3RB24 for IO-Link you can easily

    connect your load feeder to a higher-level control and

    therefore its integration in your automation environment. As

    the electronic overload relay supports the transmission of

    analog process variables like currents, system processes can

    be optimized, e.g. through load monitoring.Moreover, you will profit from an increased system

    availability and easier system documentation thanks to

    integrated diagnostic functions and readable parameter

    assignment. In combination with contactors, the overload

    relay can also be employed as direct, reversing and star-

    delta starter.

  • 7/30/2019 Automatic Railway Gate Controll

    23/47

    NOT GATE

    SIGNAL CONDITIONING

    The output form the input signal i.e. comparator or any

    other external circuit must be compatible with the -controller,

    because the -controller can takes 5V as input voltage and gives

    a 5V as output voltage. That for we need a signal conditioning

    circuit as given in the below figure.

  • 7/30/2019 Automatic Railway Gate Controll

    24/47

    (SIGNAL CONDITIONING)

    fig..1:1

    In the fig1: 1, whenever the base voltage is HIGH the

    transistor comes to saturation condition i.e. the collector current

    flows to the emitter which gives a high voltage at the outputcorresponding to Vcc given at the collector. The output is taken

    from the emitter junction through a current limiting resistance

    and the output signal is given to the - controller or any other

    circuit which needs a compatible (5V) voltage. Similarly,

    whenever the base voltage is LOW the emitter current flows

    from the emitter junction of the transistor, which gives a low

    voltage at the output corresponding to GND. The output is taken

    from the emitter junction through a current limiting resistance

    and the output signal is given to the - controller or any other

    circuit which needs a compatible (5V) voltage.

    fig..1:0

    BC5471.5k

    10k

    (1:0)

    CC= +5vCC= +5v

    (1:1)

    INPUT

    1.5k

    OUTPUT

    10kOUTPUT

    BC547

    INPUT

  • 7/30/2019 Automatic Railway Gate Controll

    25/47

    In the fig1: 0, whenever the base voltage is HIGH the

    transistor comes to saturation condition i.e. the emitter current

    flows to the collector which gives a low voltage at the output

    corresponding to GND. The output is taken from the collectorjunction through a current limiting resistance and the output

    signal is given to the - controller or any other circuit which

    needs a compatible (5V/0V) voltage. Similarly, whenever the

    base voltage is LOW the collector current flows from the

    collector junction of the transistor, which gives a high voltage at

    the output corresponding to Vcc. The output is taken from the

    emitter junction through a current limiting resistance and theoutput signal is given to the - controller or any other circuit

    which needs a compatible (5V/0V) voltage.

    The application of the transistors is not limited solely to the

    amplification of the signals. Through proper design transistors

    can be used as switches for computers and control applications.

    The network of figure-01 (a) can be employed as an inverter in

    computer logic circuitry. Note that the output voltage Vc is

    opposite to the applied to the base or input terminal. In

    addition note the absence of dc supply connected to the base

    circuit. The only dc source is connected to the collector or

    output side, and for computer applications is typically equal to

    the magnitude of the high side of the applied signal in this

    case 5V.

    IN

    Rc

    OUT

    Vcc = +5V

    Rb Q1

    BC547

    Vi

    t

    5v

    0v

    Vc

    t

    5v

    0v

  • 7/30/2019 Automatic Railway Gate Controll

    26/47

    OPERATION:

    Proper design for the inversion process requires that the

    operating points switch from cut-off to saturation along the

    load line depicted in above figure (b). For our proposes we will

    assume that IC = ICEO = 0mA, when IB = 0A (an excellent

    approximation in light of improving construction techniques),

    as shown in above figure (b). In addition, we will assume that

    VCE = VCE sat = 0V.

    When Vi = 5v, the transistor will be ON and design must

    insured that the network is heavily saturated by a level of IB

    greater than that associated if the IB curve appearing near the

    saturation level. In the above figure (b), this requires that IB >

    50A.

    IB = 0A

    IB = 10A

    IB = 20A

    IB = 40A

    IB = 60AIB = 80A

    Vcc = 5VVCE

    (b)

    IC sat = 6mA

    IC (mA)

  • 7/30/2019 Automatic Railway Gate Controll

    27/47

    The saturation level for the collector current for the circuit is

    defined by,

    IC= VCC/ RC

    The level of IB in the active region just before saturation resultscan be approximated by the following equation,

    IBmax ICsat / dc

    For the saturation level we must therefore insure that the

    following condition is satisfied:

    IB max >ICsat / dc

    For the network of the above figure (b), when Vi = 5v the

    resulting level of IB isIB = Vi0.7 / RB= 5v 0.7 / 1.5k

    = 2866A

    ICsat = VCC /RC

    = 5v / 10k

    = 0.5mA

    Testing the above equation gives:IB =2866A > ICsat / dc = 0.5mA / 300

    Which is satisfied. Certainly any level of IB greater than 2866A

    will pass through a Q- point on the load line that is very close to

    the vertical axis.

    INVERTER EXAMPLEAt saturation,

    ICsat = VCC/ RC

    10mA = 5V / RC

    RC = 5V / 10mA = 500

  • 7/30/2019 Automatic Railway Gate Controll

    28/47

    At saturation,

    IB ICsat / dc= 10mA / 300 = 33 A

    Choosing IB = 60A to ensure saturation and using,

    IB = Vi0.7V / RB

    RB = Vi 0.7V / IB

    = 5v 0.7v / 60A or 80A

    = 716k or 537k

    Choose RB = 720k or 560k which is a standard value. Then,

    IB = Vi0.7V / RBIB= Vi 0.7V / 720k or 560k

    = 4.3V / 720k or 560k

    = 59A or 76 A

    PIEZO ELECRTIC BUZZER:

    It is a device that converts electrical signal to an audible

    signal (sound signal).The Microcontroller cannot drive directly

    to the buzzer, because the Microcontroller cannot give sufficientcurrent to drive the buzzer for that we need a driver transistor

    (BC547), which will give sufficient current to the

    buzzer.Whenever a signal received to the base of the transistor

    through a base resistance (1.5k) is high, the transistor comes to

    saturation condition i.e. ON condition thus the buzzer comes to

    on condition with a audible sound. Similarly, whenever the

    signal is not received to the base of the transistor, thus thetransistor is in cut-off state i.e. is in OFF state thus the buzzer

    does not gets activated.

  • 7/30/2019 Automatic Railway Gate Controll

    29/47

    3 MOTHER BOARD:

    The motherboard of this project is designed with a MSC 51core compatible micro controller. The motherboard is designed

    on a printed circuit board, compatible for the micro controller.

    This board is consisting of a socket for micro controller, input

    /output pull-up registers; oscillator section and auto reset circuit.

    Microcontroller core processor:

    Introduction

    Despite its relatively old age, the 89C51 is one of the most

    popular Micro controller in use today. Many derivatives Micro

    controllers have since been developed that are based on--and

    compatible with--the 8051. Thus, the ability to program an

    BUZZER DRIVER

    1.5K

    BC547

    DATA

    INPUT

    BUZZER

    VCC

  • 7/30/2019 Automatic Railway Gate Controll

    30/47

    89C51 is an important skill for anyone who plans to develop

    products that will take advantage of Micro controller.

    Many web pages, books, and tools are available for the 89C51

    developer.

    The 89C51 has three very general types of memory. To

    effectively program the 8051 it is necessary to have a basic

    understanding of these memory types.

    The memory types are illustrated in the following graphic. They

    are: On-Chip Memory, External Code Memory, and External

    RAM.

    Fig-9 (Memory structure of Microcontroller)

    On-Chip Memory refers to any memory (Code, RAM, or other)

    that physically exists on the Microcontroller itself. On-chip

    memory can be of several types, but we'll get into that shortly.

    External Code Memory is code (or program) memory that

    resides off-chip. This is often in the form of an external

    EPROM.

  • 7/30/2019 Automatic Railway Gate Controll

    31/47

    External RAM is RAM memory that resides off-chip. This is

    often in the form of standard static RAM or flash RAM.

    Code Memory

    Code memory is the memory that holds the actual 8051 program

    that is to be run. This memory is limited to 64K and comes in

    many shapes and sizes: Code memory may be found on-chip,

    either burned into the Microcontroller as ROM or EPROM.

    Code may also be stored completely off-chip in an external

    ROM or, more commonly, an external EPROM. Flash RAM isalso another popular method of storing a program. Various

    combinations of these memory types may also be used--that is to

    say, it is possible to have 4K of code memory on-chip and 64k

    of code memory off-chip in an EPROM.

    When the program is stored on-chip the 64K maximum is often

    reduced to 4k, 8k, or 16k. This varies depending on the versionof the chip that is being used. Each version offers specific

    capabilities and one of the distinguishing factors from chip to

    chip is how much ROM/EPROM space the chip has.

    However, code memory is most commonly implemented as off-

    chip EPROM. This is especially true in low-cost development

    systems and in systems developed by students.

    Programming Tip: Since code memory is restricted to 64K,

    89C51 programs are limited to 64K. Some assemblers and

    compilers offer ways to get around this limit when used with

    specially wired hardware. However, without such special

    compilers and hardware, programs are limited to 64K.

  • 7/30/2019 Automatic Railway Gate Controll

    32/47

    External RAM

    As an obvious opposite of Internal RAM, the 89C51 also

    supports what is called External RAM. As the name suggests,

    External RAM is any random access memory which is found

    off-chip. Since the memory is off-chip it is not as flexible in

    terms of accessing, and is also slower. For example, to

    increment an Internal RAM location by 1 requires only 1

    instruction and 1 instruction cycle. To increment a 1-byte value

    stored in External RAM requires 4 instructions and 7 instruction

    cycles. In this case, external memory is 7 times slower!

    What External RAM loses in speed and flexibility it gains in

    quantity.While Internal RAM is limited to 128 bytes (256 bytes

    with an 8052), the 8051 supports External RAM up to 64K.

    Programming Tip: The 8051 may only address 64k of RAM.

    To expand RAM beyond this limit requires programming and

    hardware tricks. You may have to do this "by hand" since many

    compilers and assemblers, while providing support for programsin excess of 64k, do not support more than 64k of RAM. This is

    rather strange since it has been my experience that programs can

    usually fit in 64k but often RAM is what is lacking. Thus if you

    need more than 64k of RAM, check to see if your compiler

    supports it-- but if it doesn't, be prepared to do it by hand.

    On-Chip Memory

    As mentioned at the beginning of this chapter, the 89C51

    includes a certain amount of on-chip memory. On-chip memory

    is really one of two types: Internal RAM and Special Function

  • 7/30/2019 Automatic Railway Gate Controll

    33/47

    Register (SFR) memory. The layout of the 89C51's internal

    memory is presented in the following memory map:

    As is illustrated in this map, the 8051 has a bank of 128 bytes of

    Internal RAM. This Internal RAM is found on-chip on the 8051

    so it is the fastest RAM available, and it is also the most flexible

    in terms of reading, writing, and modifying its contents.

    Internal RAM is volatile, so when the 8051 is reset this memoryis cleared.

    The 128 bytes of internal ram is subdivided as shown on the

    memory map. The first 8 bytes (00h - 07h) are "register bank 0".

    By manipulating certain SFRs, a program may choose to use

    register banks 1, 2, or 3. These alternative register banks are

    located in internal RAM in addresses 08h through 1Fh. We'll

    discuss "register banks" more in a later chapter. For now it is

    sufficient to know that they "live" and are part of internal RAM.

    Bit Memory also lives and is part of internal RAM. We'll talk

    more about bit memory very shortly, but for now just keep in

  • 7/30/2019 Automatic Railway Gate Controll

    34/47

    mind that bit memory actually resides in internal RAM, from

    addresses 20h through 2Fh.

    The 80 bytes remaining of Internal RAM, from addresses 30h

    through 7Fh, may be used by user variables that need to beaccessed frequently or at high-speed. This area is also utilized

    by the Microcontroller as a storage area for the operating stack.

    This fact severely limits the 8051s stack since, as illustrated in

    the memory map, the area reserved for the stack is only 80

    bytes--and usually it is less since this 80 bytes has to be shared

    between the stack and user variables.

    SFR Descriptions

    There are different special function registers (SFR) designed in

    side the 89C51 micro controller. In this micro controller all the

    input , output ports, timers interrupts are controlled by the

    SFRs. The SFR functionalities are as follows.

    This section will endeavor to quickly overview each of thestandard SFRs found in the above SFR chart map. It is not the

    intention of this section to fully explain the functionality of each

    SFR--this information will be covered in separate chapters of the

    tutorial. This section is to just give you a general idea of what

    each SFR does.

    P0 (Port 0, Address 80h, Bit-Addressable): This is

    input/output port 0. Each bit of this SFR corresponds to one ofthe pins on the Microcontroller. For example, bit 0 of port 0 is

    pin P0.0, bit 7 is pin P0.7. Writing a value of 1 to a bit of this

    SFR will send a high level on the corresponding I/O pin whereas

    a value of 0 will bring it to a low level.

  • 7/30/2019 Automatic Railway Gate Controll

    35/47

    Programming Tip: While the 8051 has four I/O port (P0, P1, P2,

    and P3), if your hardware uses external RAM or external code

    memory (i.e., your program is stored in an external ROM or

    EPROM chip or if you are using external RAM chips) you may

    not use P0 or P2. This is because the 8051 uses ports P0 and P2

    to address the external memory. Thus if you are using external

    RAM or code memory you may only use ports P1 and P3 for

    your own use.

    SP (Stack Pointer, Address 81h): This is the stack pointer of theMicrocontroller. This SFR indicates where the next value to be

    taken from the stack will be read from in Internal RAM. If you

    push a value onto the stack, the value will be written to the

    address of SP + 1. That is to say, if SP holds the value 07h, a

    PUSH instruction will push the value onto the stack at address

    08h. This SFR is modified by all instructions which modify the

    stack, such as PUSH, POP, LCALL, RET, RETI, and wheneverinterrupts are provoked by the Microcontroller.

    Programming Tip: The SP SFR, on startup, is initialized to 07h.

    This means the stack will start at 08h and start expanding

    upward in internal RAM. Since alternate register banks 1, 2, and

    3 as well as the user bit variables occupy internal RAM from

    addresses 08h through 2Fh, it is necessary to initialize SP in

    your program to some other value if you will be using the

    alternate register banks and/or bit memory. It's not a bad idea

    to initialize SP to 2Fh as the first instruction of every one of

    your programs unless you are 100% sure you will not be using

    the register banks and bit variables.

  • 7/30/2019 Automatic Railway Gate Controll

    36/47

    DPL/DPH (Data Pointer Low/High, Addresses 82h/83h): The

    SFRs DPL and DPH work together to represent a 16-bit value

    called the Data Pointer. The data pointer is used in operations

    regarding external RAM and some instructions involving codememory. Since it is an unsigned two-byte integer value, it can

    represent values from 0000h to FFFFh (0 through 65,535

    decimal).

    Programming Tip: DPTR is really DPH and DPL taken together

    as a 16-bit value. In reality, you almost always have to deal with

    DPTR one byte at a time. For example, to push DPTR onto the

    stack you must first push DPL and then DPH. You can't simply

    plush DPTR onto the stack. Additionally, there is an instruction

    to "increment DPTR." When you execute this instruction, the

    two bytes are operated upon as a 16-bit value. However, there

    is no instruction that decrements DPTR. If you wish to

    decrement the value of DPTR, you must write your own code to

    do so.

    PCON (Power Control, Addresses 87h): The Power Control SFR

    is used to control the 8051's power control modes. Certain

    operation modes of the 8051 allow the 8051 to go into a type

    of "sleep" mode, which requires much, less power. These

    modes of operation are controlled through PCON. Additionally,

    one of the bits in PCON is used to double the effective baud

    rate of the 8051's serial port.

    TCON (Timer Control, Addresses 88h, Bit-Addressable):The Timer Control SFR is used to configure and modify the way

    in which the 8051's two timers operate. This SFR controls

    whether each of the two timers is running or stopped and

  • 7/30/2019 Automatic Railway Gate Controll

    37/47

    contains a flag to indicate that each timer has overflowed.

    Additionally, some non-timer related bits are located in the

    TCON SFR. These bits are used to configure the way in which

    the external interrupts are activated and also contain the externalinterrupt flags which are set when an external interrupt has

    occurred.

    TMOD (Timer Mode, Addresses 89h): The Timer Mode SFR

    is used to configure the mode of operation of each of the two

    timers. Using this SFR your program may configure each timer

    to be a 16-bit timer, an 8-bit auto reload timer, a 13-bit timer, or

    two separate timers. Additionally, you may configure the timersto only count when an external pin is activated or to count

    "events" that are indicated on an external pin.

    TL0/TH0 (Timer 0 Low/High, Addresses 8Ah/8Ch): These

    two SFRs, taken together, represent timer 0. Their exact

    behavior depends on how the timer is configured in the TMOD

    SFR; however, these timers always count up. What is

    configurable is how and when they increment in value.

    TL1/TH1 (Timer 1 Low/High, Addresses 8Bh/8Dh): These

    two SFRs, taken together, represent timer 1. Their exact

    behavior depends on how the timer is configured in the TMOD

    SFR; however, these timers always count up. What is

    configurable is how and when they increment in value.

    P1 (Port 1, Address 90h, and Bit-Addressable): This isinput/output port 1. Each bit of this SFR corresponds to one of

    the pins on the Microcontroller. For example, bit 0 of port 1 is

    pin P1.0, bit 7 is pin P1.7. Writing a value of 1 to a bit of this

  • 7/30/2019 Automatic Railway Gate Controll

    38/47

    SFR will send a high level on the corresponding I/O pin whereas

    a value of 0 will bring it to a low level.

    SCON (Serial Control, Addresses 98h, Bit-Addressable): The

    Serial Control SFR is used to configure the behavior of the8051's on-board serial port. This SFR controls the baud rate of

    the serial port, whether the serial port is activated to receive

    data, and also contains flags that are set when a byte is

    successfully sent or received.

    Programming Tip: To use the 8051's on-board serial port, it is

    generally necessary to initialize the following SFRs: SCON,TCON, and TMOD. This is because SCON controls the serial port.

    However, in most cases the program will wish to use one of the

    timers to establish the serial port's baud rate. In this case, it is

    necessary to configure timer 1 by initializing TCON and TMOD.

    SBUF (Serial Control, Addresses 99h): The Serial Buffer SFR is

    used to send and receive data via the on-board serial port. Any

    value written to SBUF will be sent out the serial port's TXD pin.Likewise, any value which the 8051 receives via the serial port's

    RXD pin will be delivered to the user program via SBUF. In other

    words, SBUF serves as the output port when written to and as

    an input port when read from.

    P2 (Port 2, Address A0h, and Bit-Addressable): This is

    input/output port 2. Each bit of this SFR corresponds to one ofthe pins on the Microcontroller. For example, bit 0 of port 2 is

    pin P2.0, bit 7 is pin P2.7. Writing a value of 1 to a bit of this

    SFR will send a high level on the corresponding I/O pin whereas

    a value of 0 will bring it to a low level.

  • 7/30/2019 Automatic Railway Gate Controll

    39/47

    Programming Tip: While the 8051 has four I/O port (P0, P1, P2,

    and P3), if your hardware uses external RAM or external code

    memory (i.e., your program is stored in an external ROM or

    EPROM chip or if you are using external RAM chips) you maynot use P0 or P2. This is because the 8051 uses ports P0 and P2

    to address the external memory. Thus if you are using external

    RAM or code memory you may only use ports P1 and P3 for

    your own use.

    IE (Interrupt Enable, Addresses A8h): The Interrupt Enable SFR

    is used to enable and disable specific interrupts. The low 7 bits

    of the SFR are used to enable/disable the specific interrupts,

    where as the highest bit is used to enable or disable ALL

    interrupts. Thus, if the high bit of IE is 0 all interrupts are

    disabled regardless of whether an individual interrupt is

    enabled by setting a lower bit.

    P3 (Port 3, Address B0h, and Bit-Addressable): This is

    input/output port 3. Each bit of this SFR corresponds to one ofthe pins on the Micro controller. For example, bit 0 of port 3 is

    pin P3.0, bit 7 is pin P3.7. Writing a value of 1 to a bit of this

    SFR will send a high level on the corresponding I/O pin whereas

    a value of 0 will bring it to a low level.

  • 7/30/2019 Automatic Railway Gate Controll

    40/47

    Fig-10 (Structural Hierarchy)

  • 7/30/2019 Automatic Railway Gate Controll

    41/47

    Auto reset Circuit:

    Fig-11 (Connection of Relay with microcontroller)

    RST10uF

    22pF

    22pF

    8.2k

    4 - 12Mhz

    VCC=+5vdc

    AT89C51

    9

    1819

    2930

    31

    1

    2

    3

    4

    5

    6

    7

    8

    2122

    23

    24

    25

    26

    27

    28

    10

    11

    12

    13

    14

    15

    16

    17

    3938

    37

    36

    35

    34

    33

    32

    RST

    XTAL2

    XTAL1

    PSEN

    ALE/PROG

    EA/VPP

    P1.0

    P1.1

    P1.2

    P1.3

    P1.4

    P1.5

    P1.6

    P1.7

    P2.0/A8

    P2.1/A9

    P2.2/A10

    P2.3/A11

    P2.4/A12

    P2.5/A13

    P2.6/A14

    P2.7/A15

    P3.0/RXD

    P3.1/TXD

    P3.2/INT0

    P3.3/INT1

    P3.4/T0

    P3.5/T1

    P3.6/WR

    P3.7/RD

    P0.0/AD0

    P0.1/AD1

    P0.2/AD2

    P0.3/AD3

    P0.4/AD4

    P0.5/AD5

    P0.6/AD6

    P0.7/AD7

    MICROCONTROLLER

  • 7/30/2019 Automatic Railway Gate Controll

    42/47

    The auto reset circuit is a RC network as shown in the mother

    board circuit diagram. A capacitor of 1-10mfd is connected in

    series with a 8k2 resister the R-C junction is connected to the

    micro controller pin 9 which is reset pin. The reset pin is onewhen ever kept high( logic 1) the programme counter (PC)

    content resets to 0000h so the processor starts executing the

    programme. from that location. When ever the system is

    switched ON the mother board gets power and the capacitor acts

    as short circuit and the entire voltage appears across the resistor,

    so the reset pin get a logic 1 and the system get reset, whenever

    it is being switched ON.

  • 7/30/2019 Automatic Railway Gate Controll

    43/47

    Pull-UP Resisters:

    FIG-12 (Pin configuration of AT89C51 microcontroller)

    The PORT0 and PORT2 of the MCS-51 architecture

    is of open collector type so on writing logic 0 the pins are

    providing a perfect ground potential. Where as on writing logic

    1 the port pins behaves as high impedance condition so putting apull-up resister enables the port to provide a +5volt( logic 1).

    Port1 and Port3 are provided with internal pull-ups. A pull-up

    resister is normally a 10K resistance connected from the port pin

    to the Vcc (+5) volt.

    AT89C51

    9

    18

    19

    29

    30

    31

    1

    2

    3

    4

    5

    6

    7

    8

    21

    22

    23

    24

    25

    2627

    28

    10

    11

    12

    13

    14

    15

    16

    17

    39

    38

    37

    36

    35

    3433

    32

    RST

    XTAL2

    XTAL1

    PSEN

    ALE/PROG

    EA/VPP

    P1.0

    P1.1

    P1.2

    P1.3

    P1.4

    P1.5

    P1.6

    P1.7

    P2.0/A8

    P2.1/A9

    P2.2/A10

    P2.3/A11

    P2.4/A12P2.5/A13

    P2.6/A14

    P2.7/A15

    P3.0/RXD

    P3.1/TXD

    P3.2/INT0

    P3.3/INT1

    P3.4/T0

    P3.5/T1

    P3.6/WR

    P3.7/RD

    P0.0/AD0

    P0.1/AD1

    P0.2/AD2

    P0.3/AD3

    P0.4/AD4P0.5/AD5

    P0.6/AD6

    P0.7/AD7

    10k

    PORT-0

    VCC=+5V

  • 7/30/2019 Automatic Railway Gate Controll

    44/47

    Crystal Oscillator

    The 8051 family microcontroller contains an inbuilt crystal

    oscillator, but the crystal has to be connected externally. This

    family of microcontroller can support 0 to 24MHz crystal andtwo numbers of decoupling capacitors are connected as shown

    in the figure. These capacitors are decouples the charges

    developed on the crystal surface due to piezoelectric effect.

    These decoupling capacitors are normally between 20pf to 30pf.

    The clock generator section is designed as follows,

    Fig-13 (Crystal oscillator)

    The Microcontroller design consist of two parts

    1) Hardware2) Software

    .

  • 7/30/2019 Automatic Railway Gate Controll

    45/47

    HARDWARE:

    The controller operates on +5 V dc, so the regulated + 5v is

    supplied to pin no. 40 and ground at pin no. 20. The controller is

    used here need not required to handle high frequency signals, soas 4 MHz crystal is used for operating the processor. The pin no.

    9 is supplied with a +5V dc through a push switch to reset the

    processor .As prepare codes are store in the internal flash

    memory the pin no. 31 is connected to + Vcc

    4.6-IC 7805

    ITs one of the most famous regulator IC to make theripple in wave form smooth.when we convert AC to DCwe need to use like this IC to regulate the voltage andcurrent.78 mean that it works with + polarity and 05 meansit produce +5 volts for u regulated and without ripple. if wewant to have the higher voltage u should use

    7805,7806.7812,78XXand for the negative polarityuse 7905,7912,79XX is positive type.

  • 7/30/2019 Automatic Railway Gate Controll

    46/47

    Features

    Output Current up to 1A

    Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V

    Thermal Overload Protection

    Short Circuit Protection

    Output Transistor Safe Operating Area Protection

    Description

    The KA78XX/KA78XXA series of three-terminal positiveregulator are available in the TO-220/D-PAK package andwith several fixed output voltages, making them useful inwide range of applications. Each type employs internalcurrent limiting, thermal shut down and safe operatingarea protection, making it essentially indestructible. If

    adequate heat sinking is provided, they can deliver over1A outpu current. Although designed primarily as fixedvoltage regulators, these devices can be used withexternalcomponents to obtain adjustable voltages andcurrents.

  • 7/30/2019 Automatic Railway Gate Controll

    47/47