railway1 (1)

Upload: muhammad-aslam-v-g

Post on 08-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 railway1 (1)

    1/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    1.INTRODUCTION

    1. Objective

    Each day, our lives become more dependent on 'embedded systems', digital

    information technology that is embedded in our environment. This includes not only

    safety-critical applications such as automotive devices and controls, railways, aircraft,

    aerospace and medical devices also communications, 'mobile worlds' and 'e-worlds',

    the 'smart' home, clothes, factories etc. All of these have wide-ranging impacts on

    society, including security, privacy and modes of working and living. More than 98%

    of processors applied today are in embedded systems, and are no longer visible to the

    customer as 'computers' in the ordinary sense. New processors and methods of

    processing, sensors, actuators, communications and infrastructures are 'enablers' for

    this very pervasive computing. They are in a sense ubiquitous, that is, almost invisible

    to the user and almost omnipresent. As such, they form the basis for a significanteconomic push.

    Railways being the cheapest mode of transportation it has an important role in

    moving passengers and freights. When we go through the daily newspapers we come

    across many railway accidents occurring at unmanned railway crossings. This is

    mainly due to the carelessness in manual operations or lack of workers. Therefore

    more efforts are necessary for improving its safety. This project has come up with a

    solution for this problem. Using simple electronic components we have tried to

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

    either side, the wireless transceiver will send informations to the receiver placed at a

    certain distance from the gate and then the system controls the operation of the gate

    and traffic signals along with an alarm .

  • 8/7/2019 railway1 (1)

    2/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    The GPS (Global positioning system) have revolutionized in the area of

    avoiding train collision. In this system GPS and a transmitter-receiver system fit in the

    train. The station collects the data of position of train and other train/vehicles, on earthwhich is compared, according to the relative distance between train and train/

    vehicles, the speed of the train can be controlled. In this way the collision can be

    avoided.

    Railway station name display system inside the train cabinet.

    To locate the current position of the train from the station using GPS

    Train can be controlled through wireless communication from the station.

    Increase of punctuality.

    1.2 SCOPE OF PROJECT

    Today, train passengers have no option to know the place where the train

    passes. Now trains location identification is achieved by the communication between

    station master and engine driver, here is a possibility to occur errors regarding theplace name, for this reason station master cant calculate the exact time of train

    arrives at the station. These limitations eliminated in our system .The current location

    of the train can be displayed on the screen. This is also helpful to the passengers.

  • 8/7/2019 railway1 (1)

    3/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    2.BLOCK DIAGRAM

    TRAIN

  • 8/7/2019 railway1 (1)

    4/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    STATION

    INTERFACEPERSONAL

    COMPUTER

    POWER SUPPLYZIGBEEMODULE

    ANT

  • 8/7/2019 railway1 (1)

    5/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    3.BLOCK DIAGRAM EXPLANATION

    The block diagram of railway management system involves 2 sections. They are

    1. Train

    2. Railway Station

    Our project is the concept of self position identification in trains. Mainly it has

    two parts. One part is situated in the train and rest is railway station. The entire system

    consists of GPS module, ZIGBEE module, PC, a PIC microcontroller. This project

    has two regions

    1. Train

    2. Station

    TRAIN

    Each train consists of a GPS module which is used to determine the current

    latitude and longitude of the train. These data is displayed and voice message played

    in the train cabinets .GPS data is then sent to station through ZIGBEE module.

    ZIGBEE is a transmitting and receiving module. The corresponding place name can

    also see in the LCD display.

    RAILWAY STATION

    The railway station consists of another ZIGBEE module and a PC. ZIGBEE

    receiver is used to accrue data from train in a particular location these data includes

    the position of the train. This data is displayed in the PC. Trains controlling is done

    from the station, this options helps to start or stop the train engine. Start and stop

    commands are sent through ZIGBEE module

  • 8/7/2019 railway1 (1)

    6/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    ZigBee module: This block is used for wireless data transmission.

    GPS module: This is for locating the vehicle by using satellites,

    RS 232 interface: This is used for inter connecting ZigBee and GPS to PIC.

    LCD: It is used for displaying the name of the places in the screen.

    Buzzer: This is used for inviting the attention of passengers producing sound.

    Driver circuit, Geared motor: Controlling the train.

    Power supply: This is used for providing power for all circuits.

    4. HARD WARE SECTION

    4.1 CIRCUIT DIAGRAM

    RAILWAY MANAGEMENT SYSTEM

  • 8/7/2019 railway1 (1)

    7/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    4.2 CIRCUIT DESCRIPTION & WORKING

    CIRCUIT OPERATION

    TRAIN

    When we power on the system PIC waits until the power supply and crystal

    oscillator become stable then starts to execute programs written in EEPROME, then

    sends a block of data (welcome) to LCD display.PIC receives the data from GPS and

    checks the data with internal ROM memory and identify place. This name is

    displayed through LCD and played, also sent place name to railway station by

    ZigBee.

    If any data received by the ZigBee module it is given to PIC .It check which

    signal is received. If it is for start engine, give a pulse to transistor based circuit

    driver. Here transistor acts as a switch. When a pulse is received in the base terminal

    of transistor it become ON and motor starts running. If the signal is for stop the train,

    then transistor becomes OFF, finally motor stops its working.

    Train has an IR LED source, also this generates continues IR signals.

    STATION

    Station containing PC special software is installed on it for proper

    communication. ZigBee module collects information about train name, its position.

    These datas can be viewed in the PC .We can also sent start and stop command to

    train for start train or stop train. Station name is sent to train when the train reaches.

    ZigBee and PC communication is achieved by RS232 interface.

  • 8/7/2019 railway1 (1)

    8/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    4.3 THEORY

    MICRO CONTROLLER - PIC16F877A

    PIC stands for Peripheral Interface Controller. The original PIC was built to be

    used with General Instruments' new 16-bit CPU, the CP1600. While generally a good

    CPU, the CP1600 had poor I/O performance, and the 8-bit PIC was developed in 1975

    to improve performance of the overall system by offloading I/O tasks from the CPU.

    The PIC used simple microcode stored in ROM to perform its tasks, and although the

    term wasn't used at the time, it shares some common features with RISC designs.

    Peripheral Features

    y Timer0: 8-bit timer/counter with 8-bit prescaler

    y Timer1: 16-bit timer/counter with prescaler, can be incremented during sleep

    via external Crystal/clock

    y Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler

    y Two Capture, Compare, PWM modules

    - Capture is 16-bit, max. resolution is 12.5 ns

    - Compare is 16-bit, max. resolution is 200 ns

    - PWM max. resolution is 10-bit

    y 10-bit multi-channel Analog-to-Digital converter

    y Synchronous Serial Port (SSP) with SPI (Master Mode) and

    I2C(Master/Slave)

    y Universal Synchronous Asynchronous Receiver

    y Transmitter (USART/SCI) with 9-bit address detection

    y Parallel Slave Port (PSP) 8-bits wide, with

    y external RD, WR and CS controls (40/44-pin only)

    y Brown-out Reset (BOR)

  • 8/7/2019 railway1 (1)

    9/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    The microcontroller we use in this project is pic16F877A. First set up the

    basic configurations of the microcontroller ie; reset, power supply and clock. Reset is

    gives at the pin 1. The PIC programmer requires a +5 volt and a +13 volt regulated

    power supply. It provided at the pin 11 and 32. Pins 31 and 12 are ground. The PIC

    microcontrollers all have built-in RC oscillator circuits available, although they are

    slow, and have high granularity. External oscillator circuits may be applied as well, up

    to a maximum frequency of 20MHz. PIC instructions require 4 clock cycles for each

    machine instruction cycle, and therefore can run at a maximum effective rate of

    5MHz. By using a crystal oscillator a 4 MHz clock is given at the pin 13 and 14.

    Fig:- Pin diagram of PIC16F877A

    PIC 16F877 PINOUT DESCRIPTION

  • 8/7/2019 railway1 (1)

    10/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    Pinname Dip

    pin

    #

    Plccpin

    #

    I/O/O

    type

    Buffer

    type

    description qfp

    Osc/clkin

    Osc/clkout

    13

    14

    14

    15

    1

    0

    St/cmos

    -

    Osc.crystal

    i/p.

    osc.crystal

    o/p

    30

    31

    MCLR/Vpp 1 2 i/p st Master

    clear i/p or

    pgm o/p.

    18

    RA0/AN0

    RA1/AN1

    RA2/AN2/VREF-

    RA3/AN3/VREF+

    RA4/TOCK1

    RA5/SS/AN4

    2

    3

    4

    5

    6

    7

    3

    4

    5

    6

    7

    8

    I/O

    I/O

    I/O

    I/O

    I/O

    I/O

    TTL

    TTL

    TTL

    TTL

    SL

    TTL

    Port A is bi

    directional

    i/p .

    19

    20

    21

    22

    23

    24

    RB0/INT

    RB1

    RB2

    RB3/PGM

    RB4

    RB5

    RB6/PGC

    RB7/PGD

    33

    34

    35

    36

    37

    38

    39

    40

    36

    37

    38

    39

    41

    42

    43

    44

    I/O

    I/O

    I/O

    I/O

    I/O

    I/O

    I/O

    I/O

    TTL/ST1

    TTL

    TTL

    TTL

    TTL

    TTL

    TTL/ST2

    TTL/ST2

    Port B is a

    bi

    directional

    i/o port.

    Port b can

    be s/w

    pgmed forpull up on

    8

    9

    10

    11

    14

    15

    16

    17

  • 8/7/2019 railway1 (1)

    11/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    PROGRAM MEMORY

    The PIC 16F87x devices have a 13-bit program counter, Capable of

    addressing an 8K x 14 program memory space. The PIC 16F877 has 8Kx 14 words of

    FLASH program memory. The RESET Vector is at 0000h and the interrupt vector is

    at 0004h.

    DATA MEMORY

    Data memory is partition in to multiple banks which contain the general

    purpose registers and special function registers. Bits RP1(status ) and

    RP0(status) are the banks bits.

    RP1:RP0 BANK

    00 0

    01 1

    10 2

    11 3

    Each bank extends up to 7Fh (128bits). The lower location of each banks are

    Reserved for the special function registers. About the special function registers are

    general purpose registers, implemented as the static RAM. All implemented banks

    contain special function registers .Some frequently used special function register from

    1 bank may be mirrored in another bank for code reduction and quicker access.

  • 8/7/2019 railway1 (1)

    12/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    GENERAL PURPOSE REGISTER

    The register file can be accessed either directly, or indirectly through the file

    select register (FSR)

    SPECIAL PURPOSE REGISTER

    The Special purpose registers are registers used by the CPU and peripheral

    modules for controlling the desired operation of the devices. These devices are

    implemented as static RAM. Some examples of the SFRs are INDF, OPTION_REG,

    FSR, PCLATH etc.

    STATUS REGISTER

    The Status register contains the arithmetic status of the ALU, the RESET

    status and the bank select bits for data memory. The STATUS register can be the

    destination for any instruction, as with any other register.

    R/W-0 R/W-0 R/W-0 R-1 R-1 R/W-x R/W-x R/W-x

    IRP RP1 RP0 TO PD Z DC C

    Bit 7 Bit 0

    BIT 7 IRP: Register Bank select bit

    1=Bank 2, 3(100h-1FFh)

    0=Bank 0, 1(00h-FFh)

    Bit 6-5 RP1:RP0: Register bank selects bits

    Bit 4 TO: time out bit

    Bit 3 PD: power down bit

  • 8/7/2019 railway1 (1)

    13/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    Bit 2 Z: Zero bit

    Bit 1 DC: Digit carry

    Bit 0 C: Carry

    I/O PORTS ASSOCIATED WITH PIC 16F877

    Some pins for these I/O ports are multiplexed with an alternate function for

    the peripheral features on the device. PIC16F877 have FIVE ports (Port A, B,C, D,

    E).

    PORT A & TRIS A Registers

    Port A is a 6-bit wide, bit wide, bi-directional port. The corresponding data

    direction register is TRISA. Setting a TRISA bit will make the corresponding Port Apin as input. Clearing a TRISA bit will make the corresponding Port A pin as output.

    Pin RA4 is multiplexed with the Timer 0 module clock input to become the

    RA4/T0CK1 pin. The RA4/T0CK1 pin is a Schmitt Trigger input and an open drain

    output. All other Port A pins have TTL input levels and full CMOS output drivers.

    Other Port A pins are multiplexed with analog input and analog Vref input. The

    operation of each pin is selected by cleaning/setting the control bits in the ADCON1

    register.

    TRISA register controls the direction of the RA pins, even when they are used

    as analog inputs. The user must ensure the bits in the TRISA register are maintained

    set when using them as analog inputs.

    PORT B AND THE TRISB REGISTER

    PORTB is an 8-bit wide, bi-directional port. The corresponding data direction

    register is TRISB. Setting a TRISB bit will make the corresponding PORTB pin an

    input. Clearing a TRISB bit make the corresponding PORTB pin an output.

    Three pins of PORTB are multiplexed with the Low Voltage Programming function:

    RB3/PGN, RB6/PGC and RB7/PGD. The alternate functions of these pins are

    described in the Special Features Section.

  • 8/7/2019 railway1 (1)

    14/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    Each of the PORTB pins has a weak internal pull-up. A single control bit can

    turn on all the pull-ups. This is performed by cleaning bit RBPU

    (OPTION_REG). The weak pull-up is automatically turned off when the port pin

    is configured as an output. The pulls are disabled on a Power-on Reset.

    Four of the PORTB pins, RB7:RB4 have interrupt on change feature. Only pins

    configured as inputs can cause this interrupt to occur. The input pin (RB7:RB4) are

    compared with the old value latched on the last read of PORTB. The Mismatch

    output of RB7:RB4 are ORed together to generate the RBPORT change interrupt

    with flag bit RBIF (INTCON).

    This interrupt can wake the device from SLEEP. A mismatch condition will continue

    to set flag bit RBIF. Reading PORTB will end the mismatch condition and allow flag

    bit RBIF to be cleared

    PORTC AND THE TRISTC REGISTER

    PORTC is an 8 bit wide, bi-directional port. The corresponding data direction

    register is TRISC. Setting TRISC bit (=1) will make the corresponding PORTC pin an

    input. Clearing TRISC bit (=0) will make the corresponding PORTC pin an output.

    PORTC is multiplexed with several peripheral functions. PORTC pin have SCHMITT

    Trigger input buffers. When the I2C module is enabled the PORTC pin can be

    configure with normal I2C levels.

    PORT D AND THE TRIS D REGISTER

    PORT D is an 8-bit port with Schmitt trigger input buffers. Each pin is

    individually configurable as an input or output.

    PORT E AND THE TRIS E REGISTER

    PORT E has three pins which are individually configurable as input or output

    .The PORT E pins becomes I/O control inputs for the microprocessor port when bit

    PSPMODE(TRIS) is set .PORT E p ins are multiplexed with analog input . TRISE

    controls the direction of the RE pins.

    TIMER MODULE

  • 8/7/2019 railway1 (1)

    15/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    TIMER0 MODULE

    The TIMER0 module timer /counter have the following features:

    8-bit timer/counter

    Readable and writable

    8-bit software programmable pre scalar

    Internal or external clock select

    Interrupt on overflow from FFh to 00h

    Edge select for external clock

    Timer mode is selected by clearing bit TOCS (OPTION_REG). In timer mode,

    the timer 0 module will increment every instruction cycle. Counter mode is selected

    by setting bit TOCS (OPTION-REG). In counter mode, TIMER0 will increment

    either on every rising or falling edge of pin RA4/TOCK1. The pre scalar is mutually

    exclusively shared between the timer0 module and the watch dog timer.

    TIMERO INTERRUPT

    The TMR0 interrupt is generated when the TMR0 register overflows from FFh

    to 00h . This overflow sets bit TOIF (INTCON).

    USING TIMER0 WITH AN EXTERNAL CLOCK

    When no pre scalar is used the external clock is the same as the pre scalar output.

    PRE SCALAR

    There is only one pre scalar available, which is mutually exclusively shared

    between the TMR0 module and the watch dog timer. A pre scalar assignment for the

    TMR0 module means that there is no pre scalar for the watch dog timer, and vice

    versa. This pre scalar is not readable or writable. The PSA and PS2:PS0 bits

    (OPTION_REG) determine the pre scalar assignment and pre scalar ratio.

    R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W1

    RBPU

    INTEDG TOCS TOSE PSA PS2 PS1 PS0

  • 8/7/2019 railway1 (1)

    16/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    Bit7 Bit0

    Bit 7 RBPU

    Bit 6 INTEDG

    Bit 5 T0CS: TMR0 clock source select bit

    1=transition on TOCK1 pin

    0= internal instruction cycle clock (CLKOUT)

    Bit 4 T0SE: TMRsource edge select bit

    1=increment on high-to-low transition on T0CK1 pin

    0=increment on low-to-high transition on T0CK1 pin

    Bit 3 PSA: pre scalar assignment bit

    1= pre scalar is assigned to the watch dog timer

    0=pre scalar is assigned to the timer 0 module

    Bit 2-0 PS2:PS0: pre scalar rate select bits

    Bitvalue TMR0 RATE WDT RATE

    000 1:2 1:1

    001 1:4 1:2

    010 1:8 1:4

  • 8/7/2019 railway1 (1)

    17/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    011 1:16 1:8

    100 1:32 1:16

    101 1:64 1:32

    110 1:128 1:64

    111 1:256 1:128

    REGISTERS ASSOCIATED WITH TMR0

    The registers associated with TMR0 are TMR0, INTCON, and OPTION_REG.

    TIMER 1 MODULE

    The timer 1 module is a 16 bit timer/counter consisting of two 8-bit registers

    (TMR1H and TMR1L), which are readable and writable. The TMR1 register pair

    (TMR1H:TMR1L) increment from 0000h to FFFFh and rolls over to 0000h .The

    TMR1 interrupt, if enabled, is generated on over flow, which is latched in interrupt

    flag bit TMR1IF( PIR1).This interrupt can be enabled /disabled by setting

    /clearing TMR1 interrupt enable bitTMR1IE(PIE1).

    TIMER 1 can operate in one of two modes:

    y As a timer

    y As a counter

    The operating mode is determined by the clock select bit, TMR1CS

    (T1CON).

    U-0 u-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0

    - -

    T1CKPS1 T1CKPS0 TIOSCEN T1SYNC TMR1CS TMR1ON

  • 8/7/2019 railway1 (1)

    18/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    Bit 7 bit 0

    Bit 7-6 unimplemented

    Bit5-4 TICKPS1:T1CKPS0: TIMER 1 input clock pre scale select bits

    Bit 3 T1OSCEN:Timer1 oscillator enable control bit

    1= oscillator is enabled

    0= oscillator is shut-off

    Bit 2 T1SYNC:TMR1 external clock input synchronization control bit

    Bit 1 TMR1CS:TMR1 clock source select bit

    Bit 0 TMR1ON: TMR1 on bit

    TIMER1 OPERATION IN TIMER MODE

    TIMER mode is selected by clearing the TMR1CS (T1CON) Bit. In this mode

    the input clock to the timer isFosc/4.The synchronize control bit T1SYNC

    (T1CON) has no effect, since the internal clock is always in sync.

    RESETTING OF TIMER1 REGISTER PAIR(TMR1H,TMR1L)

    TMR1H and TMR1L registers are not reset to 00h on a PORT, or any other

    RESET, except by the CCP1 and CCP2 special event triggers. T1CON registers is

    reset to 00h on a power on Reset, or a Brown-out RESET ,which shuts off the timer

    and leaves a 1:1 pre scale .

    TIMER2 MODULE

    TIMER2 is an 8-bit timer with a pre scalar and a post scalar. It can be used as the

    PWM time base for the PWM mode of the CCP modules .The TMR2 registers is

    readable and writable, and is cleared on any device RESET.

    The input clock has a pre scale option of 1:1,1:4,1:16,selected by control bits

    T2CKPS1:T2CKPS0(T2CON

  • 8/7/2019 railway1 (1)

    19/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    It has an 8 bit period register, PR2.TMR2 increments from 00h until it

    matches PR2and then reset to 00h on the next increment cycle.PR2 is a readable and

    writable register.PR2 register is initialized to FFh up R/W-0on RESET.

    U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0

    - TOUTPS

    3

    TOUTPS

    2

    TOUTPS

    1

    TOUTPS

    0

    TMR2O

    N

    T2CKPS

    1

    T2C

    KP

    Bit7 bit0

    Bit 7 unimplemented

    Bit 6-3 TOUTPS3: TOUTPSO: Timer2 Output Post scale selected bits

    Bits 2 TMR2ON: Timer 2 on bit

    Bit 1-0 T2CKPS1:T2CKPS0: Timer 2 Clock Presale Select bits

    Timer 2 prescaler and Postscaler

    The prescale and postscaler counters are cleared when any of the following occurs:

    y A write to the TMR2 register

    y A write to the T2CON register

    y Any device reset

    y TMR2is not cleared when T2CON is written.

    ANALOG TO DIGITAL CONVERTER MODULE

    The analog to digital converter module has 8 inputs for the 40 pin PIC .The A/D

    module has 4 register.

    y A/D results high register.

    y A/D results low register

    y A/D control register 0.

  • 8/7/2019 railway1 (1)

    20/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    y A/D control register 1.

    The A/D conversion of the analog input signals in a corresponding 10-bit digital

    number.

    ADCON0 REGISTER

    R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 U-0 R/W-0

    ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE ------ ADCON

    ADCON1 REGISTER

    U-0 U-0 R/W-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0

    ADFM - - - PCFG3 PCFG2 PCFG1 PCFG0

    USART

    This mode is usually used to communicate in 8-bit ASCII code. It has two

    pins for transmittion and reception.Transmission. begins whenever data is written to

    SBUF .USART is an acronym for universal synchronous asynchronous receiver and

    transmitter.

    Control Register Of Transmission. (Txsta)

    CSRC TX 9 TxEN SYNC - BRGH TRMT Tx9D

    Control Register Of Reception (Rxsta)

  • 8/7/2019 railway1 (1)

    21/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    SPEN Rx9 SREN CREN ADDEN FERR OERR Rx9D

    Memory organization

    There are three memory blocks in each of these PICmicro MCUs. The

    Program Memory and Data Memory have separate buses so that concurrent access

    can occur and is detailed in this section. The PIC16F877/876 devices have 8K x 14

    words of FLASH program memory. The data memory is partitioned into multiple

    banks which contain the General Purpose Registers and the Special Function

    Registers.

    I/O PORTS

    Some pins for these I/O ports are multiplexed with an alternate function for

    the peripheral features on the device. In general, when a peripheral is enabled, that pin

    may not be used as a general purpose I/O pin. In PIC16F877X there are 5 PORTS.

    They are POARTA, POARTAB, POARTAC, POARTD and POARTE.

    POWER SUPPLY

    Power supply is used to give sufficient power to the microcontroller. A step

    down transformer and a bridge rectifier is used here to convert AC to DC. A regulator

    IC is also used here to give constant supply.7805 IC is used for power supply and it is

    connected to the bridge rectifier. This circuit can give +5V output at about 150 mA

    current, but it can be increased to 1 A when good cooling is added to 7805 regulator

    chip. The circuit has over overload and terminal protection.

    DISPLAY SECTION

  • 8/7/2019 railway1 (1)

    22/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    The LCD module, made by Crystallonics, is 16x2 line interactive displays. It

    needs a power supply of +5v. The module has inbuilt controller chip, such as an

    HD44780, which acts as an interface between CPU and the row and column drivers.

    The controller takes care of generating characters, refreshing the display, and so on.

    The module has a back light driven by a pair of pads separate from the interface pads

    .The LCD module works in two modes for communicating with the micro controller -

    8 bit (byte) mode & 4 bit (nibble) mode. In the later case only the higher nibble i.e.

    pins DB4-DB7 is used for communication. For controlling the LCD module we have

    used only the port D.

    LCD module

    INTERFACING

    The interfacing circuit used here is a comparator. The function of this circuit is

    to convert the voltage coming from the mobile to a level that is compatible with the

    microcontroller. Microcontroller works in the TTL voltage level standard, but the

    mobile transmits data in a level which is lower than the TTL level, i.e.-; for a logic

    HIGH the microcontroller expect an voltage greater than 3.5V but the mobile

    transmits a level which is less than 3V. so in order to receive the correct data we have

    to convert this voltage level. So we use a comparator circuit for interfacing mobile.

    RS-232 DRIVERS/RECERIVERS

    Electronic data communications between elements will generally fall into two

    broad categories: single-ended and differential. RS232 (single-ended) was introduced

    in 1962, and despite rumors for its early demise, has remained widely used through

    the industry. Independent channels are established for two-way (full-duplex)

    communications. The RS232 signals are represented by voltage levels with respect to

  • 8/7/2019 railway1 (1)

    23/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    a system common (power / logic ground). The RS-232 interface presupposes a

    common ground between the DTE and DCE.

    4.4 PCB LAYOUT

  • 8/7/2019 railway1 (1)

    24/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    4.5 PCB FABRICATION

    TRAIN

    Design and printed circuit board fabrication

    The PCB consists of an insulating base material on which copper conductors

    are etched by photolithography or screen printing. The insulating material provides

    electrical isolation and mechanical rigidity for the printed conductors, as such it

    should process the essential electrical and mechanical properties such as flexural,

    strength, responsible high temperature with standing capability, low moisture

    absorption war page, good merchantability, good electrical resistance, high

    dielectrical strength, low dilectrical constant, low dissipation factor etc.

    Photographic method of PCB fabrication

    Photographic method is another commonly used PCB fabrication method.

    Thjis is more expensive and widely used for mass production.

    Screen printing

    In this method a mesh is prepared and is placed over the copper sheets screen

    printing material is pasted over the area where the circuit is to be lied. All other areas

    are kept open.

    Different steps of PCB fabrication are listed below

    Cutting copper clad lamination

    Copper clad laminates are manufactured in 4 inchx3 inch size. From this sheet

    pieces are cut off to the required size using a shearing machine. For the purpose of

  • 8/7/2019 railway1 (1)

    25/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    handling PCB during fabrication, some extra space is required all around the border

    line of the PCB. Hence at least cutting PCB provides 10mm of additional space from

    the actual required PCB size.

    Cleaning

    Copper oxides may billed up on the copper cutting. In order to remove this

    following procedure is required

    1. Wipe with cotton wool. Socked in try chloro ethelene.

    2. Dipping in 10% Hcl for 1 min at room temperature.

    3. Scrub with pumice powder.

    4. Observe he wetting of the water on copper surface. If the wetting is uniform

    without any break, the surface is clean. If islands of water are observed that

    area is unclean. Reclean until wetting is uniform, dry board using hot air jet.

    PCB layout designing and screen printing

    The PCB is designed using PCB design software Orcad Layout Plus. The

    PCB layout is designed as per the circuit diagram. The layout is then transferred to as

    transparent (butter) paper. This is then used for creating a PCB layout or the screen

    mesh.

    Etching

    Copper conductors are intended only at places where material is coated. The

    copper form remaining part is to be removed by a suitable method. It is called etching.

    The chemical bath, which does the etching, is called etchend. It is sprayed on the

    board surface until unwanted copper is completely removed.

    Neutralizing

  • 8/7/2019 railway1 (1)

    26/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    After etching, the PCBs are washed in tap water. It may still carry some

    element which may be present in the presence of moisture. Hence the bolts are

    neutralizing 10% of solution of Oxalic acid and thoroughly washed.

    Drilling

    The holes for mounting component are drilled using a high speed drilling

    machine. The machine is one, which specified for handling PCB. It should provide

    rotation per minute of 20000 for provision of continuous variation from zero to

    maximum. The size of the hole to be drilled in specified during layout design depends

    upon component lead diameter.

  • 8/7/2019 railway1 (1)

    27/44

    Adv

    ced Railway Manage

    ent Project re

    ort 2010-2011

    De

    t of EPT Govt.Polytec

    nic College Kalamassery

    5.SOFT ESE T ON5.1 FLOW CHART

    TRAIN

  • 8/7/2019 railway1 (1)

    28/44

    Advanced Railway Management Project re

    ort 2010-2011

    De

    t of EPT Govt.Polytec

    nic College Kalamassery

    STATION

    5.2 PROGRAM

    SOFTWARE TRAIN)

    #i cl "i i .h"

    #i cl

    #i cl

    #i cl

    #i cl "gps.h"

    #defi e Motor1 RC1

  • 8/7/2019 railway1 (1)

    29/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    #define Motor2 RC2

    #define MUX RD4

    #define Msg1 RD2

    #define Msg2 RD3

    #define Msg3 RC4

    #define Msg4 RC5

    #define RS RB7

    #define EN RB6

    #define LCD_D0 RB5 // lcd's msb nibble 0

    #define LCD_D1 RB4 // lcd's msb nibble 1

    #define LCD_D2 RB3 // lcd's msb nibble 2

    #define LCD_D3 RB2 // lcd's msb nibble 3

    unsigned char i;

    unsigned const char *msgWelcome1 ="ADVANCED RAILWAY";

    unsigned const char *msgWelcome2 =" MANAGEMENT S/M ";

    unsigned const char *msgBlank =" ";

    unsigned const char *GpsErrorMsg ="Sorry... No Satelite View";

    unsigned const char MsgContent[20] ={"Train location: \n"};

    //-------------------------

    void SendGPS (void){

    WriteUsartChar('A');

    if(Success){

    WriteUsart(DataBuff,25);}

    else{

    WriteUsartString(GpsErrorMsg);

    }

    WriteUsartChar(0x1A);

  • 8/7/2019 railway1 (1)

    30/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    }

    //-----------------------------

    void SendOK (void){

    WriteUsartChar(0x0A);

    WriteUsartString("OK");

    WriteUsartChar(0x1A);

    }

    //-----------------------------

    void ReadGps()

    {

    while(1)

    {

    Temp=0x00;

    while(Temp!='$')

    {

    while(UART1_Data_Ready()==0);

    Temp=UART1_read();

    }

    for(i=0;i

  • 8/7/2019 railway1 (1)

    31/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    Temp=UART1_read();

    }

    while(UART1_Data_Ready()==0);

    Temp=UART1_read();

    if(Temp=='A')

    {

    for(i=0;i

  • 8/7/2019 railway1 (1)

    32/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    Motor1=1;Motor2=1;SendOK();

    }

    else if (strcmp(DataBuff, " DISP")==0){

    lcd_puts(msgBlank,1,0);

    lcd_puts(msgBlank,2,0);

    lcd_puts(&DataBuff[7],1,0);

    for(i=0;i

  • 8/7/2019 railway1 (1)

    33/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    return(0);

    }

    //------------------------------

    void DispStandByMsg(void)

    {

    lcd_puts(msgWelcome1,1,0);

    lcd_puts(msgWelcome2,2,0);

    }

    //--------------------------

    void main(void){

    init();

    BlinkLED;

    lcd_init();

    Init_Usart(9600);

    initSoftUsart();

    DispStandByMsg();

    Msg1=1;Msg2=1;Msg3=1;Msg4=1;

    while (1){

    DataCnt=0;

    DataBuff[0]='0';

    while(!RxFlag);

    DelayMs(250);

    RxFlag=0;

    ProcessMsg();}

    }

    }

  • 8/7/2019 railway1 (1)

    34/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    6.PROJECT LAYOUT

  • 8/7/2019 railway1 (1)

    35/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    7.COST AND ESTIMATION

    PIC :Rs/-150

    LCD Module : Rs/-130

    GPS : Rs/-6500

    ZIGBEE : Rs/-3000

    7805 : Rs/-10

    BL100 : Rs/-4.50

    Resisters :0.50ps

    Electrolytic capacitor :1000mF: Rs/-10,100mF:

    Rs/-4

    Disk capacitor :0.50ps

    DC motor : Rs/-20

    Transformer 12V-1A : Rs/-100

    Bridge rectifier : Rs/-5

    PCB : Rs/-600

    Crystal oscillator : Rs/-5

  • 8/7/2019 railway1 (1)

    36/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    8.DATA SHEET AND DESIGN OF COMPONETS

    MICROCONTROLLER

    Microcontroller is the heart of the project. It is responsible for all the activities

    done inside the system. Here microcontroller used is microchips PIC 16F877A.In

    recharge section the Microcontroller scans the keyboard for any key press ad decodes

    the key pressed. According to the key pressed it writes the value to the memory of the

    smart card. In water meter section it reads the value from the smart card reader and

    stores in the internal EEPROM of the microcontroller. It also communicates with the

    driving unit ,IR sensor water meter, display unit, locking unit and alarm.

    GPS MODULE

    Global positioning system (GPS)

    Global position system (GPS) is a network of satellites that continuously transmit

    coded information, which makes it possible to precisely identify locations on earth by

    measuring distance from the

    satellites.GPS receivers are used for

    position, locating, navigating, surveying

    and determined of the objects. Using the

    global positioning system the following

    two values can be determined anywhere

    on earth.

    Ones exact location (longitude,

    latitude and height co-ordinates)

    accurate to within a range of 20m

    to approx.1mm.

  • 8/7/2019 railway1 (1)

    37/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    The precise time (universal time coordinated, UTC) accurate to within a

    range of 60ns to approx. 5ns speed and direction of travel

    GPS receivers are used for positioning ,locating, navigating, surveying and

    determining the time and are employed by individuals

    Module features

    200,000 effective correlates for fast TTFF

    20 channels All-In-View tracking

    Cold/Warm/Hot start time: 42/38/1 sec. (average)

    Superior sensitivity: -159dBm tracking

    Built-in SiRF Star III chipset

    Reacquisition time: 0.1 sec.

    Low power design (75mA, tracking)

    Build-in low noise, high gain active antenna

    Super-cohesive magnetic for installation

    ZIGBEE/XBEE MODULE

    The XBee/ZBee (formerly known as Series 2 and Series 2 PRO) RF Modules

    were engineered to operate within the ZigBee protocol and support the unique needs

    of low-cost, low-power wireless sensor networks. The modules require minimal

    power and provide reliable delivery of data between remote devices. The modules

    operate within the 2.4 GHz frequency band.

    MOUNTING CONSIDERATIONS

    The XBee modules were designed to mount into a receptacle (socket) and

    therefore does not require any soldering when mounting it to a board. The XBee PRO

    Development Kits contain RS-232 and USB interface boards which use two 20-pin

    receptacles to receive modules. Figure below XBee PRO 2.5 Module Mounting to

    an RS 232 Interface Board.

  • 8/7/2019 railway1 (1)

    38/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    DISPLAY SECTION

    Here for the display an LCD module is used. The advantage of using LCD

    display over 7-segment or Led is that LCD can display alphanumeric characters (i.e.-;

    both alphabets and numbers). Another advantage is that LCD does not require

    constant refreshing, which reduces the complexity of the software.

    LCD MODULE

    Liquid crystal displays are generally more flexible than LED displays

    because they allow for a variety of text and/or graphics. LCDs require less power

    LEDs making them suitable for low power requirements.The LCD module, made by

    Crystallonics, is 16x2 line interactive displays. It needs a power supply of +5v. The

    module has inbuilt controller chip, such as an HD44780, which acts as an interface

    between CPU and the row and column drivers. The LCD module works in two modes

    for communicating with the micro controller - 8 bit (byte) mode & 4 bit (nibble)

    mode. In the later case only the higher nibble i.e. pins DB4-DB7 is used for

    communication.

    PINOUT DESCRIPTION

  • 8/7/2019 railway1 (1)

    39/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    PIN NO. SYMBOL FUNCTION

    1 Vss Ground

    2 Vdd +5v

    3 Vo Contrast Adjust

    4 RS(H/L) Register Select

    H=Data/L=Instruction

    5 R/W (H/L) Read/Write

    H=Rread/L=Write

    6 E Enable

    7 DB0 Data Pin 1

    8 DB1 Data Pin 2

    9 DB2 Data Pin 3

    10 DB3 Data Pin4

    11 DB4 Data Pin 5

  • 8/7/2019 railway1 (1)

    40/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    12 DB5 Data Pin 6

    13 DB6 Data Pin 7

    14 DB7 Data Pin8

    15 BL- Back Light

    16 BL+ Back Light

    Contrast: A variable voltage applied to this pin controls the contrast. Use a

    potentiometer and adjust until you see the background.

    Register Select: This pin selects whether you are sending the module a command or

    data.

    Read/Write: This pin allows for bi-directional communications. For the discussions

    here, Uni-directional communications will be used. Ground this pin.

    Enable: This is the latch pin. A high-to-low transition causes the value on the data

    lines to be latched by the module.

    DB0-DB7: Apply the data or commands to these pins.

    PRINTING CHARACTERS

    To print a character to set the RS high, place the ASCII value on the data pins, and the

    latch the data. The character will appear on the screen at the current cursor location. A

    60s delay must occur between characters.

    CIRCUIT DRIVER AND MOTOR

    The circuit driver unit is used to drive the dc motor .These three dc motor units

    are used they are for train engine, temperature controlling and gate operation. Circuit

    driver consist of a transistor BL100 which drives the dc motor.

  • 8/7/2019 railway1 (1)

    41/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    POWER SUPPLY

    The power supply is used to supply the necessary power to the different units. The

    power supply biases all the ICs used in the system and drive the motors. RB151 is

    used for bridge rectification. The system needs a 5V supply for the main board and a

    12V supply for the motor driving.5 volt supply is provided by positive voltage

    regulator 7805.

    Fig.7805 Fig.RB151

    7805 REGULATOR IC

    In the system IC 7805 is used to supply regulated voltage to the main board.

    DESCRIPTION

    The UTC 78XX is monolithicfixed voltage regulator integrated circuit.They

    are suitable for applications that requires supply current up to 1A.

    FEATURES

    *Output current up to 1.5A

    *Fixed output voltages of5V,6V,8V,9V,10V,12V,15V,18Vand 24V are available.

  • 8/7/2019 railway1 (1)

    42/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    *Thermal overload shutdown protection

    *Short circuit current limiting

    The maximum steady state usable uotput current are dependent on input

    voltage,heat sinking,lead length of the package and copper pattern of PCB.They have

    power dissipation < 0.5 W.to specify an output voltage substitute voltage

    valuesforXX.Bypass capacitors are recommended foroptimum stability and

    transient response and should be located as close as possible to the regulators.

  • 8/7/2019 railway1 (1)

    43/44

    Advanced Railway Management Project report 2010-2011

    Dept of EPT Govt.Polytechnic College Kalamassery

    9.CONCLUTION

    The project ADVANCED RAILWAY MANAGEMENT SYSTEM helps to

    monitor the position of a train accurately. It provides you fast and easy access to the

    time schedule and travel information you really need. Combined with comprehensiveGPS tracking software, it delivers detailed fleet tracking position and send to station

    .location name will displayed on the screen in the cabinet .Computerized controlling

    system helps reduce collisions between trains. Automated gate system provides the

    intelligent opening and closing the railway gate.

  • 8/7/2019 railway1 (1)

    44/44

    Advanced Railway Management Project report 2010-2011

    10. BIBILIOGRAPHY

    http://books.google.com/books?id=OkL1Smk4uiAC&dq. p.841

    http://www.microchip.com/

    http://www.electronicsforyou.com/

    http://www.datasheetcatalog.com /

    http://www.analog.com

    http:// www.dallas.com

    http://www.maxim.com

    http://www.mikroe.com