Harsha Given
Harsha Given
Harsha Given
1
2012-2013
CERTIFICATE
This is to certify that the main project report entitled RAILWAY TRACK
SECURITY SYSTEM is a bonafide record of work carried out by Mr. M.Surya
Chandra(09481A0472),S.ChaitanyaBharathi(09481A04A1),N.P.G.J.Swaroop(09481
A0474) and P.Gowtham Krishna (09481A0488) under my guidance and supervision in
partial fulfillment of the requirements for the award of degree of Bachelor of Technology
in Electronics and Communication Engineering of Jawaharlal Nehru Technological
University, Kakinada.
2
ACKNOWLEDGEMENT
We express our heartful gratitude and deep indebtedness to our beloved Head
of Department Dr.M.KAMARAJU, for his great help and encouragement in doing our
main project successfully.
We thank one and all who have rendered help to us directly or indirectly in the
completion of this work.
M. SURYA CHANDRA(09481A0472)
S.CHAITANYA BHARATHI(09481A04A1)
N.P.G.J. SWAROOP(09481A0474)
P.GOWTHAM KRISHNA(09481A0488)
3
CONTENTS
Page No.
List of Figures i
List of Tables ii
Nomenclature iii
Abstract iv
Chapter 1: INTRODUCTION
1.1 Overview of the Project 1
Chapter 3: COMPONENTS
5
3.1 AT89C51 MICRO CONTROLLER 5
3.2 GSM Modem (sim 300) 10
3.3 Max 232 15
3.4 LCD DISPLAY 16
3.5 Other components used 18
3.5.1 IC 7805 Voltage Regulator
18
3.5.2 Transformer
19
4
3.5.3 Capacitors
22
3.5.4 Resistors
24
3.5.5 1N4007 Diode 25
LIST OF FIGURES
5
Fig.No. Figure Name Page
No.
LIST OF TABLES
6
Table No. Table Title Page
No.
NOMENCLATURE
GSM Global System For Mobile
7
ABSTRACT
Railway is one of the largest transport systems in our country. Daily large number
of people transport from one place to other using railways. Even a single damage in the
system leads to death of large number of people and most of the accidents are caused due
to cracks in the track. So the project has been designed to detect early cracks in track and
alert the respective railway department, thereby accidents can be avoided.
Thus the proposed model is designed to recognize the cracks in the railway tracks
and provides instant information to the concerned railway authorities.
CHAPTER 1
8
INTRODUCTION
This chapter deals with the overview of the project and the requirements. The
overview of the project is the keen observation of the project with their results in
consideration. The requirements of the project are the key elements used in the project.
In this chapter, the overview and the requirements of the project are described. The
concept, block diagram of the project and the complete circuit diagram and its operation
will be described in the 2nd chapter.
CHAPTER 2
CONCEPT OF RAILWAY TRACK SECURITY SYSTEM
9
This chapter describes the concept, block diagram and the complete circuit
diagram and its concept.
2.1 Concept
This project uses a microcontroller from 8051 family. The primary objective of
this project is to detect the crack in the railway track and alert the nearby station through
effective and highly reliable communication mode. To demonstrate this project, two rails
forming the part of a track are made using a pair of wire which is connected with a
detachable jumper in between each wire/track. Removing the detachable jumper creates a
fault in the respective track; otherwise it is generally shorted by the jumper wire to
simulate healthy track condition. Removing the jumpers result in driving transistors
delivering a different logic to the controller. The program thereafter takes over to send an
SMS through GSM modem interfaced through a level shifter IC to the microcontroller.
An LCD is also interfaced to the MC to display the status of GSM and track condition.
The power supply consists of a step down transformer 230/12V, which steps down the
voltage to 12V AC. This is converted to DC using a Bridge rectifier. The ripples are
removed using a capacitive filter and it is then regulated to +5V using a voltage regulator
7805 which is required for the operation of the microcontroller and other components.
Power supply
Crack sensing circuit(jumper)
Micro controller(AT89C51)
Interface(MAX232)
GSM modem
Mobile
LCD Display
10
Fig.2.2: Block Diagram of the Railway Track Security System
The power supply is given to both crack sensing circuit and micro controller.
Whenever track is broken the crack sensing circuit senses it and sends this information to
micro controller and micro controller sends message to the station masters mobile by
using GSM modem.
The main purpose of the circuit is to avoid accidents due to track failure by
alerting the station master by sending message to his mobile. The below Fig.2.3 shows
the circuit diagram of the railway track security system.
11
Fig.2.3: Circuit diagram of the railway track security system
12
CHAPTER 3
COMPONENTS
This chapter deals with the components used in the project and gives their
complete description.
3.1 Atmel 89C51 Microcontroller
3.1.1 Description
The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer
with 4K bytes of Flash programmable and erasable read only memory (PEROM). The
device is manufactured using Atmels high-density nonvolatile memory technology and
is compatible with the industry-standard MCS-51 instruction set and pin out. The on-chip
Flash allows the program memory to be reprogrammed in-system or by a conventional
nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a
monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a
highly-flexible and cost-effective solution to many embedded control applications.
The AT89C51 provides the following standard features: 4K bytes of Flash, 128
bytes of RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt
architecture, a full duplex serial port, on-chip oscillator and clock circuitry. In addition,
the AT89C51 is designed with static logic for operation down to zero frequency and
supports two software selectable power saving modes. The Idle Mode stops the CPU
while allowing the RAM, timer/counters, serial port and interrupt system to continue
functioning. The Power-down Mode saves the RAM contents but freezes the oscillator
disabling all other chip functions until the next hardware reset.
13
3.1.2 Pin diagram
The pin diagram of AT89C51 is shown in the Fig 3.1
Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin
can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be
used as high impedance inputs. Port 0 may also be configured to be the
multiplexed low order address/data bus during accesses to external program and
data memory. In this mode P0 has internal pull ups. Port 0 also receives the code
bytes during Flash programming, and outputs the code bytes during program
verification. External pull ups are required during program verification.
14
Port 1 is an 8-bit bi-directional I/O port with internal pull ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they
are pulled high by the internal pull ups and can be used as inputs. As inputs, Port
1 pins that are externally being pulled low will source current (IIL) because of the
internal pull ups. Port 1 also receives the low-order address bytes during
Port 2 is an 8-bit bi-directional I/O port with internal pull ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they
are pulled high by the internal pull ups and can be used as inputs. As inputs, Port
2 pins that are externally being pulled low will source current (IIL) because of the
internal pull ups. Port 2 emits the high-order address byte during fetches from
external program memory and during accesses to external data memory that uses
16-bit addresses (MOVX @ DPTR). In this application, it uses strong internal
pull-ups when emitting 1s. During accesses to external data memory that uses 8-
bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function
Register. Port 2 also receives the high-order address bits and some control signals
during Flash programming and verification.
Port 3 is an 8-bit bi-directional I/O port with internal pull ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they
are pulled high by the internal pull ups and can be used as inputs. As inputs, Port
3 pins that are externally being pulled low will source current (IIL) because of the
pull ups. Port 3 also serves the functions of various special features. Port 3 also
receives some control signals for Flash programming and verification.
15
8. P3.7 RD (external data memory read strobe)
RST Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device.
ALE/PROG Address Latch Enable output pulse for latching the low byte of the
address during accesses to external memory. This pin is also the program pulse
input (PROG) during Flash programming.
In normal operation ALE is emitted at a constant rate of 1/6 the oscillator
frequency, and may be used for external timing or clocking purposes. Note,
however, that one ALE pulse is skipped during each access to external Data
Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR
location 8EH. With the bit set, ALE is active only during a MOVX or MOVC
instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit
has no effect if the microcontroller is in external execution mode.
PSEN Program Store Enable is the read strobe to external program memory.
When the AT89C51 is executing code from external program memory, PSEN is
activated twice each machine cycle, except that two PSEN activations are skipped
during each access to external data memory.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
XTAL2
Output from the inverting oscillator amplifier.
16
or ceramic resonator may be used. To drive the device from an external clock source,
XTAL2 should be left unconnected while XTAL1 is driven .There are no requirements on
the duty cycle of the external clock signal, since the input to the internal clocking
circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high
and low time specifications must be observed.
3.1.6 Features
Compatible with MCS-51 Products
4K Bytes of In-System Reprogrammable Flash Memory
Endurance: 1,000 Write/Erase Cycles
17
Fully Static Operation: 0 Hz to 24 MHz
Three-level Program Memory Lock
128 x 8-bit Internal RAM
32 Programmable I/O Lines
Two 16-bit Timer/Counters
Six Interrupt Sources
Programmable Serial Channel
Low-power Idle and Power-down Modes
18
3.2.1 Network Structure
The network is structured into a number of discrete sections:
The Base Station Subsystem (the base stations and their controllers).
The Network and Switching Subsystem (the part of the network most similar to a
fixed network). This is sometimes also just called the core network.
The GPRS Core Network (the optional part which allows packet based Internet
connections).
The Operations support system (OSS) for maintenance of the network.
Cell horizontal radius varies depending on antenna height, antenna gain and
propagation conditions from a couple of hundred meters to several tens of kilometers.
The longest distance the GSM specification supports in practical use is 35 kilometers
(22 mi). There are also several implementations of the concept of an extended cell, where
the cell radius could be double or even more, depending on the antenna system, the type
of terrain and the timing advance.
19
Indoor coverage is also supported by GSM and may be achieved by using an
indoor pico cell base station, or an indoor repeater with distributed indoor antennas fed
through power splitters, to deliver the radio signals from an antenna outdoors to the
separate indoor distributed antenna system. These are typically deployed when a lot of
call capacity is needed indoors; for example, in shopping centers or airports. However,
this is not a prerequisite, since indoor coverage is also provided by in-building
penetration of the radio signals from any nearby cell.
20
signal. As GSM was further enhanced in 1997 with the Enhanced Full Rate (EFR) codec,
a 12.2 Kbit/s codec that uses a full rate channel. Finally, with the development of UMTS,
EFR was refectories into a variable-rate codec called AMR-Narrowband, which is high
quality and robust against interference when used on full rate channels, or less robust but
still relatively high quality when used in good radio conditions on half-rate channels.
21
development of UMTS introduces an optional Universal Subscriber Identity
Module (USIM), that uses a longer authentication key to give greater security, as well as
mutually authenticating the network and the user whereas GSM only authenticates the
user to the network (and not vice versa). The security model therefore offers
confidentiality and authentication, but limited authorization capabilities, and no non-
repudiation. GSM uses several cryptographic algorithms for security.
The A5/1, A5/2 and A5/3 stream ciphers are used for ensuring over-the-air voice privacy.
A5/1 was developed first and is a stronger algorithm used within Europe and the United
States; A5/2 is weaker and used in other countries. Serious weaknesses have been found
in both algorithms: it is possible to break A5/2 in real-time with a ciphertext-only attack,
and in January 2007, The Hacker's Choice started the A5/1 cracking project with plans to
use FPGAs that allow A5/1 to be broken with a rainbow table attack. The system
supports multiple algorithms so operators may replace that cipher with a stronger one.
GSM uses General Packet Radio Service (GPRS) for data transmissions like
browsing the web. The most commonly deployed GPRS ciphers were publicly broken in
2011. The researchers revealed flaws in the commonly used GEA/1 and GEA/2 ciphers
and published the open source "gprs decode" software for sniffing GPRS networks. They
also noted that some carriers don't encrypt the data at all (i.e. using GEA/0) in order to
detect the use of traffic or protocols they don't like, e.g. Skype, leaving their customers
unprotected. GEA/3 seems to remain relatively hard to break and is said to be in use on
some more modern networks. If used with USIM to prevent connections to fake base
22
stations and downgrade attacks, users will be protected in the medium term, though
migration to 128-bit GEA/4 is still recommended.
Voltage Levels:
23
Table 3.3.1: Voltage levels of RS232
RS232 Line Type & Logic Level RS232 Voltage TTL Voltage to/from MAX232
24
3.4.1 Pin Diagram
4 Selects command register when low; and data register when high Register Select
5 Low to write to the register; High to read from the register Read/write
6 Sends data to data pins when a high to low pulse is given Enable
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-
25
3.5 Other Components Used
3.5.1 IC 7805 Voltage Regulator
Voltage regulator IC's are the ICs that are used to regulate voltage. IC-7805 is a
5v Voltage regulator that restricts the voltage output to 5v. It comes with provision to add
heat sink .The maximum value for input to the power | Voltage regulator is 35 v. it can
provide a constant steady voltage flow of 5 v for higher voltage input till the threshold
limit of 35v. If the voltage is near to 7.5 v then it does not produce any heat and hence no
need for heat sinque. If the voltage input is more, then the heat produced is more. It gives
steady output if the voltage is in rage of 7.2v to 35 v.
In some circuitry voltage fluctuation is fatal, for such situation to ensure constant
voltage IC-7805 Voltage Regulators are used. The schematic given below shows how to
use an IC-7805. There are 3 pins in IC-7805, pin 1 takes the input voltage and pin 3
produces the output voltage. The GND of both input and out are given to pin 2.
26
3.5.1.2 Requirement of Voltage Regulator
Voltage Regulator is one of the most important and commonly used electrical
component. Voltage Regulators are responsible for maintaining a steady voltage across an
Electronic system. Voltage fluctuations may result in undesirable effect on an electronic
system, so to maintaining a steady constant voltage is necessary according to the voltage
requirement of a system. Lets us assume a condition when a simple light emitting diode
can take a max of 3v to the max, what happens if the voltage input exceeds 3v? , of
course the diode will burn out .This is also common with all electronic components like,
leds, capacitors, diodes etc. The slightest increase in voltage may result in the failure
of entire system by damaging the other components too. For avoiding Damage by such
situations voltage regulators are used.
3.5.2 Transformer
The transformer here we used is Center tapped Step down Transformer. In
electronics, a center tap is a contact made to a point halfway along a winding of
a transformer or inductor, or along the element of a resistor or a potentiometer. Taps are
sometimes used on inductors for the coupling of signals, and may not necessarily be at
the half-way point, but rather, closer to one end. A common application of this is in
the Hartley oscillator. Inductors with taps also permit the transformation of the amplitude
of alternating current (AC) voltages for the purpose of power conversion, in which case,
they are referred to as autotransformers, since there is only one winding. An example of
an autotransformer is an automobile ignition coil. Potentiometer tapping provides one or
more connections along the device's element, along with the usual connections at each of
the two ends of the element, and the slider connection. Potentiometer taps allow for
circuit functions that would otherwise not be available with the usual construction of just
the two end connections and one slider connection.
27
winding). These two 12 VAC supplies are 180 degrees out of phase with each other, thus
making it easy to derive positive and negative 12 volt DC power supplies from them.
28
documented, for example, in "The Radiotron Designer's Handbook, Third Edition" of
1940. This technique was carried over into transistor designs also, part of the reason
for which was that capacitors were large, expensive and unreliable.
However, since that era, capacitors have become vastly smaller, cheaper and more
reliable, whereas transformers are still relatively expensive. Furthermore, as
designers acquired more experience with transistors, they stopped trying to treat them
like tubes. Coupling a class A intermediate amplification stage to a class AB power
stage using a transformer doesn't make sense anymore even in small systems
powered from a single-voltage supply.
Modern higher-end equipment is based on dual-supply designs which eliminates
coupling. It is possible for an amplifier, from the input all the way to the loudspeaker,
to be DC coupled without any capacitance or inductance.
In vacuum tube amplifiers, center-tapped transformers are used to couple a push-
pull output stage to the speaker. This use is still relevant today because tubes and tube
amplifiers continue to be produced for niche markets.
In analog telecommunications systems center-tapped transformers can be used to
provide a DC path around an AC coupled amplifier for signaling purposes.
Power distribution, see 3 wire single phase.
The center-tapped rectifiers are preferred to the full bridge rectifier when the
output DC current is high and the output voltage is low.
Phantom power can be supplied to a condenser microphone using center tap
transformers. One method, called "direct center tap" uses two center tap transformers,
one at the microphone body and one at the microphone preamp. Filtered DC voltage
is connected to the microphone preamp center tap, and the microphone body center
tap is grounded through the cable shield.
The second method uses the same center tap transformer topology at the
microphone body, but at the microphone preamp, a matched pair of resistors
spanning the signal lines in series creates an "artificial center tap".
Turns Caluclations:
The step down transformer of 0-9 volts is used to step down the AC line voltage
of 220 volts to 9 volts. We select the transformer of 0-9 volts considering the
reduction due to various losses.
29
Output of transformer = 9 Volt, 500 mA
Therefore total current flowing through the circuit
V1 / V2 = N1 / N2 = I2 / I1
Here, I1 = 2 A
I2 = 500 mA
V1 = 230 Volts
V2 = 9 Volts
Therefore, 230 / 9 = N1 / 50
N1 = (230 * 50) / 9
N1 = 1277 Turns.
3.5.3 Capacitors
A capacitor (formerly known as condenser) is a passive electronic component
consisting of a pair of conductors separated by a dielectric (insulator). When there is a
potential difference (voltage) across the conductors, a static electric field develops in the
dielectric that stores energy and produces a mechanical force between the conductors. An
ideal capacitor is characterized by a single constant value, capacitance, measured in
farads. This is the ratio of the electric charge on each conductor to the potential
difference between them. The general representation of capacitor is shown in the Fig.3.7
Capacitors are widely used in electronic circuits for blocking direct current while
allowing alternating current to pass, in filter networks, for smoothing the output of power
supplies, in the resonant circuits that tune radios to particular frequencies and for many
other purposes. The representation of the separation of the plates of the capacitors is
shown in the Fig.3.8.
30
Fig.3.8: Capacitor
A capacitor consists of two conductors separated by a non-conductive region
called the dielectric medium though it may be a vacuum or a semiconductor depletion
region chemically identical to the conductors. A capacitor is assumed to be self-contained
and isolated, with no net electric charge and no influence from any external electric field.
The conductors thus hold equal and opposite charges on their facing surfaces and the
dielectric develops an electric field. The representation of the separation of the plates of
the capacitors is shown in the Fig.3.9.
31
3.5.4 Resistors
A resistor is a two-terminal electronic component that produces a voltage
across its terminals that is proportional to the electric current through it in accordance
with Ohm's law. The general representation of resistor and the symbolic representation
are shown in Fig.3.10 and Fig.3.11 respectively.
Resistors are elements of electrical networks and electronic circuits and are
ubiquitous in most electronic equipment. Practical resistors can be made of various
compounds and films, as well as resistance wire (wire made of a high-resistivity alloy,
such as nickel-chrome). The primary characteristics of a resistor are the resistance, the
tolerance, the maximum working voltage and the power rating. Other characteristics
include temperature coefficient, noise, and inductance.
Resistors can be integrated into hybrid and printed circuits, as well as integrated
circuits. Size, and position of leads (or terminals), are relevant to equipment designers;
resistors must be physically large enough not to overheat when dissipating their power.
Resistors determine the flow of current in an electrical circuit. Where there is high
resistance in a circuit the flow of current is small, where the resistance is low the flow of
current is large. Resistance, voltage and current are connected in an electrical circuit by
Ohms Law.
OHMS LAW
Ohm's law states that the voltage (V) across a resistor is proportional to the
current (I) through it where the constant of proportionality is the resistance (R).
Equivalently, Ohm's law can be stated:
32
V=I.R
This formulation of Ohm's law states that, when a voltage (V) is maintained across a
resistance (R), a current (I) will flow through the resistance.
V/R=I, R=V/I
Where,
V=voltage in volts (v)
I = current in amps (A)
R=Resistance in ohms ()
Types:
All modern resistors can be classified in to broad groups
Carbon composition Resistor Made of carbon dust or graphite paste , low
wattage values.
Film or ceramic Resistor Made from conductive metal oxide paste , very low
wattage values.
Wire-Wound Resistors- Metallic bodies for heat sink mounting , very high
wattage ratings.
Semiconductor Resistors- High frequency precision surface mount thin film
technology.
3.5.5 1N4007 Diode
In electronics, 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. This is a crystalline piece of
semiconductor material connected to two electrical terminals. A vacuum tube diode (now
little used except in some high-power technologies) is a vacuum tube with two
electrodes: a plate and a cathode as shown in Fig 3.12.
33
to convert alternating current to direct current, and to extract modulation from radio
signals in radio receivers.
Diodes were the first semiconductor electronic devices. The discovery of crystals'
rectifying abilities was made by German physicist Ferdinand Braun in 1874. The first
semiconductor diodes, called cat's whisker diodes, developed around 1906, were made of
mineral crystals such as galena. Today most diodes are made of silicon, but other
semiconductors such as germanium are sometimes used.
Function
Diodes allow electricity to flow in only one direction. The arrow of the circuit
shows the direction in which the current can flow. Diodes are the electrical version of a
valve and early diodes were actually called valves.
34
Fig. 3.13: Diode V- I
Characteristics
Typically, the PIV
rating of a generic rectifier
diode is at least 50 volts at
room temperature. Diodes
with PIV ratings in the many
thousands of volts are available for modest prices.
Applications
Rectifiers in D.C. power supplies.
Switch in digital logic circuits.
Diode Testing
Using a digital meter, connect the black lead to the cathode and red to the anode
(forward bias - around 1k).
Reverse the meter connections (reverse bias - infinity reading).
If you are using an analogue meter the above polarities are reversed.
In this chapter, the components used in the project are described. The Keil
compiler, Embedded C and the code which we have used in our project will be described
in the 4th chapter.
CHAPTER 4
SOFTWARE DETAILS
35
This chapter deals with the Keil compiler, Embedded C and the code which we have
used in our project.
4.1KEIL Compiler
Keil compiler is software used where the machine language code is written and
compiled. After compilation, the machine source code is converted into hex code which
is to be dumped into the microcontroller for further processing. Keil compiler also
supports C language code. Keil Vision4 adds many new features to the Editor
like Text Templates, Quick Function Navigation, and Syntax Coloring with
brace high lighting Configuration Wizard for dialog based startup and debugger
setup. Vision4 is fully compatible toVision2 and can be used in parallel with Vision3.
Vision4 is an IDE that helps to
write, compile, and debug embedded programs.
I t e n c a p s u l a t e s t h e f o l l o w i n g components:
A project manager.
A make facility.
Tool configuration.
Editor.
A powerful debugger.
4.2 EMBEDDED C
The programming Language used here in this project is an
Embedded C Language. This Embedded C Language is different from the
generic C language in few things like
Access over the architecture addresses.
Data types.
The Embedded C Programming Language forms the user friendly language
with access over Port addresses, SFR Register addresses etc. Embedded C Data types are
given in the Table 4.1.
36
Table 4.1 Data types in Embedded C
37
The most widely used vendor is Atmel. So click on Atmel and now the family of
microcontrollers manufactured by Atmel opens. You can select any one of the
microcontrollers according to the requirement.
When you click on any one of the microcontrollers, the features of that particular
microcontroller will be displayed on the right side of the page. The most
appropriate microcontroller with which most of the projects can be implemented
is the AT89C51. Click on this microcontroller and have a look at its features. Now
click on OK to select this microcontroller.
A small window opens asking whether to copy the startup code into the file you
have created just now. Just click on No to proceed further.
Now you can see the TARGET and SOURCE GROUP created in the project
workspace.
Now click on File and in that New. A new page opens and you can start
writing program in it.
After the program is completed, save it with any name but with the .asm
extension. Save the program in the file you have created earlier.
You can notice that after you save the program, the predefined keywords will be
highlighted in bold letters.
Now add this file to the target by giving a right click on the source group. A list of
options open and in that select Add files to the source group. Check for this file
where you have saved and add it.
Right click on the target and select the first option Options for target. A window
opens with different options like device, target, output etc. First click on target.
Since the set frequency of the microcontroller is 11.0592 MHz to interface with
the PC, just enter this frequency value in the Xtal (MHz) text area and put a tick
on the Use on-chip ROM. This is because the program what we write here in the
Keil will later be dumped into the microcontroller and will be stored in the inbuilt
ROM in the microcontroller.
Now click the option Output and give any name to the hex file to be created in
the Name of executable text area and put a tick to the Create HEX file option
present in the same window. The hex file can be created in any of the drives. You
can change the folder by clicking on Select folder for Objects.
38
Now to check whether the program you have written is errorless or not, click on
the icon exactly below the Open file icon which is nothing but Build Target
icon. You can even use the shortcut key F7 to compile the program written.
To check for the output, there are several windows like serial window, memory
window, project window etc. Depending on the program you have written, select
the appropriate window to see the output by entering into debug mode.
The icon with the letter d indicates the debug mode.
Click on this icon and now click on the option View and select the appropriate
window to check for the output.
After this is done, click the icon debug again to come out of the debug mode.
The hex file created as shown earlier will be dumped into the microcontroller
with the help of software called Proload.
4.4 Proload
Proload is software which accepts only hex files. Once the machine code is
converted into hex code, that hex code has to be dumped into the microcontroller placed
in the programmer kit and this is done by the Proload. Programmer kit contains a
microcontroller on it other than the one which is to be programmed. This microcontroller
has a program in it written in such a way that it accepts the hex file from the keil
compiler and dumps this hex file into the microcontroller which is to be programmed. As
this programmer kit requires power supply to be operated, this power supply is given
from the power supply circuit designed above. It should be noted that this programmer
kit contains a power supply section in the board itself but in order to switch on that power
supply, a source is required. Thus this is accomplished from the power supply board with
an output of 12volts or from an adapter connected to 230 V AC.
Now place the microcontroller in the GIF socket provided in the programmer kit.
39
Click on the Proload icon in the PC. A window appears providing the information
like Hardware model, com port, device type, Flash size etc. Click on browse
option to select the hex file to be dumped into the microcontroller and then click
on Auto program to program the microcontroller with that particular hex file.
The status of the microcontroller can be seen in the small status window in the
bottom of the page.
After this process is completed, remove the microcontroller from the programmer
kit and place it in your system board. Now the system board behaves according to
the program written in the microcontroller.
In this chapter, the Keil compiler, Embedded C and the code which we have used
in our project are described. The results are shown in the 5th chapter.
40
CHAPTER 5
RESULTS
The below Fig 5.1 shows the circuit when the track is in good condition.
Microcontroller port 1.2 is the input pin .GSM modem is connected to microcontroller
through max232 IC. When port 1.2 pin is supplied with 5 volts i.e.; when the track is
connected display shows that track is in good condition and the modem does not send
any SMS to station master.
41
5.2 Status after Track Failure
The below Fig 5.2 shows the circuit when the track fails and the GSM modem
sends SMS to desired number When port 1.2 pin is supplied with 0 volts i.e.; when the
track is disconnected ,display shows that track failed and the modem sends SMS to
station master.GSM protocols are used in sending SMS.
42
CHAPTER 6
FUTURE WORK AND CONCLUSION
This chapter describes about the future work that is to carried to enhance the
capability of the project.
6.2 Conclusion
Thus The RAILWAY TRACK SECURITY SYSTEM always monitors the track
condition, and if there is any breakage in the track it intimates to station master through
SMS. Using this project we can avoid maximum of train accidents and provides security
to the passengers. And with this project there is no need of manual checking of entire
track, which leads easy handling of the track failure.
APPENDIX A
43
DATASHEET SPECIFICATIONS OF ATMEL 8051 MICROCONTROLLER
APPENDIX B
44
DATA SHEET OF MAX232 IC
45
APPENDIX C
46
VARIOUS TYPES OF LED
Voltage drop
Color Wavelength [nm] Semiconductor material
[V]
Violet 400 < < 450 2.76 < V < 4.0 Indium gallium nitride (InGaN)
47
Dual blue/red LEDs,
Purple multiple types 2.48 < V < 3.7 blue with red phosphor,
or white with purple plastic
APPENDIX D
CODE
#include<reg51.h>
#include<stdio.h>// include stdio . h
#include<stdlib.h>// include stdlib . h
sbit w=P1^1;
sbit rs=P2^7;
sbit rw=P2^6;
48
sbit en=P2^5;
/* declarations*/
void lcd_init();
void lcd_data_string(unsigned char str[]);
void lcd_cmd(unsigned char value);
void lcd_data(unsigned char value);
void initialize_GSM_modem();
void initialize_serialcommunication();
unsigned char Command_CMGF[]="AT+CMGF=1\r\n"; // AT+CMGF for selecting
Text Mode
unsigned char CtrlZ=0x1A; // CTRL+Z for sedning SMS after the message
has been entered
unsigned char Command_CMGS[]="AT+CMGS =+919493852372\r\n"; // recepient
mobile number
unsigned char Command_AT[]="AT\r\n";
unsigned char msg[]="TRACK FAILED";
void delay1(unsigned int msec )
{
int i,j;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void delay(void)
{
unsigned int i;
for(i=0;i<25000;i++);
}
void main()
{
P0=0xFF;
if(w==1)
{
lcd_init();
lcd_data_string("TRACK IS GOOD");
delay1(250);
}
else
{
lcd_init();
lcd_data_string("TRACK FAILED");
delay1(250);
initialize_serialcommunication();
initialize_GSM_modem();
while (1)
{
;
}
}
}
void initialize_GSM_modem(void)
49
{
delay();
puts(Command_AT);
delay();
puts(Command_CMGF);
delay();
puts(Command_CMGS);
delay();
puts(msg);
delay();
while(!TI)
;
TI = 0;
SBUF = 0x1A;
}
void initialize_serialcommunication(void)
{
TMOD = 0x20;
SCON = 0x50;
TH1 = 0xFD;
TL1 = 0xFD;
TR1 = 1;
TI = 1;
}
void lcd_init()
{
lcd_cmd(0x38);
delay1(250);
lcd_cmd(0x0F);
delay1(250);
lcd_cmd(0x80);
delay1(250);
lcd_cmd(0x06);
delay1(250);
}
void lcd_cmd(unsigned char value)
{
P0= value;
rs=0;
rw=0;
en=1;
delay1(1);
en=0;
}
void lcd_data(unsigned char value)
{
P0= value;
rs=1;
50
rw=0;
en=1;
delay1(1);
en=0;
}
void lcd_data_string(unsigned char str[])
{
int i=0;
while(str[i]!='\0')
{
lcd_data(str[i]);
i++;
delay1(10);
}
return;
}
REFERENCES
BOOKS
1. S.Salivahanan, N.Suresh Kumar, A.Vallavaraj, Electronic Devices and
Circuits, Second edition, 2007, Tata Mc Graw-Hill companies
2. Gupta J.B.Electronics Devices& Circuits India: S.K.Kataria &sons, first
51
edition dec 2000.-vol.1.
3. Kumar n.suresh Electronics Device & Circuits-2008
4. Muhammad Ali Mazidi, Janice Gillipse Mazidi THE 8051 MICRO
CONTROLLER AND EMBEDDED SYSTEMS (Pearson Education Asia, 1st
Edition, 2004).
URLs
1. http://www.edgefxkits.in/embedded/8051/railway-track-security-system
2. http://en.wikipedia.org/wiki/jumper(computing)
3. http://www.bluocean.biz/technicalinfo.html
4. http://www.circuitstoday.com/interfacing-16x2-lcd-with-8051
5. http://microcontroller.circuitlab.org/2012/08/schematic-gsm-modem-interfacing-
with.html
52