+ All Categories
Home > Documents > E-Automation for Trains

E-Automation for Trains

Date post: 04-Apr-2018
Category:
Upload: priyanka-agarwal
View: 214 times
Download: 0 times
Share this document with a friend

of 51

Transcript
  • 7/31/2019 E-Automation for Trains

    1/51

    E-

    AUTOMATION FOR TRAINS

    E-AUTOMATION FOR TRAINS

    INTRODUCTION

    There are many railway crossings which are unmanned due to lack of man power needed to

    fulfill the demands. Hence many accidents occur at such crossings since there is no one to take

    care of the functioning of the railway gate when a train approaches the crossing. This project is a

    step towards improving the status of such unmanned railway crossings. Here, the railway gate is

    closed automatically as train approaches the crossing and automatically the gate is opened after the

    train has crossed. Here the magnetic switches have been utilized to sense the train approach and

    departure.

    This project is designed using Microcontroller IC 8051,the program is written and stored in

    the ROM of the 8051.when the Microcontroller is powered up, the controller starts working as per

    the program stored in the IC. To sense the train and to control the gates, the ports of

    Microcontroller are utilized. The main advantage of using Microcontroller, the size of the circuit is

    minimized to greater extent, consumes less power, reliable and has high accuracy in its operation.

    The two magnetic sensors are placed 1/4th KM away from the railway gate crossing on

    either side of the gate .When the train approaches and passes on the magnetic sensor the gate

    buzzer produces sound for few seconds , which indicates to the motor vehicles that gate is about to

    close and no one should cross the gate. Similarly once the Train passes on the other sensor kept at

    other side of the gates will be opened. The distance of placing sensors can be adjusted. This projectis facilitated with multi options such as anti collision system for trains and it sends indication to the

    driver in the train as soon as the track is cut or removed.

    2.1 BLOCK DIAGRAM OF UNMANNED RAILWAY GATE CONTROL:

  • 7/31/2019 E-Automation for Trains

    2/51

    E-

    AUTOMATION FOR TRAINS

  • 7/31/2019 E-Automation for Trains

    3/51

    E-

    AUTOMATION FOR TRAINS

    2.2 BLOCK DIAGRAM OF TRACK CUT :

    2.3 BLOCK DIAGRAM OF ANTI COLLISION :

    2.4 BLOCK DIAGRAM EXPLANATION OF

    MICROCONTROLLER BASED UNMANNED RAILWAY GATECONTROL:

    MAGNETIC SENSORS:

    When the magnet is passed on the magnetic switch, it makes the magnetic switch gets

    shorted. Using this principle, we can detect the train.

    The magnetic sensors are used at either side of the Railway gate in order to detect the

    arrival and departure of train at the Railway gate. The sensors has to be 1/4 KM away from the

    Railway gate on either side, the above distance is not mandatory, this can be adjusted as per the

    requirement. The two magnetic switches are connected to the Microcontroller in order to provide

    triggering to the ports of Microcontroller.

    TRACK CUT

    SENSING

    CIRCUIT

    FM Tx

    FM Rx 8051 16X2 LCD

    ULN 2803

    IC

    IR Tx IR Rx

    DRIVE

    R CKT

    BUZZER

  • 7/31/2019 E-Automation for Trains

    4/51

    E-

    AUTOMATION FOR TRAINS

    PROGRAM:

    A Microcontroller program is written and stored in chip, whose function of the

    program is to open and close the Railway gate on the arrival and departure of the Train. The

    program is written such a way that ,before closing the gate the Microcontroller provides the

    beeping sound for predetermined time indicating to the vehicle passers that gate is going to be

    closed.

    MICRO CONTROLLER:

    The program is stored in the flash ROM of Microcontroller, once

    the power is made ON, the Microcontroller checks the signals from it ports to detect the train

    coming. microcontroller, the microcontroller enables the port to activate to produce sound for

    seconds, then the gate will be closed. Once the train leaves the gate the gate will beautomatically

    closed.

    PORTS:

    The ports can be programmed as an input port or output port .In this project the

    input port is used to sense the arrival and departure of train, the output ports are used to bias the

    driver circuit to produce sound from the Buzzer. Similarly another port is also connected to

    driver IC in order to drive the Stepper motor.

    DRIVER CIRCUIT FOR STEPPER MOTOR:

  • 7/31/2019 E-Automation for Trains

    5/51

    E-

    AUTOMATION FOR TRAINS

    The stepper motor works for 12V DC, where as the o/P of microcontroller is 5V DC which

    can not drive the motor. A driver IC inputs is connected to the outputs of Microcontroller and

    outputs of IC whose output voltage is 12V DC is connected to the stepper motor.

    DRIVER CIRCUIT:

    A driver circuit comprises of Darlington amplifier or signal transistor, which

    increases the DC level to a required value say (12V). This 12V is much more

    enough to operate the Buzzer.

    STEPPER MOTORS:

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

    mechanical movement. In applications such as disk drives, dot matrix printers, and robotics, the

    stepper motor is used for position control. Every stepper motor has a permanent magnet rotor (also

    called the shaft) surrounded by a stator.

    2.5 BLOCK DIAGRAM EXPLANATION OF TRACK CUT:

    TRACK CUT SENSING:

    To sense the track metal conductors are connected to the tack, when ever the track

    is cut the output or track cut sensing circuit becomes high and provides base bias to the

    transistor, the output of transistor is connected to the relay to make the FM Tx ON.

  • 7/31/2019 E-Automation for Trains

    6/51

    E-

    AUTOMATION FOR TRAINS

    FM TRANSMITTER:

    When track is cut FM Tx transmits the signal to the space.The freqncy

    of FM Tx is 27MHz.

    FM RECEIVER:

    The FM receiver is tuned to the frequency of 49MHz, theFM Rx

    receives the signal from the FM transmitter demodulates it and fed to the input port of 8051.

    .

    INPUT PORT:The signal is received from the FM Rx and fed to the input port of

    8051microcontroller, the function of input port is to receive the signal and feds to the

    microcontroller. As we know by default or by reset , the Microcontroller ports acts as a out put port

    ,if it is to be used as input port, it must be programmed .

    MICROCONTROLLER:

    The 8051 microcontroller is employed and the program is down loaded in

    the ROM, the 8051 receives the signal from the input port and executes the instructions stored in

    the ROM and sends the signal through the output port to make the buzzer On and to display the

    track cut on the LCD screen.

  • 7/31/2019 E-Automation for Trains

    7/51

    E-

    AUTOMATION FOR TRAINS

    2.6 BLOCK DIAGRAM EXPLANATION OF ANTICOLLISION:

    POWER SUPPLY:

    A centre tapped fullwave regulated power supply of 9V is constructed

    in for the operation of IR Tx and IR Rx circuits. In order to get 9V a regulated

    IC 7809 is employed.

    IR GENERATOR AND MODULATOR CIRCUIT:

    The IR Tx and receiver are placed to detect the any train coming in opposite

    direction or any obstacle and the driver gets the beeping sound and the collision can

    be avoided.

    IR LED:

    It converts the oscillations in to IR rays, these IR rays can not seen by the

    eyes and does not affect by sun light and atmosphere.

    IR RECIVER:

    IR receiver is one which senses the IR Rays and converts into electrical

    signals.

  • 7/31/2019 E-Automation for Trains

    8/51

    E-

    AUTOMATION FOR TRAINS

    IR SENSING CIRCUIT:

    This section provides the biasing to the signal booster circuit section to

    smaller value, just like preamplifier in amplifiers.

    IR SIGNAL BOOSTER:

    IR signal booster is one which increases the signal strength and fed to the

    driver circuit.

    DRIVER CIRCUIT:

    A driver circuit comprises of Darlington amplifier or signal transistor, which

    increases the DC level to a required value say (9V). This 9V is much more enough

    to operate Buzzer.

  • 7/31/2019 E-Automation for Trains

    9/51

    E-

    AUTOMATION FOR TRAINS

    3.1 SCHEMATIC DIAGRAM OF INTERFACING 8051 WITH

    STEPPER MOTOR AND BUZZER:

  • 7/31/2019 E-Automation for Trains

    10/51

    E-

    AUTOMATION FOR TRAINS

    SCHEMATIC DIAGRAM OF INTERFACING 8051 WITH STEPPER MOTOR AND BUZZER

    3.2 EXPLANATION OF SCHEMATIC DIAGRAM

    VCC:Pin 40 provides supply voltage to the chip. The voltage source is +5V.

    GND:

    Pin 20 is the ground.

    XTAL1 and XTAL2:

    The 8051 has an on-chip oscillator but requires an external clock to run it.Most often

  • 7/31/2019 E-Automation for Trains

    11/51

    E-

    AUTOMATION FOR TRAINS

    quartz crystal oscillator connected to inputs XTAL1(pin 19) and XTAL2 (pin 18).The

    quartz crystal oscillator connected to XTAL1 and XTAL2 also needs two capacitors of

    30 pF value. One side of each capacitor is connected to the ground as shown in Circuit

    diagram.

    RST:

    Pin 9 is the RESET pin. It is an input and is active high (normally low).Upon apply

    a high pulse to this pin, the microcontroller will reset and terminate all activities. This is

    often referred to as a power-on reset. Activating a power-on reset will cause all values in

    the registers to be lost.

    When the Microcontroller is powered up ,the Program stored in the ROM of

    Microcontroller starts executing and microcontroller functions as per the Program. In this project

    the Microcontroller keeps on checking the signals arriving at the input port, if there is no signal

    from it no function is taken Place. If the train is arriving near to Railway gate say at 1/4 KM the

    sensor senses that the Train is arriving and gives Sound for 10sec indicating that Train is arriving

    and all the Vehicles should stop passing across the Railway gate ,then the gates are closed

    automatically, similarly once the Train leaves the gate the gates are opened automatically. The

  • 7/31/2019 E-Automation for Trains

    12/51

    E-

    AUTOMATION FOR TRAINS

    same process is repeated for all the Trains.

    3.3 SCHEMATIC DIAGRAM OF FM TRANSMITTER:

  • 7/31/2019 E-Automation for Trains

    13/51

    E-

    AUTOMATION FOR TRAINS

    3.4 EXPLANATION OF TRACKCUT SENSING CIRCUIT& FM

    TRANSMITTER:

    When the two tracks are connected to tracks, the inputs of U1A become LOW and the o/p

    of NAND gate1 becomes high. The o/p of NAND gate1 is connected to the to the i/p of the

  • 7/31/2019 E-Automation for Trains

    14/51

    E-

    AUTOMATION FOR TRAINS

    NAND gate of U1B, Now the i/p of NAND gates U1B becomes High and the o/p of NAND gate

    U1B becomes LOW, the transistor Q1 does not conduct and the buzzer is OFF.

    Similarly, when the track is cut the inputs of UA1 becomes HIGH and the o/p of NAND

    gate becomes LOW. The o/p of NAND gate is connected to the to the i/p of the NAND gate U1B,

    Now the i/p of NAND gates U1B becomes LOW and the o/p of NAND gate U1B becomes HIGH,

    the transistor Q1 conducts and the buzzer is off.

    The IC Tx-2 ,is an low frequency generator, when the switch s1 is connected to the relay of

    metal sensor of track cut the FM Tx becomes automatically ON AND transmits the signal. In FM

    Tx IC in built oscillator in IC generates frequency at pin no.9, the pin no.9 is fed to the base of the

    transistor Q1,the Q1 starts conducting as per the input signal coming from the pin no9.due to

    conduction of transistor, the capacitor starts charging and discharging through the inductor, so the

    oscillations are generated at collector of Q1 ,the o/p of Q1 is fed to the is fed to the base of Q2,now

    the transistor Q2 starts conducting as per the oscillations, due to change in base current, the

    collector current varies and therefore the crystal generates high frequency, the high frequency is

    fed the antenna, the antenna converts electrical signal into electromagnetic signals and

    transmits into space.

    3.5 SCHEMATIC DIAGRAM OF FM RECEIVER:

  • 7/31/2019 E-Automation for Trains

    15/51

    E-

    AUTOMATION FOR TRAINS

    3.6 EXPLANATION OF FM RECEIVER:

    The FM receiver is tuned to receive the frequency of about 49 MHz with the help of the

    capacitor C2 and the inductance L1 shown in the circuit diagram. The signal from the antenna is

  • 7/31/2019 E-Automation for Trains

    16/51

    E-

    AUTOMATION FOR TRAINS

    fed to the base of the Transistor which conducts as per the input signal, simultaneously the

    charging and discharging of the capacitor takes place and this signal frequency is demodulated

    with the of receiver IC i.e. low frequency signal is passed to the transistor T2 which amplifies the

    signal, the function of T3 is also same as T2, this transistor increases the signal ,the amplified

    signal operates the relay. The output of FM Rx is connected to the 8051in order to display the

    opposite information.

    3.7 SCHEMATIC DIAGRAM OF ANTI COLLISION:

  • 7/31/2019 E-Automation for Trains

    17/51

    E-

    AUTOMATION FOR TRAINS

    3.8 EXPLANATION OF ANTI COLLISION:

  • 7/31/2019 E-Automation for Trains

    18/51

    E-

    AUTOMATION FOR TRAINS

    The advantages of using IR circuits is, these circuits are unaffected by sunlight and other

    artificial lights, range of the this circuit is about 5 meters with out any lenses. Range can be

    extended further by using lenses or reflectors with sensors.

    WORKING OF IR-TRANSMITTER CIRCUIT:

    Transmitter module is based on timer IC.555. It is wired as astable

    multivibrator. As we the output of astable multivibrator is an square wave, whose frequency is

    given by the formula

    f = 1.44/(R1+2R

    2)C

    The frequency of astable multivibrator is nearly 1kHz. The output of

    astable multivibrator is a square wave which is fed to the base of the PNP transistor, to increase the

    signal strength in order to drive the IR LEDs.

    WORKING OF IR-RECEIVER CIRCUIT:

    When I.R. Photo diode receives I.R. signals from transmitter, tone signal

    amplifier amplifies 1KHz signals. The amplified signals are given to the base of transistor T4.

    During negative half cycles of tone signals, T4 conducts. Then transistor T5 gets base bias. Then

    it also conducts and the voltage at collector terminal of T5 becomes 0V. So the transistor T6 will

    not have base bias, therefore transistor T6 does not conduct. So the output across diode D5 will be

    0V, and buzzer does not produce any sound.

    But when the I.R. beam between transmitter and receiver is interrupted , transistors T4 and

    T5 stop conduction. The voltage at collector terminal of T5 will be high, therefore the transistor

    T6 gets base bias and conducts (goes to saturation region).

  • 7/31/2019 E-Automation for Trains

    19/51

    E-

    AUTOMATION FOR TRAINS

    The voltage across diode D5 will be 9V and the buzzer produces audio tone.

    4.1 CIRCUIT DIAGRAM OF DUAL POWER SUPPLY:

  • 7/31/2019 E-Automation for Trains

    20/51

    E-

    AUTOMATION FOR TRAINS

    T1 = Step down Transformer 12-0-12, i=750mA

    D1=D2= IN4007

    C1= 25V, 1000F

    C2=C3=C4= 104

    ICs = 7809, 7806, 7805

    Fig 4.1: Power supply section.

    4.2 WORKING OF DUAL POWER SUPPLY:

    In every project we need different voltages for different circuits. Some

    need to construct different power supply of different voltages employing

    different voltage transformers, rectifier circuits, filter circuits and regulator

    circuits. This type of construction requires many components (transformers,capacitors regulators.......etc).So the size of the power supply becomes bulky

    and costly. To overcome above disadvantages by using regulator ICS the

    different voltages (12V, 9V, 5V... ..etc) can be obtained with only one

    transformer.

  • 7/31/2019 E-Automation for Trains

    21/51

    E-

    AUTOMATION FOR TRAINS

    The circuit diagram of Dual power supply is shown in the figure.The function

    of each component of the circuit is explained below.

    The circuit consists of following stages.

    1. Transformer

    2. Rectifier

    3. Filter and

    4. Regulator

    TRANSFORMER:

    It is an electrical device which transfers the power from one winding to

    the other winding with isolation. All the electronic gadgets works for less

    voltage (normally 3V to 12V).So an step down transformer is used, whose

    function is to step down the AC voltage from 230V to required voltage

    depending on the need. In this project 12V-0-12V is used. The output of

    transformer is 12V AC which is connected to the diodes for rectification.

    RECTIFIER CIRCUIT:

    It employs diodes, which converts AC voltage into DC voltage. The

    output of rectifier circuit is not a pure DC. It also consists of some AC

  • 7/31/2019 E-Automation for Trains

    22/51

    E-

    AUTOMATION FOR TRAINS

    components, which is called ripples. In order to remove these AC components,

    filter circuits are employed. So the output of rectifier circuit is fed to the filter

    circuit (capacitor).

    FILTER CIRCUIT:

    Filter circuit employees electrolytic capacitors in-order to remove the

    AC components. As we know the capacitor does not allow DC components to

    pass th rough it because it offers high reactance to the DC component .And

    offers less reactance to the AC component so all AC components will be

    bypasses through the capacitors to ground.

    REGULATOR:

    Regulator is an electronic circuit whose function is to keep output always

    constant though the input is varied. In this project the three terminal IC

    regulators of 7809 & 7805 is used for providing output DC voltages. Eg 7809,

    the number 78 represents the positive regulator IC and 09 represents the output

    voltage i.e output is 9V.

    5.1 PIN DIAGRAM OF 89S51

  • 7/31/2019 E-Automation for Trains

    23/51

    E-

    AUTOMATION FOR TRAINS

    Although 8051 family members (e.g., 8751, DS5000) come in different

    packages , such as DIP (dual in-l ine package) , QFP (quad fl at package), and LLC

    (leadless chip carrier), they all have 40 pins that are dedicated for various functions

    such as I/O, RD, WR, address, data, and interrupts. It must be noted that some

  • 7/31/2019 E-Automation for Trains

    24/51

    E-

    AUTOMATION FOR TRAINS

    companies provide a 20-pin version of the 8051 with a reduced number of I/O ports

    for less demanding applications. However, since the vast majority of developers use

    the 40-pin DIP package chip, we will concentrate on that.

    Examining Figure 5-1, note that of the 40 pins, a total of 32 pins are set aside

    for the four ports P0, P1, P2, and P3, where each port takes 8 pins. The rest of the

    pins are designated as VCC, GND, XTAL1, XTAL2, ALE/PROG, RST, EA, PSEN.

    Of these 8 pins, six of them (VCC, GND, XTAL1, XTAL2, RST, and EA) are used

    by al l members of the 8051 and 8031 families.

    In other words, they must be connected in order for the system to work,

    regardless of whether the microcontroller is of the 8051 family. The other two pins,

    PSEN and ALE, are used mainly in 8031-based systems. We first describe the

    function of each pin. Ports are discussed separately.

    5.2 PIN DESCRIPTION OF 89S51:

    VCC:

  • 7/31/2019 E-Automation for Trains

    25/51

    E-

    AUTOMATION FOR TRAINS

    Pin 40 provides supply voltage to the chip. The voltage source is +5V.

    GND:

    Pin 20 is the ground.

    XTAL1 and XTAL2:

    The 8051 has an on-chip oscillator but requires an external clock to run it.

    Most often a quartz crystal oscillator connected to inputs XTAL1(pin 19) and

    XTAL2 (pin 18). The quartz crystal oscillator connected to XTAL1 and XTAL2 also

    needs two capacitors of 30 pF value. One side of each capacitor is connected to the

    ground as shown in Figure 4-2 (a).

    It must be noted that there are various speeds of the 8051 family. Speeds refer to the

    maximum oscillator frequency connected to XTAL. For example, a 12-MHz chip

    must be connected to a crystal with 12 MHz frequency or less. Likewise, a 20-MHz

    microcontroller requires a crystal frequency of no more than 20 MHz. When the

    8051 is connected to a crystal oscillator and is powered up, we can observe the

    frequency on the XTAL2 pin using the oscilloscope.

  • 7/31/2019 E-Automation for Trains

    26/51

    E-

    AUTOMATION FOR TRAINS

    If you decide to use a frequency source other than a crystal oscillator, such as

    a TTL oscillator, it will be connected to XTAL1; XTAL2 is left unconnected, as

    shown in Figure 4-2 (b).

    RST:

    Pin 9 is the RESET pin. It is an input and is active high (normally low). Upon

    applying a high pulse to this pin, the microcontroller will reset and terminate all

    activities. This is often referred to as a power-on reset. Activating a power-on reset

    will cause all values in the registers to be lost.

    RESET Value of Some 8051 Register:

    REGISTER RESET VALUE

    PC 0000

    ACC 0000

  • 7/31/2019 E-Automation for Trains

    27/51

    E-

    AUTOMATION FOR TRAINS

    B 0000

    PSW 0000

    SP 0007

    DPTR 0000

    TAB 5-1: RESET Value of Some 8051 Registers

    Table 5-1 provides a partial list of 8051 registers and their values after

    power-on reset.

    Notice that the va lue of the PC (program counter) is 0 upon rese t, forcing the

    CPU to fetch the first opcode from ROM memory locationThis means that we must

    place the fi rs t line of source code in ROM location 0 because that is where the CPU

    wakes up and expects to find the first instruction. Figure 5-3 shows two ways of

    connecting the RST pin to the power-on reset circuitry.

    In order for the RESET input to be effective, it must have a minimum duration

    of 2 machine cycles. In other words, the high pulse must be high for a minimum of 2

    machine cycles before it is allowed to go low.

    EA:

    The 8051 family members, such as the 8751, 89C51, or DS5000, all come with

    on-chip ROM to store programs. In such cases, the EA pin connected to VCC. For

    family members such as the 8031 and 8032 in which there is no on-chip ROM, code

    is stored on an external ROM and is fetchedby the 8031/32. Therefore, for the 8031

  • 7/31/2019 E-Automation for Trains

    28/51

    E-

    AUTOMATION FOR TRAINS

    the EA pin must be connected to GND to indicate that the code is stored externally.

    EA, which stands for external access, is pin number 31 in the DIP packages. It is an

    input pin and must be connected to either VCC or GND. In other words, it cannot be

    left unconnected.

    PSEN:

    This is an output pin. PSEN stands for program store enable. In an8031-

    based system in which an external ROM holds the program code ,this pin is connected

    to the OE pin of the ROM.

    ALE:

    ALE (address latch enable) is an output pin and is active high. When

    connecting an 8031 to external memory, port 0 provides both address and data. In

    other words, the 8031 multiplexes address and data through port 0 to save pins.

    The ALE pin is used for de multiplexing the address and data by connecting to

    the \G pin of the 74LS373 chip.

    I/O port pins and their functions:

    The four ports P0, P1, P2, and P3 each use 8 pins, making them 8-bit ports.

    All the ports upon RESET are configured as output, ready to be used as output

    ports. To use any of these ports as an input port , it must be programmed, as we will

  • 7/31/2019 E-Automation for Trains

    29/51

    E-

    AUTOMATION FOR TRAINS

    explain throughout this section. First, we describe each port.

    Port 0:

    Port 0 occupies a total of 8 pins (pins 32-39). It can be used for input or

    output. To use the pins of port 0 as both input and output ports,each pin must be

    connected externally to a 10K ohm pull-up resistor.This is due to the fact that P0 is

    an open drain, unlike P1, P2, and P3, as we will soon see.

    Open drain is a term used for MOS chips in the same way that open collector is

    used for TTL chips.

    For example, the following code will continuously send out to port 0 the

    alternating values 55H and AAH.

    MOV A, # 55H

    BACK: MOV P0, A

    ACALL DELAY

    CPL A

    SJMP BACK

    Port 0 as input:

  • 7/31/2019 E-Automation for Trains

    30/51

    E-

    AUTOMATION FOR TRAINS

    With resistors connected to port 0, in order to make it an input, the port must

    be programmed by writ ing 1 to al l the bi ts .

    MOV A, # OFFH ; A = FF hex

    MOV P0, A ; make P0 an input port; by writing all 1s to it

    BACK : MOV A, P0 ; get data from P0

    MOV P1, A ; send it to port 1SJMP BACK; keep doing it

    Dual role of port 0:

    As shown in Figure 4-1, port 0 is also designated as AD0-AD7, allowing it

    to be used for both address and data. When connecting an 8051/31 to an external

    memory, port 0 provides both address and data. The 8051 multiplexes addresand

    data through port 0 to save pins. ALE indicates if P0 has address or data.

    When ALE = 0, it provides data D0-D7, but when ALE = 1 it has address A0-

    A7. Therefore, ALE is used for demuliplexing address and data with the help of a

    74LS373 latch.

    Port 1:

    Port 1 occupies a total of 8 pins (pins 1 through 8). It can be used as

    input oroutput. In contrast to port 0, this port does not need any pullup resistors

    since italready has pull-up resistors internally. Upon reset, port 1 is configured as

    anoutput port. For example, the following code will continuously send out to port 1

  • 7/31/2019 E-Automation for Trains

    31/51

    E-

    AUTOMATION FOR TRAINS

    the alternating values 55H and AAH.

    MOV A, # 55HBACK : MOV P1, A

    ACALL DELAY

    CPL A

    SJMP BACK

    Port 1 as input:

    To make port 1 an input port, it must programmed as such by writing 1 to all

    its bits. In the following code, port 1 is configured first as an input port by writing

    1s to it, then data is received from that port and saved in R7, R6, and R5.

    MOV A, # 0FFH ; A=FF hex

    MOV P1, A ; make P1 an input port; by writing all 1s to it

    MOV A, P1 ; get data from P1

    MOV R7, A ; save it in reg R7ACALL DEALY ; wait

    MOV A, P1 ; get another data from P1

    MOV R6, A ; save it in reg R6ACALL DELAY ; wait

    MOV A, P1 ; get another data from p1

    MOV R5, A ; save it in reg R5

    Port 2:

    Port 2 occupies a total of 8 pins (pins 21 through 28). It can be used as input

    or output. Just like P1, port 2 does not need any pull-uresistors since it already has

    pul l-up resistors in ternallyfo llowing code wi ll send out continuous ly to port 2 the

    alternating values 55H and AAH. That is, all the bits of P2 toggle continuously.

  • 7/31/2019 E-Automation for Trains

    32/51

    E-

    AUTOMATION FOR TRAINS

    MOV A, # 55HBACK : MOV P2, A

    ACALL DELAY

    CPL ASJMP BACK

    Port 2 as input:

    To make port 2 an input, it must programmed as such by writing 1 to all its

    bi ts . In the following code, port 2 is conf igured fi rst as an input port by writ ing 1s

    to it.

    Then data is received from that port and is sent to P1 continuously.

    MOV A, # 0FFH ; A=FF hex

    MOV P2, A ; make P2 an input port by; writing all 1s to it

    BACK : MOV A, P2 ; get data from P2

    MOV P1, A ; send it to Port 1SJMP BACK; keep doing that

    Dual role of port 2:

    In systems based on the 8751, 89C51, and DS5000, P2 in used as simple

    I/O. However, in 8031-based systems, port 2 must be used along with P0 to provide

    the 16-bit address for the external memory. As shown in Figure 4-1, Port 2 is also

    designated as A8-A15, indicating its dual function. Since an 8031 is capable of

    accessing 64K bytes of external memory, it needs a path for the 16 bits of the

    address.

  • 7/31/2019 E-Automation for Trains

    33/51

    E-

    AUTOMATION FOR TRAINS

    While P0 provides the lower 8 bits via A0-A7, it is the job of P2 to provide

    bi ts A8-A15 of the address.

    In other words, when the 8031 is connected to external memory, P2 is used for

    the upper 8 bits of the 16-bit address, and it cannot be used for I/O.

    From the discussion so far, we conclude that in systems based on8751,89C51,

    or DS5000 microcontrollers, we have three ports, P0, P1, and P2, for I/O operations.

    This should be enough for most microcontroller. That leaves port 3 interrupts as well

    as other signals, as we will see next.

    Port 3:

    Port 3 occupies a total of 8 pins, pins 10 through 17. It can be used input oroutput. P3 does not need any pull-up resistors, the same as P1 and P2 did not.

    Although port 3 is configured as an output port upon reset, this is not the way it is

    most commonly used. Port 3 has the additional function of providing some extermely

    important signals such as interrupts. Table 4-2 provides these alternate functions of

    P3. This information applies to both 8051 and 8031 chips.

    P3.0 and P3.1 are used for the RxD and TxD serial communications signals.

    Bits P3.2 and P3.3 are set aside for external interrupts. Bits P3.4 and P3.5 are usedfor timers 0 and 1. Finally, P3.6 and P3.7 are used to provide the WR and RD signals

    of external memories connected in 8031-based systems. In systems based on the

    8751, 89C51, or DS5000, pins 3.6 and 3.7 are used for I/O while the rest of the pins

    in Port 3 are normally used in the alternate function role.

  • 7/31/2019 E-Automation for Trains

    34/51

    E-

    AUTOMATION FOR TRAINS

    6.1 INTRODUCTION:

    The 8-pin 555 timer must be one of the most useful ICs ever made and it is used in many

    projects. With just a few external components it can be used to build many circuits, not all of them

    involve timing!

    A popular version is the NE555 and this is suitable in most cases where a '555 timer' is specified.

    The 556 is a dual version of the 555 housed in a 14-pin package, the two timers (A and B) share

    the same power supply pins. The circuit diagrams on this page show a 555, but they could all be

    adapted to use one half of a 556.

    Low power versions of the 555 are made, such as the ICM7555, but these should only be used

    when specified (to increase battery life) because their maximum output current of about 20mA

    (with a 9V supply) is too low for many standard 555 circuits. The ICM7555 has the same pin

    arrangement as a standard 555.

    The circuit symbol for a 555 (and 556) is a box with the pins arranged to suit the circuit diagram:

    for example 555 pin 8 at the top for the +Vs supply, 555 pin 3 output on the right. Usually just

    the pin numbers are used and they are not labelled with their function.

    Standard 555 and 556 ICs create a significant 'glitch' on the supply when their output changes

  • 7/31/2019 E-Automation for Trains

    35/51

    E-

    AUTOMATION FOR TRAINS

    state. This is rarely a problem in simple circuits with no other ICs, but in more complex circuits

    smoothing capacitor (eg 100F) should be connected across the +Vs and 0V supply near the

    555 or 556.

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

    covering the various circuits:

    Astable - producing a square wave

    Monostable - producing a single pulse when triggered

    Bistable - a simple memory which can be set and reset

    Buffer- an inverting buffer (Schmitt trigger)

    THE 555 TIMER CONSISTS OF TWO COMPONENTS:

    1.The upper comparator A1 is a non-inverting op-amp comparator having two inputs

    threshold and control. In most applications, the control input (pin no 5) is not used, so that the

    control voltage equals + 2vcc

    /3, which serves as a reference voltage. Whenever the threshold

    voltage exceeds the control voltage, comparator A1 output changes to high, which sets the flip-

    flop.

    2.The lower comparator A2 is an inverting op-amp comparator, to which the trigger (pin

    2) is applied to the inverting terminal. The non-inverting input of lower comparator A2is at a

    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#bufferhttp://www.kpsec.freeuk.com/555timer.htm#monostablehttp://www.kpsec.freeuk.com/555timer.htm#bistablehttp://www.kpsec.freeuk.com/555timer.htm#bufferhttp://www.kpsec.freeuk.com/555timer.htm#astable
  • 7/31/2019 E-Automation for Trains

    36/51

    E-

    AUTOMATION FOR TRAINS

    fixed voltage of +vcc

    /3. When the trigger input is slightly less than +vcc

    /3, the compartor A2

    output changes to high and the flip-flop is thus reset.

    The reference voltage for the two comparators are obtained from an internal voltage divider

    consisting of three equal resistors R of 5Kohm each. The threshold comparator A1

    is referenced at

    +2/3 Vcc

    and the trigger comparator A2

    is referenced at +1/3Vcc.

    . The output of threshold and the

    trigger comparator are connected to S and R inputs of flip-flop respectively.

    THE PINS USED IN 555 IC ARE AS FOLLOWS:

    6.2 GENERAL CHARACTERISTICS:

    SUPPLY VOLTAGE : 4.5V-15V max

  • 7/31/2019 E-Automation for Trains

    37/51

    E-

    AUTOMATION FOR TRAINS

    OPERATING TEMPERATURE : 00C-+70

    0C

    POWER DISSIPATION : 60mv max

    TYPICAL ACCURACY : + 0.5% 100 usec + 2% mints

    OUTPUT CURRENT : 200mA Max

    PACKAGE : 14 Pin Dip Plastic Package

    1.PIN 1(Ground).

    2.PIN 2(Trigger): An external trigger plus is applied to this pin. The output of the timer depends

    on the amplitude of the trigger pulse. If the trigger voltage is less than +1/3Vcc

    ,the timer output is

    high.

    3.PIN 3(output): The output of timer is taken from Q output of SR flip-flop. A load is connected

    to this terminal in two ways.

    i) The load can be connected between pin 3 and pin 1 (ground). The current through the ground

    load is zero, when the output is zero. This is called as normally off load.

    ii) The load can be connected between pin 3 and pin-8 (supply voltage +vcc

    ) and the load is called

    as normally on. When the output is low, the load current flows through the load into the output

    terminal and it is called sink current. On the other hand,when the output is high,the current

    through the load is zero.

  • 7/31/2019 E-Automation for Trains

    38/51

    E-

    AUTOMATION FOR TRAINS

    However, when the output is high, the output terminal supplies current to the normally off load.

    This current is called the source current.

    4. PIN 4(Reset): The 555 timer can be reset by applying a negative pulse to this pin. When the

    reset function is not used, it will be connected to +Vcc.

    .

    5. PIN 5(Control): An external dc voltage may be applied to this pin to change the threshold andtrigger voltage level. By varying the control voltage, it is possible to vary the pulse width of the

    timer output. If no external dc voltage is used, the control pin is at +2/3 Vcc

    and this pin is

    bypassed to the ground to eliminate the noise.

    6. PIN 6 (Threshold): It is the non-inverting input terminal of comparator A1. The thershold

    voltage (the reference voltage of comparator A1) is +2/3 V

    cc.When the voltage at threshold pin is

    above +2/3 Vcc

    . When the voltage at threshold pin is above +2/3 Vcc

    ,the output of comparator A1

    goes high,which changes the timer output to low.

    7. PIN 7(Discharge): This pin is connected internally to the collector of discharge transistor Q.

    When the timer output is high, Q is cut-off.When the timer output is low,Q is saturated.

    8. PIN 8(Vcc): A supply voltage of +5v to +18v is applied to this pin w.r.t. ground (pin 1).

    7.1 LCD OPERATION:

  • 7/31/2019 E-Automation for Trains

    39/51

    E-

    AUTOMATION FOR TRAINS

    In recent years the LCD is finding widespread wide spread use

    replacing LED (seven segments LED or other multi segment LED). This is due to

    the following reasons:

    1. The declining prices of LCD.

    2. The abil ity to display numbers, characters, and graphics. This is in contrast

    to LED, which are limited to numbers and a few characters.

    .

    7.2 Table of Pin Descriptions for LCD:

  • 7/31/2019 E-Automation for Trains

    40/51

    E-

    AUTOMATION FOR TRAINS

    7.3 Explanation of Pin Descriptions

    The LCD discussed in this section has 14 pins. The function of each pin is

    given in Figure shows the pin positions for various LCD.

    PIN SYMBOL I/O DESCRIPTION

    1 VSS Ground

    2 VCC +5V Power Supply

    3 VEE Power Supply to Control Contrast

    4 RS I RS =0 to select command Register

    RS=1 to select Data Register

    5 R/W I R/W=0 to Write

    R/W=1 to Read

    6 E I/O Enable

    7 DB0 I/O The 8 Pin Data Bus

    8 DB1 I/O The 8 Pin Data Bus

    9 DB2 I/O The 8 Pin Data Bus

    10 DB3 I/O The 8 Pin Data Bus

    11 DB4 I/O The 8 Pin Data Bus

    12 DB5 I/O The 8 Pin Data Bus

    13 DB6 I/O The 8 Pin Data Bus

    14 DB7 I/O The 8 Pin Data Bus

  • 7/31/2019 E-Automation for Trains

    41/51

    E-

    AUTOMATION FOR TRAINS

    VCC, VSS, and VEE:

    While VCC and VSS provide +5V and ground, respectively, VEE is used for

    controlling LCD contrast.

    RS, register select:

    There are two very important registers inside the LCD. The RS pin is used for

    their selection as follows. If RS=0, the instruction command code register is

    selected, allowing the user to send a command such as clear display, cursor at home,

    etc. IF RS=1 the data register is selected, allowing the user to send data to be

    displayed on the LCD.

    R/W, read/write:

    R/W input allows the user to write information to the LCD or read information

    from it. R/W=1 when reading; R/W=0 when writing.

    E, enable:

    The enable pin is used by the LCD to latch information presented to its data

    pins . When data is supplied to da ta pins, a high-to- low pu lse must be appl ied to this

    pin in order for the LCD to latch in the data present at the da ta pins. This pulse must

    be a minimum of 450 ns wide.

    Data Pins of LCD (D0 - D7):

    The 8-bit data pins, D0 - D7, are used to send information to the LCD or read

    the contents of the LCDs internal registers.

  • 7/31/2019 E-Automation for Trains

    42/51

    E-

    AUTOMATION FOR TRAINS

    To display letters and numbers, we send ASCII codes for the letters A - Z,

    a - z, and numbers 0 - 9 to these pins while making RS=1.

    There are also instruction command codes that can be sent to the LCD to clear

    the display or force the cursor to the home position or blink the cursor. Table 12-2

    lists the instruction command codes.

    We also use RS = 0 to check the busy flag bit to see if the LCD is ready to

    receive information. The busy flag is D7 and can be read when R/W=1 and RS = 0,

    as follows: if R/W = 1, RS = 0. When D7 = 1 (busy flag = 1), the LCD is busy taking

    care of internal operations and will not accept any new information. When D7 = 0,

    the LCD is ready to receive new information. Note: It is recommended to check the

    busy flag before writ ing any data to the LCD.

    9.4 LCD Command Codes:Code Command to LCD Instruction

    (Hex) Register

    1 Clear display screen

    2 Return home

  • 7/31/2019 E-Automation for Trains

    43/51

    E-

    AUTOMATION FOR TRAINS

    4 Decrement cursor (shift cursor to left)

    6 Increment cursor (shift cursor to right)

    5 Shift display right

    7 Shift display left

    8 Display off, cursor off

    A Display off, cursor on

    C Display on, cursor off

    E Display on, cursor blinking

    F Display on, cursor blinking

    10 Shift cursor position to left

    14 Shift cursor position to right

    18 Shift the entire display to the left

    1C Shift the entire display to the right

    80 Force cursor to beginning of 1st line

    C0 Force cursor to beginning of 1st line

    38 2 lines and 5x7 matrix

    8.1 ADVANTAGES:

    1. Railway accidents is minimised.

    2. Man power is reduced and economy of railway department isincreased

    3. Since Microcontroller is used, it consumes less power.

    4. More reliable and flexible.

    5. More accuracy.

  • 7/31/2019 E-Automation for Trains

    44/51

    E-

    AUTOMATION FOR TRAINS

    8.2 APPLICATIONS:

    1. Automatic Railway gate controlling is achieved with no man.

    2. This can adopted in Homes, factories etc.

    3. Automatic parking system .

    FUTURE SCOPE

    We expect that our next generation will develop this automation for trains with GSM

    modem In our project we connected all the sensors to micro controller with the wires.

  • 7/31/2019 E-Automation for Trains

    45/51

    E-

    AUTOMATION FOR TRAINS

    In future this can be developed as monitoring can be done globally by using GSM modem

    and also in place of magnetic sensors we can replace it by IR Transmitters and Receivers.

    CONCLUSION

    The Project E-AUTOMATION FOR TRAINS has been successfully designed and

    tested.

    E-AUTOMATION FOR TRAINS is not Limited for any Particular Application. It can be

    used in daily applicances with little modifications according to the requriments. This Concept is

    not only ensures that our work will be usable in the future but also provides the flexibility to adapt

    and extend, as needs change.

  • 7/31/2019 E-Automation for Trains

    46/51

    E-

    AUTOMATION FOR TRAINS

    In this project work we had studied and implemented a complete working of gate control,

    track cut and anti collision. This work includes the study of automation for trains in many

    applications.

    Finally, we conclude that E-AUTOMATION FOR TRAINS is an emerging field and

    there is a huge scope for usage of this application.

    BIBILIOGRAPHY

    1. Electronic Communication Systems

    -- George Kennedy.

    2. Radio Engineering

    -- G. K. Mithal.

    3. Principles of Electronics

  • 7/31/2019 E-Automation for Trains

    47/51

    E-

    AUTOMATION FOR TRAINS

    -- V. K. Mehta.

    4. Programming & Customizing the 8051 Microcontroller

    -- Myke Predko.

    5. Embedded System Design using 8051 Microcontroller

    --Prof. Satish Shah

    APPENDIX

    PROGRAM FOR STEPPER MOTOR:

    mov p1,#0ffhup: mov c,p1.0

    jnc aclk

    sjmp up

    back1:mov c,p1.0

    jnc clksjmp back1

    clk: acall delay1

    mov a,#11h

  • 7/31/2019 E-Automation for Trains

    48/51

    E-

    AUTOMATION FOR TRAINS

    up1: mov p2,a

    acall delay

    rr adjnz r0,up1

    sjmp up

    aclk: acall delay1

    mov a,#11h

    up2: mov p2,a

    acall delay

    rl a

    djnz r1,up2sjmp back1

    delay1: clr p3.0mov tmod,#10h

    mov r3,#125

    again: mov tl1,#08mov th1,#01

    setb tr1

    back: jnb tf1,back

    clr trclr tf1

    djnz r3,again

    setb p3.0ret

    delay: mov r2,#05fh

    mov r3,#0ffhhere: djnz r3, here

    djnz r2, here

    ret

  • 7/31/2019 E-Automation for Trains

    49/51

    E-

    AUTOMATION FOR TRAINS

    PROGRAM TO DISPLAY TRACK CUT:

    MOV P1,#0FFHUPP: SETB P1.0, A1

    SJMP UPP

    A1: MOV A,#38H ; init. LCD 2 lines, 5x7 martix

    ACALL COMMAND ; issue command

    MOV A, #0EH ; LCD on, cursor on

    ACALL COMMAND ; issue commandMOV A, #01H ; clear LCD command

    ACALL COMMAND ; issue command

    MOV A, #06H ; shift cursor rightACALL COMMAND ; issue command

    MOV A, #86H ; cursor: line 1, pos. 6

    ACALL COMMAND ; command subroutineMOV A, # T ;

  • 7/31/2019 E-Automation for Trains

    50/51

    E-

    AUTOMATION FOR TRAINS

    ACALL DATA _ DISPLAYMOV A, # R ;

    ACALL DATA _MDISPLAY

    MOV A, # A ;ACALL DATA _MDISPLAY

    MOV A, # C

    ACALL DATA _ DISPLAYMOV A, # K ;

    ACALL DATA _ DISPLAY

    MOV A, # ;ACALL DATA _ DISPLAY

    MOV A,#C

    ACALL DATA _ DISPLAY

    MOV A, # U ;ACALL DATA _ DISPLAY

    MOV A, # T ;

    ACALL DATA _ DISPLAYMOV A, # A ;

    ACALL DATA _ DISPLAY

    MOV A, # H ;ACALL DATA _ DISPLAY

    MOV A, # E ;

    ACALL DATA _ DISPLAY

    MOV A, # D ;SJMP UPP

    COMMAND: ACALL READY ; is LCD ready?

    MOV P0, A ; issue command code

    CLR P2. 0 ; RS=0 for commandCLR P2. 1 ; R/W=0 for command

    SETB P2. 2 ; E=1 for H-toL pulse

    CLR P2. 2 ; E=0, latch in

    RET

    DATA_DISPLAY:

    ACALL READY ; is LCD ready?MOV P0, A ; issue data

  • 7/31/2019 E-Automation for Trains

    51/51

    E-

    AUTOMATION FOR TRAINS

    CLR P2. 0 ; RS=1 for dataCLR P2. 1 ; R/W=0 to write to LCD

    SETB P2. 2 ; E=1 for H-toL pulse

    READY:

    SETB P0.7 ; make P1.7 input port

    CLR P2.0 ; RS=0 access command regSETB P2.1 ; R/W=1 read command reg

    ; read command reg and check busy flag

    BACK:CLR P2.2 ; E=1 for H-to-L pulseSETB P2.2 ; E=0 H-to-L pulse

    JB P1.0, BACK ; stay until busy flag=0

    RETHERE: SJMP HERE ; STAY HERE

    CONTACT DETAILS

    .


Recommended