You are on page 1of 51

ABSTRACT:

In our project “AUTOMATIC METAL CRACK DETECTOR” beings


with an introduction to track Inspection and it’s various applications. The sensors are used
to detect the crack in the track automatically and this signal is given to alarm unit. This is
a very efficient method of checking the cracks in the railway track and this is to be used in
modern engineering industries. The manual efforts can be completely avoided by using
this modern equipment

The project relates to the location of singular points in the automatic control of railway tracks.

According to a possible embodiment, the railway carriage carrying the control equipment is

provided with sensor oriented to detect the track. The status is monitored by the sensor and transfer

through the modules. For easy delay surveying and with less delay the information is indicated by

means of buzzer to avoid the accident and to safeguard the people. We hope that our idea can be

implemented in the long run to facilitate better safety standards and provide effective testing

infrastructure for achieving better results

1
INTRODUCTION

The project consists of microcontroller, IR sensor, SCU, Alarm, Relay and DC

motor. This project pertains to a process for monitoring the condition of defects detected by

monitoring equipment on the tracks to be checked to allow maintenance crews to subsequently

find these defects.

When we give the supply to the device, the DC motor gets start throughrelay driver circuit. Two

IR sensors are fixed in front of the train is used to find out the crack on the rail. Each sensor will

produce the signal related position with the rail. If the track is normal on its position both the sensor

gives the constant sensed output. If any one misses their output condition to fail then there is defect

on that side.

2
BLOCKDIAGRAM:

OPTICAL ALARM
OPTICAL TRANSMITTER
RECEIVER
CIRCUIT
CIRCUIT

3
S.no Components used Specification No. of
components
required
1 PIC microcontroller 16F877A 1
2 IR transmitter 1
3 IR receiver 1
4 Robot chasis Metal 1
5 Dc gear motors 12V 4
6 Wheels 4
7 SCU 1
8 Driver circuit L293 1
9 Capacitors 104 4
22pf 2
10 Resistors 10K 1
1K 2
11 LED 3mm 2

COMPONENTS USED

4
HARDWARE PART

STEP-1

Before making a vehicle there is a necessity of a paper plan. Measure length of the
motor (excluding shaft), diameter of shaft of the motor, inner hole diameter of the motor. Draw a
rough sketch of the base you need to cut keeping in mind the placement of motors and wheels.

5
STEP-2

Chassis is a mechanical assembly for making a 4 wheel drive platform. Where you can mount
any controller board to drive your bot. This is just the mechanical chassis, Optionally as shown in
the figure you can use 4 DC geared motors, 1 castor and 4 wheels with rubber rings so you can
make both variants.

6
STEP-3

Fit the GE metal size wheel at position show in above diagram with 1.5-2 inches (approx.)
screw. Fit the dc motor into the holes of chassis and couple the wheel by using screw or rubber
tube

COMPONENTS

DESCRIPTION:-

LCD:-

Liquid Crystal Displays (LCDs) are categorized as none missive display devices, in that
respect, they do not produce any form of light like a Cathode Ray Tube (CRT). LCDs either pass

7
or block light that is reflected from an external light source or provided by a back/side lighting
system.

There are two modes of operation for LCDs:

a. Normal White mode: the display is white or clear and allows light to pass through.

b. Normal Black Mode: the display is dark and all light is diffused. Virtually all
displays in production for PC/Workstation use are normal white mode to optimize
contrast and speed.

Polarizers are an integral part of a LCD display, possessing the unique property of only
passing light if it is oriented in a specific (oriented) direction. To utilize this phenomenon in TN
LC displays, the bottom polarizer orients incoming light in one direction. The oriented light passes
through the LC material and is either unaltered or "bent" 90 degrees.

Depending on the orientation of the top polarizer, this light will either pass through or be
diffused. If the light is diffused, it will appear as a dark area.

8
DIODE:-

A diode is a two-terminal electronic component that conducts electric current in only one
direction. The term usually refers to a semiconductor diode, the most common type today, which
is a crystal of semiconductor connected to two electrical terminals, a P-N junction.

The most common function of a diode is to allow an electric current in one direction (called
the diode's forward direction) while blocking current in the opposite direction (the reverse

9
direction). Thus, the diode can be thought of as an electronic version of a check valve. This
unidirectional behavior is called rectification, and is used to convert alternating current to direct
current, and remove modulation from radio signals in radio receivers.

RESISTORS

The electrical resistance of an object is a measure of its opposition to the passage of a steady
electric current. An object of uniform cross section will have a resistance proportional to its length
and inversely proportional to its cross-sectional area, and proportional to the resistivity of the
material.

10
The resistance of a resistive object determines the amount of current through the object for
a given potential difference across the object, in accordance with Ohm's law:

I =V/R

Where

R is the resistance of the object, measured in ohms, equivalent to J·s/C2

V is the potential difference across the object, measured in volts

I is the current through the object, measured in amperes

For a wide variety of materials and conditions, the electrical resistance does not depend on the
amount of current through or the amount of voltage across the object, meaning that the resistance
R is constant for the given temperature and material. Therefore, the resistance of an object can be
defined as the ratio of voltage to current. In the case of nonlinear objects (not purely resistive, or
not obeying Ohm's law), this ratio can change as current or voltage changes; the ratio taken at any
particular point, the inverse slope of a chord to an I–V curve, is sometimes referred to as a "chordal
resistance" or "static resistance".[

11
CRYSTAL OSCILLATOR

A crystal oscillator is an electronic circuit that uses the mechanical resonance of a


vibrating crystal of piezoelectric material to create an electrical signal with a very precise
frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to
provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio
transmitters and receivers. The most common type of piezoelectric resonator used is the quartz
crystal, so oscillator circuits designed around them were called "crystal oscillators".

12
Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of
megahertz.

A quartz crystal can be modelled as an electrical network with a low impedance (series)
and a high impedance (parallel) resonance point spaced closely together.

VOLTAGE REGULATOR

A voltage regulator is an electrical regulator designed to automatically maintain a constant


voltage level. It may use an electromechanical mechanism, or passive or active electronic
components. Depending on the design, it may be used to regulate one or more AC or DC voltages.

Voltage regulators operate by comparing the actual output voltage to some internal fixed
reference voltage. Any difference is amplified and used to control the regulation element in such
a way as to reduce the voltage error. This forms a negative feedback control loop; increasing the

13
open-loop gain tends to increase regulation accuracy but reduce stability (avoidance of oscillation,
or ringing during step changes). There will also be a trade-off between stability and the speed of
the response to changes.

If the output voltage is too low the regulation element is commanded to produce a higher
output voltage - by dropping less of the input voltage or to draw input current for longer periods

if the output voltage is too high the regulation element will normally be commanded to
produce a lower voltage. However, many regulators have over-current protection, so that they will
entirely stop sourcing current (or limit the current in some way) if the output current is too high,
and some regulators may also shut down if the input voltage is outside a given range

CAPACITOR
A capacitor or condenser is a passive electronic component consisting of a pair of
conductors separated by a dielectric (insulator). When a potential difference (voltage) exists across
the conductors, an electric field is present in the dielectric. This field stores energy and produces
a mechanical force between the conductors. The effect is greatest when there is a narrow separation
between large areas of conductor, hence capacitor conductors are often called plates.

Capacitors are widely used in electronic circuits to block the flow of direct current while allowing
alternating current to pass, to filter out interference, to smooth the output of power supplies, and

14
for many other purposes. They are used in resonant circuits in radio frequency equipment to select
particular frequencies from a signal with many frequencies.

TYPES OF CAPACITOR:

15
Aluminum Electrolytic Capacitors

Axial Leads Radial Leads Computer Grade Snap Mount Twist Lok Surface Mount

Tantalum Capacitors

Solid Tantalum Solid Tantalum Foil Tantalum Dipped


Wet Tantalum Surface Mount
( Axial Leads ) ( Radial Leads ) ( Axial Leads ) Tantalum

Ceramic Capacitors

Monolithic Monolithic
Dip Guard Disc Surface Mount
( Axial Leads ) ( Radial Leads )

Film Capacitors

16
Polyester Polyester Polypropylene Polypropylene Polystyrene
( Axial Leads ) ( Radial Leads ) ( Axial Leads ) ( Radial Leads ) ( Axial Leads )

Mica Capacitors

Dipped Mica Metal Clad Transmitting

Oil Capacitors

Hermetically Sealed Hermetically Sealed


( Axial Leads ) ( Radial Leads )

Other Capacitor Types

Vacuum Capacitors Trimmers Feed Thru

MOMENTARY SWITCH

In electronics, a switch is an electrical component that can break an electrical circuit,


interrupting the current or diverting it from one conductor to another.

17
The most familiar form of switch is a manually operated electromechanical device with one
or more sets of electrical contacts.

Each set of contacts can be in one of two states: either 'closed' meaning the contacts are
touching and electricity can flow between them, or 'open', meaning the contacts are separated
and nonconducting.

A switch may be directly manipulated by a human as a control signal to a system, such as a


computer keyboard button, or to control power flow in a circuit, such as a light switch.
Automatically-operated switches can be used to control the motions of machines, for example,
to indicate that a garage door has reached its full open position or that a machine tool is in a
position to accept another workpiece. Switches may be operated by process variables such as
pressure, temperature, flow, current, voltage, and force, acting as sensors in a process and used
to automatically control a system.

PIC MICROCONTROLLER

18
Microcontroller is a general purpose device, which will integrate a number of components
of a microprocessor system on to single chip. It has inbuilt CPU, memory and peripherals to make
it as a mini computer. A microcontroller combines on to the same microchip:

 The CPU core


 Memory (both ROM and RAM)
 Some parallel digital I/O
Microcontrollers will combine other devices such as:

 A timer module to allow the microcontroller to perform tasks for certain time
periods
 A serial I/O port to allow data to flow between the controller and other devices such
as PIC or another microcontroller
 An ADC to allow the microcontroller to accept analog input data for processing
Microcontrollers are:

 Smaller in size
 Consumes less power
Microcontroller is a standalone unit, which can perform functions on its own without any
requirement for additional hardware like I/O ports and external memory. The heart of the
microcontroller is the CPU core. In the past, this has traditionally been based on a 8-bit
microprocessor unit. For example Motorola uses a basic 6800 microprocessor core in their
6805/6808 microcontroller devices. In the recent years, microcontrollers have been developed
around specifically designed CPU cores, for example the microchip PIC range of microcontrollers.

5.1 INTRODUCTION TO PIC

The microcontroller that has been used for this project is form PIC series. PIC
microcontroller is the first RISC based microcontroller fabricated in CMOS (Complimentary
Metal Oxide Semiconductor) that uses separate bus for instruction and data allowing simultaneous
access of program and data memory.

19
The main advantage of CMOS and RISC combination is low power consumption resulting
in a very small chip size pin count. The main advantage of CMOS is that it has immunity to noise
than other fabrication techniques.

PIC START PLUS PROGRAMMER

The PIC start plus development system from microchip technology provides the
product development engineer with a highly flexible low cost microcontroller design tool set for
all microchip PIC micro devices. This PIC start plus development system includes PIC start plus
development programmer and MPLAB IDE.

The PIC starts plus programmer gives the product developer ability to program user
software in to any of the support Ed microcontrollers. The PIC start plus software running under
MPLAB provides full interactive control over the programmer.

PIC (16F877A)

Various microcontrollers offer different kinds of memory. EEPROM, EPROM, FLASH


etc., are some of the memories of which FLASH is the most recently developed. Technology that
is used in PIC16F877A is flash technology, so that data is retained even when the power is switch
off. Easy programming and erasing are other features of PIC 16F877A.

FEATURES OF PIC MICROCONTROLLER:

CORE FEATURES

 Only 35 single-word instructions to learn


 All single-cycle instructions except for program branches, which are two-cycle
 Operating speed: DC – 20 MHz clock input DC – 200 ns instruction cycle
 Up to 8K x 14 words of Flash Program Memory
 Up to 368 x 8 bytes of Data Memory (RAM)
 Up to 256 x 8 bytes of EEPROM Data Memory
 Pinout compatible to other 28-pin or 40/44-pin
 PIC16CXXX and PIC16FXXX microcontrollers

20
PERIPHERAL FEATURES:

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


 Timer1: 8-bit timer/counter with prescaler, can be incremented during Sleep via
external crystal/clock
 Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler
 - 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
 Synchronous Serial Port (SSP) with SPI™ (Master mode) and I2C™
(Master/Slave)
 Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-
bit address detection
 Parallel Slave Port (PSP) – 8 bits wide with external RD, WR and CS controls
(40/44-pin only)
 Brown-out detection circuitry for Brown-out Reset (BOR)

21
PIN DIAGRAM

PIC SPECIFICATIONS
DEVICE PIC16F877A EEPROM 256 Bytes

PROGRAM MEMORY BYTES 14.3K I/O (Port A,B & C) 33

DATA MEMORY 368 Bytes USART Yes

FLASH PROGRAM MEMORY 8K TIMERS 8/16 BIT 2/1

22
ARCHITECTURE OF PIC 16F877A

The complete architecture of PIC16F877A is shown below,

Fig No: 5.2

When interfacing to the data memory block, EEDATA holds the 8-bit data for read/write
and EEADR holds the address of the EEPROM location being accessed. These devices have 128
or 256 bytes of data EEPROM (depending on the device), with an address range from 00h to FFh.
On devices with 128 bytes, addresses from 80h to FFh are unimplemented and will wraparound to

23
the beginning of data EEPROM memory. When writing to unimplemented locations, the on-chip
charge pump will be turned off.

MEMORY ORGANIZATION

There are three memory blocks in each of the PIC16F87XA devices. These are

 Program memory
 Data memory
 EEPROM memory

PROGRAM MEMORY ORGANIZATION

The PIC16F87XA devices have a 13-bit program counter capable of addressing an 8K


word x 14 bit program memory space. The PIC16F876A/877A devices have 8K words x 14 bits
of Flash program memory, while PIC16F873A/874A devices have 4K words x 14 bits. Accessing
a location above the physically implemented address will cause a wraparound. The Reset vector is
at 0000h and the interrupt vector is at 0004h.

DATA MEMORY ORGANIZATION

The data memory is partitioned into multiple banks which contain the General Purpose
Registers and the Special Function Registers. Bits RP1 (Status<6>) and RP0 (Status<5>) are the
bank select bits.

Each bank extends up to 7Fh (128 bytes). The lower locations of each bank are reserved for the
Special Function Registers. Above the Special Function Registers are General Purpose Registers,
implemented as static RAM. All implemented banks contain Special Function Registers. Some
frequently used Special Function Registers from one bank may be mirrored in another bank for
code reduction and quicker access.

24
DATA EEPROM AND FLASH PROGRAM MEMORY ORGANIZATION

The data EEPROM and Flash program memory is readable and writable during normal
operation (over the full VDD range). This memory is not directly mapped in the register file space.
Instead, it is indirectly addressed through the Special Function Registers.

When interfacing the program memory block, the EEDATA and EEDATH registers form
a two-byte word that holds the 14-bit data for read/write and the EEADR and EEADRH registers
form a two-byte word that holds the 13-bit address of the program memory location being
accessed. These devices have 4 or 8K words of program Flash, with an address range from 0000h
to 0FFFh for the PIC16F873A/874A and 0000h to 1FFFh for the PIC16F876A/877A. Addresses
above the range of the respective device will wraparound to the beginning of program memory.

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.

PORTA AND THE TRISA REGISTER

PORTA is a 6-bit wide, bidirectional port. The corresponding data direction register is
TRISA. Setting a TRISA bit (= 1) will make the corresponding PORTA pin an input (i.e., put the
corresponding output driver in a High-Impedance mode). Clearing a TRISA bit (= 0) will make
the corresponding PORTA pin an output (i.e., put the contents of the output latch on the selected
pin).

Reading the PORTA register reads the status of the pins, whereas writing to it will write to the port
latch. All write operations are read-modify-write operations.

Therefore, a write to a port implies that the port pins are read; the value is modified and
then written to the port data latch.

25
Pin RA4 is multiplexed with the Timer0 module clock input to become the RA4/T0CKI
pin. The RA4/T0CKI pin is a Schmitt Trigger input and an open-drain output. All other PORTA
pins have TTL input levels and full CMOS output drivers.

Other PORTA pins are multiplexed with analog inputs and the analog VREF input for both
the A/D converters and the comparators. The operation of each pin is selected by clearing/setting
the appropriate control bits in the ADCON1 and/or CMCON registers.

The TRISA register controls the direction of the port pins even when they are being used
as analog inputs. The user must ensure the bits in the TRISA register are maintained set when
using them as analog inputs.

PORTA FUNCTIONS

Name Bit# Buffer Function

RA0/AN0 bit 0 TTL Input/output or analog input

RA1/AN1 bit 1 TTL Input/output or analog input

RA2/AN2/VREF-/CVREF bit 2 TTL Input/output or analog input or VREF-

RA3/AN3/VREF+ bit 3 TTL Input/output or analog input or VREF+

RA4/T0CKI/C1OUT bit 4 ST -Input/output or external clock input for


Timer0 or comparator output

RA5/AN4/SS/C2OUT bit 5 TTL -Input/output or analog input or slave select


input for synchronous serial

Table No: 5.2

PORT B AND THE TRISB REGISTER

PORTB is an 8-bit wide, bidirectional port. The corresponding data direction register is
TRISB. Setting a TRISB bit (= 1) will make the corresponding PORTB pin an input (i.e., put the
corresponding output driver in a High-Impedance mode). Clearing a TRISB bit (= 0) will make

26
the corresponding PORTB pin an output (i.e., put the contents of the output latch on the selected
pin).

Three pins of PORTB are multiplexed with the In-Circuit Debugger and Low-Voltage
Programming function: RB3/PGM, RB6/PGC and RB7/PGD. The alternate functions of these pins
are described in Section 14.0 “Special Features of the CPU”.

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 clearing bit RBPU (OPTION_REG<7>). The weak pull-up is
automatically turned off when the port pin is configured as an output. The pull-ups are disabled on
a Power-on Reset. Four of the PORTB pins, RB7:RB4, have an interrupt on-change feature. Only
pins configured as inputs can cause this interrupt to occur (i.e., any RB7:RB4 pin configured as an
output is excluded from the interruption-change comparison). The input pins (of RB7:RB4) are
compared with the old value latched on the last read of PORTB. The “mismatch” outputs of
RB7:RB4 are OR’ed together to generate the RB port change interrupt with flag bit RBIF
(INTCON<0>).

PORTB FUNCTIONS

NAME BIT# BUFFER FUNCTION

Input/output pin or external interrupt input. Internal


RB0/INT bit 0 TTL/ST(1)
software programmable weak pull-up

Input/output pin. Internal software programmable weak


RB1 bit 1 TTL
pull-up

Input/output pin. Internal software programmable weak


RB2 bit 2 TTL
pull-up

Input/output pin or programming pin in LVP mode.


RB3/PGM(3) bit 3 TTL
Internal software programmable weak pull-up

Input/output pin (with interrupt-on-change). Internal


RB4 bit 4 TTL
software programmable weak pull-up

Input/output pin (with interrupt-on-change). Internal


RB5 bit 5 TTL
software programmable weak pull-up

27
Input/output pin (with interrupt-on-change) or in-circuit
RB6/PGC bit 6 TTL/ST(2) debugger pin & Internal software programmable weak
pull-up. Serial programming clock

Input/output pin (with interrupt-on-change) or in-circuit


RB7/PGD bit 7 TTL/ST(2) debugger pin & Internal software programmable weak
pull-up. Serial programming data

Table No: 5.3

Legend: TTL = TTL input, ST = Schmitt Trigger input

Note 1: This buffer is a Schmitt Trigger input when configured as the external interrupt.

2: This buffer is a Schmitt Trigger input when used in Serial Programming mode or in-
circuit debugger.

3: Low-Voltage ICSP Programming (LVP) is enabled by default which disables the RB3
I/O function. LVP must be disabled to enable RB3 as an I/O pin and allow maximum
compatibility to the other 28-pin and 40-pin mid-range devices.

This interrupt can wake the device from Sleep. The user, in the Interrupt Service Routine,
can clear the interrupt in the following manner:

a) Any read or write of PORTB. This will end the mismatch condition

b) Clear flag bit RBIF

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.

The interrupt-on-change feature is recommended for wake-up on key depression operation


and operations where PORTB is only used for the interrupt-on-change

feature. Polling of PORTB is not recommended while using the interrupt-on-change feature.

This interrupt-on-mismatch feature, together with software configurable pull-ups on these


four pins, allow easy interface to a keypad and make it possible for wake-up on key depression.
Refer to the application note, AN552, “implementing wake-up on key stroke” (DS00552).

28
RB0/INT is an external interrupt input pin and is configured using the INTEDG bit
(OPTION_REG<6>). RB0/INT is discussed in detail in Section 14.11.1 “INT Interrupt”.

PORTC AND THE TRISC REGISTER

PORTC is an 8-bit wide, bidirectional port. The corresponding data direction register is
TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC pin an input (i.e., put the
corresponding output driver in a High-Impedance mode). Clearing a TRISC bit (= 0) will make
the corresponding PORTC pin an output (i.e., put the contents of the output latch on the selected
pin). PORTC is multiplexed with several peripheral functions (Table 4-5). PORTC pins have
Schmitt Trigger input buffers. When the I2C module is enabled, the PORTC<4:3> pins can be
configured with normal I2C levels, or with SMBus levels, by using the CKE bit (SSPSTAT<6>).

When enabling peripheral functions, care should be taken in defining TRIS bits for each
PORTC pin. Some peripherals override the TRIS bit to make a pin an output, while other
peripherals override the TRIS bit to make a pin an input. Since the TRIS bit override is in effect
while the peripheral is enabled, read-modifywrite instructions (BSF, BCF, XORWF) with TRISC
as the destination, should be avoided. The user should refer to the corresponding peripheral section
for the correct TRIS bit settings.

PORTC FUNCTIONS

Name Bit# Buffer Type Function

RC0/T1OSO/T1CKI bit 0 ST Input/output port pin or Timer1 oscillator


output/Timer1 clock input

RC1/T1OSI/CCP2 bit 1 ST Input/output port pin or Timer1 oscillator input or


Capture2 input/Compare2 output/PWM2 output

RC2/CCP1 bit 2 ST Input/output port pin or Capture1 input/Compare1


output/PWM1 output

RC3/SCK/SCL bit 3 ST RC3 can also be the synchronous serial clock for both
SPI and I2C modes

29
RC4/SDI/SDA bit 4 ST RC4 can also be the SPI data in (SPI mode) or data
I/O (I2C mode)

RC5/SDO bit 5 ST Input/output port pin or Synchronous Serial Port data


output

RC6/TX/CK bit 6 ST Input/output port pin or USART asynchronous


transmit or synchronous clock

RC7/RX/DT bit 7 ST Input/output port pin or USART asynchronous


receive or synchronous data

Table No: 5.4

ADDRESSABLE UNIVERSAL SYNCHRONOUS ASYNCHRONOUS


RECEIVER TRANSMITTER (USART)

The Universal Synchronous Asynchronous Receiver Transmitter (USART) module is one of the
two serial I/O modules. (USART is also known as a Serial Communications Interface or SCI.) The
USART can be configured as a full-duplex asynchronous system that can communicate with
peripheral devices, such as CRT terminals and personal computers, or it can be configured as a half-
duplex synchronous system that can communicate with peripheral devices, such as A/D or D/A
integrated circuits, serial EEPROMs, etc.

The USART can be configured in the following modes:

 Asynchronous (full-duplex)
 Synchronous – Master (half-duplex)
 Synchronous – Slave (half-duplex)

Bit SPEN (RCSTA<7>) and bits TRISC<7:6> have to be set in order to configure pins
RC6/TX/CK and RC7/RX/DT as the Universal Synchronous Asynchronous Receiver Transmitter.

The USART module also has a multi-processor communication capability using 9-bit address
detection.

30
SPECIAL FEATURES OF THE CPU

All PIC16F877A devices have a host of features intended to maximize system reliability,
minimize cost through elimination of external components, provide power saving operating modes
and offer code protection. These are:

 Oscillator Selection
 Reset
o Power-on Reset (POR)
o Power-up Timer (PWRT)
o Oscillator Start-up Timer (OST)
o Brown-out Reset (BOR)
 Interrupts
 Watchdog Timer (WDT)
 Sleep
 Code Protection
 ID Locations
 In-Circuit Serial Programming
 Low-Voltage In-Circuit Serial Programming
 In-Circuit Debugger

PIC16F87XA devices have a Watchdog Timer which can be shut-off only through
configuration bits. It runs off its own RC oscillator for added reliability.

There are two timers that offer necessary delays on power-up. One is the Oscillator Start-up
Timer (OST), intended to keep the chip in Reset until the crystal oscillator is stable. The other is
the Power-up Timer (PWRT), which provides a fixed delay of 72 ms (nominal) on power-up only.
It is designed to keep the part in Reset while the power supply stabilizes. With these two timers
on-chip, most applications need no external Reset circuitry.

Sleep mode is designed to offer a very low current power-down mode. The user can wake-up
from Sleep through external Reset, Watchdog Timer wake-up or through an interrupt. Several
oscillator options are also made available to allow the part to fit the application. The RC oscillator

31
option saves system cost while the LP crystal option saves power. A set of configuration bits is
used to select various options.

CONFIGURATION BITS

The configuration bits can be programmed (read as ‘0’), or left unprogrammed (read as
‘1’) to select various device configurations. The erased or unprogrammed value of the
Configuration Word register is 3FFFh. These bits are mapped in program memory location 2007h.
It is important to note that address 2007h is beyond the user program memory space which can be
accessed only during programming.

GENERAL FORMAT FOR INSTRUCTIONS

Byte-oriented file register operations

13 8 7 6 0

OPCODE D f (FILE #)

d = 0 for destination W

d = 1 for destination f

f = 7-bit file register address

Bit-oriented file register operations

13 10 9 7 6 0

OPCODE b (BIT #) f (FILE #)

b = 3-bit bit address

f = 7-bit file register address

32
Literal and control operations

General

13 8 7 0

OPCODE k (literal)

k = 8-bit immediate value

ELECTRICAL CHARACTERISTICS

Absolute Maximum Ratings

Ambient temperature under bias.....................................................................-55 to +125°C

Storage temperature .................................................................................. -65°C to +150°C

Voltage on any pin with respect to VSS (except VDD, MCLR. and
RA4)...………………………………...……………..………………...-0.3V to (VDD + 0.3V)

Voltage on VDD with respect to VSS ............................................................ -0.3 to +7.5V

Voltage on MCLR with respect to VSS (Note 2) .................................................0 to +14V

Voltage on RA4 with respect to Vss ....................................................................0 to +8.5V

Total power dissipation (Note 1) ..................................................................................1.0W

Maximum current out of VSS pin ............................................................................300 mA

Maximum current into VDD pin ..............................................................................250 mA

Input clamp current, IIK (VI < 0 or VI > VDD)..................................................... ± 20 mA

Output clamp current, IOK (VO < 0 or VO > VDD).............................................. ± 20 mA

Maximum output current sunk by any I/O pin............................................................25 mA

Maximum output current sourced by any I/O pin ......................................................25 mA

Maximum current sunk by PORTA, PORTB and PORTE (combined) (Note 3).....200 mA

Maximum current sourced by PORTA, PORTB and PORTE (combined) (Note 3)200 mA

Maximum current sunk by PORTC and PORTD (combined) (Note 3) ...................200 mA

33
CIRCUIT DIAGRAM:-

34
CIRCUIT DIAGRAM DESCRIPTION
This project utilizes two powerful IR transmitters and two receivers; one pair of transmitter
and receiver is fixed at up side (from where the train comes) at a level higher than a human being
in exact alignment and similarly the other pair is fixed at down side of the train direction.

Sensor activation time is so adjusted by calculating the time taken at a certain speed to
cross at least one compartment of standard minimum size of the Indian railway. Sensors are fixed
at 1km on both sides of the gate.

We call the sensor along the train direction as ‘foreside sensor’ and the other as ‘aft side
sensor’. When foreside receiver gets activated, the gate motor is turned on in one direction and the
gate is closed and stays closed until the train crosses the gate and reaches aft side sensors. When
aft side receiver gets activated motor turns in opposite direction and gate opens and motor stops.

Buzzer will immediately sound at the fore side receiver activation and gate will close after
5 seconds, so giving time to drivers to clear gate area in order to avoid trapping between the gates
and stop sound after the train has crossed

35
IR TRANSMITTER
TSAL6200 is a high efficiency infrared emitting diode in GaAlAs on GaAs
technology, molded in clear, bluegrey tinted plastic packages.

In comparison with the standard GaAs on GaAstechnology these emitters achieve


more than 100 % radiant power improvement at a similar wavelength.

The forward voltages at low current and at high pulse current roughly correspond
to the low values of the standard technology. Therefore these emitters are ideally suitable
as high performance replacements of standard emitters.

36
Features

• Extra high radiant power and radiant intensity

• High reliability

• Low forward voltage

• Suitable for high pulse current operation

• Standard T-1¾ (5 mm) package

• Angle of half intensity = ± 17°

• Peak wavelength = 940 nm

• Good spectral matching to Si photodetectors

Basic Characteristics

Tamb = 25 °C, unless otherwise specified

Parameter Test Condition Symbol Min. Type Max. Unit

I(f)=100mA 1.35

Forward t(p)=20mS V(f) 1.6 v

voltage I(f)=1 A

t(p)=100us V(f) 2.6 3 v

Temp. I(f)=100mA Tk (vf) -1.3 mV/K

Coffecient
of V(f)

37
Applications

 Infrared remote control units with high power requirements


 Free air transmission systems
 Infrared source for optical counters and card readers
 IR source for smoke detectors

BUZZER

Buzzer or beeper is a signaling device, usually electronic, typically used in


automobiles, household appliances such as a microwave oven, or game shows.

It most commonly consists of a number of switches or sensors connected to a


control unit that determines if and which button was pushed or a preset time has lapsed,
and usually illuminates a light on the appropriate button or control panel, and sounds a
warning in the form of a continuous or intermittent buzzing or beeping sound.

Initially this device was based on an electromechanical system which was identical
to an electric bell without the metal gong (which makes the ringing noise). Often these
units were anchored to a wall or ceiling and used the ceiling or wall as a sounding board.

Another implementation with some AC-connected devices was to implement a


circuit to make the AC current into a noise loud enough to drive a loudspeaker and hook
this circuit up to a cheap 8-ohm speaker. Nowadays, it is more popular to use a ceramic-
based piezoelectric sounder like a Sonalert which makes a high-pitched tone.

Usually these were hooked up to "driver" circuits which varied the pitch of the
sound or pulsed the sound on and off. In game shows it is also known as a "lockout system,"
because when one person signals ("buzzes in"), all others are locked out from signaling.

Several game shows have large buzzer buttons which are identified as plungers.
The word "buzzer" comes from the rasping noise that buzzers made when they were
electromechanical devices, operated stepped-down AC line voltage at 50 or 60 cycles.
Other sounds commonly used to indicate that a button has been pressed are a ring or a beep.

38
IR RECEIVER
The TSOP17 series are miniaturized receivers for infrared remote control systems.
PIN diode and preamplifier are assembled on lead frame, the epoxy package is designed as
IR filter. The demodulated output signal can directly be decoded by a microprocessor.
TSOP17 is the standard IR remote control receiver series, supporting all major transmission
codes.

Features

 Photo detector and preamplifier in one package


 Internal filter for PCM frequency
 Improved shielding against electrical field disturbance
 Low power consumption
 High immunity against ambient light
 Continuous data transmission possible(upto2400bps)
 TTL and CMOS compatibility
 Output active low
 Suitable burst length 10 cycles/burst
The circuit of the TSOP17 is designed in that way that unexpected output pulses due to
noise or disturbance signals are avoided. A bandpassfilter, an integrator stage and an
automatic gain control are used to suppress such disturbances. The distinguishing mark
between data signal and disturbance signal are carrier frequency, burst length and duty

39
cycle. The data signal should fullfill the following condition: · Carrier frequency should be
close to center frequency of the bandpass (e.g. 38kHz). ·

Burst length should be 10 cycles/burst or longer. After each burst which is between 10
cycles and 70 cycles a gap time of at least 14 cycles is neccessary. · For each burst which
is longer than 1.8ms a corresponding gap time is necessary at some time in the data stream.
This gap time should have at least same length as the burst. ·

Up to 1400 short bursts per second can be received continuously. Some examples for
suitable data format are: NEC Code, Toshiba Micom Format, Sharp Code, RC5 Code, RC6
Code, R2000 Code, Sony Format (SIRCS).

When a disturbance signal is applied to the TSOP17.. it can still receive the data signal.
However the sensitivity is reduced to that level that no unexpected pulses will occur. Some
examples for such disturbance signals which are suppressed by the TSOP17.. are: · DC
light (e.g. from tungsten bulb or sunlight) · Continuous signal at 38kHz or at any other
frequency · Signals from fluorescent lamps with electronic ballast (an example of the signal
modulation is in the figure below).

POWER SUPPLY DETAILS

Block diagram:

40
The ac voltage, typically 220rms, is connected to a transformer, which steps that ac
voltage down to the level of the desired dc output. A diode rectifier then provides a full-
wave rectified voltage that is initially filtered by a simple capacitor filter to produce a dc
voltage. This resulting dc voltage usually has some ripple or ac voltage variation.

A regulator circuit removes the ripples and also remains the same dc value even if
the input dc voltage varies, or the load connected to the output dc voltage changes. This
voltage regulation is usually obtained using one of the popular voltage regulator IC units.

TRANSFORMER RECTIFIER FILTER IC REGULATOR LOAD

Figure2.5: Block diagram (Power supply)

Working principle:

Transformer :The potential transformer will step down the power supply voltage
(0-230V) to (0-6V) level. Then the secondary of the potential transformer will be connected
to the precision rectifier, which is constructed with the help of op–amp. The advantages of
using precision rectifier are it will give peak voltage output as DC, rest of the circuits will
give only RMS output.

41
Bridge rectifier:

When four diodes are connected as shown in figure, the circuit is called as bridge
rectifier. The input to the circuit is applied to the diagonally opposite corners of the
network, and the output is taken from the remaining two corners.

Let us assume that the transformer is working properly and there is a positive
potential, at point A and a negative potential at point B. the positive potential at point A
will forward bias D3 and reverse bias D4.

The negative potential at point B will forward bias D1 and reverse D2. At this time
D3 and D1 are forward biased and will allow current flow to pass through them; D4 and
D2 are reverse biased and will block current flow.

The path for current flow is from point B through D1, up through RL, through D3,
through the secondary of the transformer back to point B. this path is indicated by the solid
arrows. Waveforms (1) and (2) can be observed across D1 and D3.

One-half cycle later the polarity across the secondary of the transformer reverse,
forward biasing D2 and D4 and reverse biasing D1 and D3. Current flow will now be from
42
point A through D4, up through RL, through D2, through the secondary of T1, and back to
point A. This path is indicated by the broken arrows. Waveforms (3) and (4) can be
observed across D2 and D4. The current flow through RL is always in the same direction.
In flowing through RL this current develops a voltage corresponding to that shown
waveform (5). Since current flows through the load (RL) during both half cycles of the
applied voltage, this bridge rectifier is a full-wave rectifier.

One advantage of a bridge rectifier over a conventional full-wave rectifier is that


with a given transformer the bridge rectifier produces a voltage output that is nearly twice
that of the conventional full-wave circuit.
This may be shown by assigning values to some of the components shown in views
A and B. assume that the same transformer is used in both circuits. The peak voltage
developed between points X and y is 1000 volts in both circuits. In the conventional full-
wave circuit shown—in view A, the peak voltage from the center tap to either X or Y is
500 volts. Since only one diode can conduct at any instant, the maximum voltage that can
be rectified at any instant is 500 volts.
The maximum voltage that appears across the load resistor is nearly-but never
exceeds-500 v0lts, as result of the small voltage drop across the diode. In the bridge
rectifier shown in view B, the maximum voltage that can be rectified is the full secondary
voltage, which is 1000 volts. Therefore, the peak output voltage across the load resistor is
nearly 1000 volts. With both circuits using the same transformer, the bridge rectifier circuit
produces a higher output voltage than the conventional full-wave rectifier circuit.

IC voltage regulators:

Voltage regulators comprise a class of widely used ICs. Regulator IC units


contain the circuitry for reference source, comparator amplifier, control device, and
overload protection all in a single IC. IC units provide regulation of either a fixed positive
voltage, a fixed negative voltage, or an adjustably set voltage. The regulators can be
selected for operation with load currents from hundreds of milli amperes to tens of amperes,
corresponding to power ratings from milli watts to tens of watts.

43
A fixed three-terminal voltage regulator has an unregulated dc input voltage, Vi,
applied to one input terminal, a regulated dc output voltage, Vo, from a second terminal,
with the third terminal connected to ground.

The series 78 regulators provide fixed positive regulated voltages from 5 to 24


volts. Similarly, the series 79 regulators provide fixed negative regulated voltages from 5
to 24 volts.

 For ICs, microcontroller, LCD --------- 5 volts


 For alarm circuit, op-amp, relay circuits ---------- 12 volts

44
SOFTWARE DESCRIPTION

#include<pic 16f877a.h>
Fuses nolvp,nowp

sbit lcd_rs at rb0_bit;


sbit lcd_en at rb1_bit;
sbit lcd_d7 at rb7_bit;
sbit lcd_d6 at rb6_bit;
sbit lcd_d5 at rb5_bit;
sbit lcd_d4 at rb4_bit;

sbit lcd_rs_direction at trisb0_bit;


sbit lcd_en_direction at trisb1_bit;
sbit lcd_d7_direction at trisb7_bit;
sbit lcd_d6_direction at trisb6_bit;
sbit lcd_d5_direction at trisb5_bit;
sbit lcd_d4_direction at trisb4_bit;

sbit IR1 at RD2_bit;


sbit IR2 at RD3_bit;
void main()
{
Lcd_Init();

Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, "ROBOT");
Lcd_Out(2, 1, "CRACK FINDER");
delay_ms(500);
TRISD2_bit=1;
TRISD3_bit=1;
PORTD.F2=
TRISD1_bit=0;
while(1)
{
if(IR1==0)
{
Lcd_Cmd(_LCD_CLEAR)
Lcd_Out(1, 1, "Crack Found");
Lcd_Out(2, 1, "Close the Path");
PORTD.F1=1;
Delay_ms(500);

else if ( IR2==0 )
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 3, "Crack Found ");
Lcd_Out(2, 1, "Close the Path");
PORTD.F1=1;
Delay_ms(500);

45
1;
}
else
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 3, "TRACK IS CLEAR ");
PORTD.F1=0;
Delay_ms(300);
}

int coin=0,t;
char str[10];
init();
display("Insert Coin",1);
p11=0;
p12=0;
while(1)
{
if(p11) coin=1;
if(coin)
{
display("Crack detcted...",1);
p12=1;
for(t=30;t>0;t--)
{
sprintf(str,"%02d",t);
display(str,2);
delay();
}
display("crack clear",1);
p12=0;
coin=0;
}
}
}

46
P.C.B FABRICATION

The materials required for the preparation of printed circuit board are:

1. Copper cladded sheet


2. Tracing paper, Indian ink pen, carbon sheet etc.,
3. Paint and nail polish (or) even P.C.B ink and a small painting brush.
4. Tray, Ferrichloride solution, few drops of dilute hydrochloric acid (or) sulphuric
acid.
5. Thinner solution (Petrol, Kerosene (or) Turpentine)
6. Small cotton piece
7. Flat bottom disc, enameled inside
8. Hacksaw with blade and file.

PROCEDURE OF MAKING P.C.B

Preparation of Drawing:

By using a tracing paper draw the layout diagram and with a Sketch pen mark the
connection is such a way that all the connection wire shown is equal to the actual circuit
diagram.

Printing of P.C.B:

The tracing so prepared has to be imposed over the copper clad Sheet keeping in view
that the component would be mounted from the Non-cladded side of the board. Take
a copper clad sheet lamination sheet and cut a piece of required Size by using a
hacksaw. File the edges place the open side so as to draw the circuit Diagram. Rub
away the dust, grease and the oxide if any with the sand paper.

47
Over it put the drawing with its marked side facing the carbon paper and the other
side on the top; since the tracing paper is transparent you can now reproduce a carbon
print over the surface by using a ball pen or a hard pencil.

When the carbon print has been obtained over the copper cladded board, drill holes in
the board using a hand drill. The holes may be drilled with 1/32” drill bit for
components leads and with 1/8” drill Bit width for Fostering screws etc., No portion
of the carbon should be erased or wiped by Mistake. Pain the connecting lines with
the help of an Ordinary paint.

Dry it open Observe the drawing carefully, any excess paint should be scratched off
with the aid of eraser or blade.

Etching of P.C.B:

Take fresh water and mix a few teaspoons of FeCL3. Add new drops of HCI Acid
to it. (As it speeds up the etching process) and shake well. Immerse the P.C.B in the solution
for about 20 minutes occasionally stear the solution by giving a see Saw motion to the disc.
Strearing reduces the etching time. Observe the change in the Color of the naked copped
surface. Take out the P.C.B only when the naked portion of The copper surface is
completely dissolved in the solution and wash the P.C.B with water After the P.C.B has
been thoroughly washed, remove the paint by a piece Of cloth dipper in thinner core
turpentine. Now the P.C.B is ready for use.

48
CONCLUSION
This project discusses the critical safety techniques for high-speed train
operation environment based on the train control system. In order to ensure safe
operation of trains, we propose a wireless network access framework according
to the monitoring network of surrounding environment and the deployment of
transition network to avoid collision of trains and obstacle detection. System has
ability to pin point the location and other attributes of an operational train in an
economical accurate manner. The goal of this work is to design and implement
a cost effective and intelligent full-fledged and wireless based Train Anti
Collision and detection System to avoid accident.

FUTURE SCOPE
The system sets an example on how to use wireless network efficiently for Railway
Track Crack detection and the technology can be used at domestic and at commercial
places with future vision. Instead of manual method of crack detection a more advanced
accelerometer sensor are compatible technology can be used.

49
REFERENCES:-

 High speed detection of broken rails, rail cracks and surface faults,
Prof M Dhanasekar, Wirtu, & L Bayissa.

 L. Beales,-Track system requirements, Railway group standards,


railway safety,London,oct.2003.

 PIC MICROCONTROLLER, From Wikipedia the free encyclopedia.

http://en.wikipedia.org/wiki/MICROCONTROLLER.

 http://en.wikipedia.org/wiki/GSM.

 E.Gülal and B. Akpinar, ―Applications of GSM based machine guid- ance


systems in open pit mining, Mine Producing, Geology Environ. Protect.,
Varna, Bulgaria,Jun. 9-13, 2003.

 H. R. Dong, B. Ning, B. G. Cai. Zh. Sh. Hou. Automatic Train Control System
Development and Simulation for High-Speed Railways. IEEE Circuits and
Systems. 2010.10(2): 6-18.

http://en.wikipedia.org/wiki/ACCELEROMETER

 The most advanced system for broken rail detection

50
 http://www.tc.gc.ca/media/documents/railsafety/technologies.pdf

 http://www.seeedstudio.com/depot/images/product/sr-92.pdf

 http://en.wikipedia.org/wiki/GSM

 http://www.wvshare.com/datasheet_html/ LPC2148-PDF.html

51

You might also like