You are on page 1of 53

Railway Track Security System

CHAPTER 1
OVERVIEW OF PROJECT

Railway track security system project is to avoid rail accidents by using latest
communication technologies.

This project uses a microcontroller ATmega328. 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. An LCD and LED are also interfaced to the MC to display the track condition.
Thus the proposed model is designed to recognize the cracks in the railway tracks and
provides instant information to the concerned railway authorities.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 1


Railway Track Security System

CHAPTER 2
EMBEDDED SYSTEMS
2.1 INTRODUCTION
An Embedded system is a special-purpose system in which the computer is
completely encapsulated by or dedicated to the device or system it controls. Unlike a
general-purpose computer, such as a personal computer, an embedded system performs
one or a few predefined tasks, usually with very specific requirements. Since the system
is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost
of the product.
Personal digital assistants (PDAs) or handheld computers are generally
considered embedded devices because of the nature of their hardware design, even
though they are more expandable in software terms. This line of definition continues to
blur as devices expand. With the introduction of the OQO Model 2 with the Windows XP
operating system and ports such as a USB port both features usually belong to "general
purpose computers", the line of nomenclature blurs even more.
Physically, embedded systems ranges from portable devices such as digital
watches and MP3 players, to large stationary installations like traffic lights, factory
controllers, or the systems controlling nuclear power plants.
In terms of complexity embedded systems can range from very simple with a
single microcontroller chip, to very complex with multiple units, peripherals and
networks mounted inside a large chassis or enclosure

Fig:2.1 Examples of Embedded System

DEPARTMENT OF ECE, S.R.T.I.S.T Page 2


Railway Track Security System

• Avionics, such as inertial guidance systems, flight control hardware/software


and other integrated systems in aircraft and missiles
• Cellular telephones and telephone switches
• Engine controllers and antilock brake controllers for automobiles
• Home automation products, such as thermostats, air conditioners, sprinklers,
and security monitoring systems
• Handheld calculators
• Handheld computers
• Household appliances, including microwave ovens, washing machines,
television sets, DVD players and recorders
• Medical equipment
• Personal digital assistant
• Videogame consoles
• Computer peripherals such as routers and printers.
• Industrial controllers for remote machine operation.

2.2 CHARACTERISTICS
• An embedded system is any computer system hidden inside a product other than a
computer.
• They will encounter a number of difficulties when writing embedded system
software in addition to those we encounter when we write applications
 Throughput – Our system may need to handle a lot of data in a short
period of time.
 Response–Our system may need to react to events quickly
 Testability–Setting up equipment to test embedded software can be
difficult
 Debugability–Without a screen or a keyboard, finding out what the
software is doing wrong (other than not working) is a troublesome
problem
 Reliability – embedded systems must be able to handle any situation
without human intervention
 Memory space – Memory is limited on embedded systems, and you must
make the software and the data fit into whatever memory exists
 Program installation – you will need special tools to get your software into
embedded systems
 Power consumption – Portable systems must run on battery power, and the
software in these systems must conserve power
 Processor hogs – computing that requires large amounts of CPU time can
complicate the response problem

DEPARTMENT OF ECE, S.R.T.I.S.T Page 3


Railway Track Security System

 Cost – Reducing the cost of the hardware is a concern in many embedded


system projects; software often operates on hardware that is barely
adequate for the job.
• Embedded systems have a microprocessor/ microcontroller and a memory. Some
have a serial port or a network connection. They usually do not have keyboards,
screens or disk drives.
2.3 APPLICATIONS

1. Military and aerospace embedded software applications


2. Communication Applications
3. Industrial automation and process control software

4. Mastering the complexity of applications.


5. Reduction of product design time.
6. Real time processing of ever increasing amounts of data.
7. Intelligent, autonomous sensors.
2.4 CLASSIFICATION
• Real Time Systems.
• RTS is one which has to respond to events within a specified deadline.
• A right answer after the dead line is a wrong answer.
2.4.1 RTS CLASSIFICATION
• Hard Real Time Systems
• Soft Real Time System
HARD REAL TIME SYSTEM
• "Hard" real-time systems have very narrow response time.
• Example: Nuclear power system, Cardiac pacemaker.

SOFT REAL TIME SYSTEM


"Soft" real-time systems have reduced constrains on "lateness" but still must
operate very quickly and repeatable.

Example: Railway reservation system – takes a few extra seconds the data remains valid.

2.5 OVERVIEW OF ARCHITECTURE


Every embedded system consists of custom-built hardware built around a Central
Processing Unit (CPU). This hardware also contains memory chips onto which the
software is loaded. The software residing on the memory chip is also called the
‘firmware’. The embedded system architecture can be represented as a layered
architecture as shown in Figure.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 4


Railway Track Security System

The operating system runs above the hardware, and the application software runs
above the operating system. The same architecture is applicable to any computer
including a desktop computer. However, there are significant differences. It is not
compulsory to have an operating system in every embedded system. For small appliances
such as remote control units, air conditioners, toys etc., there is no need for an operating
system and you can write only the software specific to that application. For applications
involving complex processing, it is advisable to have an operating system. In such a case,
you need to integrate the application software with the operating system and then transfer
the entire software on to the memory chip. Once the software is transferred to the
memory chip, the software will continue to run for a long time you don’t need to reload
new software
The details of the various building blocks of the hardware of an embedded system. As
shown in Fig. the building blocks are;
· Central Processing Unit (CPU)
· Memory (Read-only Memory and Random Access Memory)
· Input Devices
· Output devices
· Communication interfaces
.Application –specific circuitry
Read only Random
memory access
memory

Input Central processing


devices (CPU) Output devices

Application- Communication
specific circuitry interfaces

Fig: 2.2 Building blocks of hardware of an Embedded System

DEPARTMENT OF ECE, S.R.T.I.S.T Page 5


Railway Track Security System

2.6 HARDWARE
CENTRAL PROCESSING UNIT (CPU)
The Central Processing Unit (processor, in short) can be any of the following:
microcontroller, microprocessor or Digital Signal Processor (DSP). A micro-controller is
a low-cost processor. Its main attraction is that on the chip itself, there will be many other
components such as memory, serial communication interface, analog-to digital converter
etc. So, for small applications, a micro-controller is the best choice as the number of
external components required will be very less. On the other hand, microprocessors are
more powerful, but you need to use many external components with them. D5P is used
mainly for applications in which signal processing is involved such as audio and video
processing.
MEMORY
The memory is categorized as Random Access 11emory (RAM) and Read Only
Memory (ROM). The contents of the RAM will be erased if power is switched off to the
chip, whereas ROM retains the contents even if the power is switched off. So, the
firmware is stored in the ROM. When power is switched on, the processor reads the
ROM; the program is program is executed.
INPUT DEVICES
Unlike the desktops, the input devices to an embedded system have very limited
capability. There will be no keyboard or a mouse, and hence interacting with the
embedded system is no easy task. Many embedded systems will have a small keypad-you
press one key to give a specific command. A keypad may be used to input only the digits.
Many embedded systems used in process control do not have any input device for user
interaction; they take inputs from sensors or transducers 1’fnd produce electrical signals
that are in turn fed to other systems.
OUTPUT DEVICES
The output devices of the embedded systems also have very limited capability.
Some embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the
health status of the system modules, or for visual indication of alarms. A small Liquid
Crystal Display (LCD) may also be used to display some important parameters.

2.7 SOFTWARE
COMMUNICATION INTERFACES
The embedded systems may need to, interact with other embedded systems at
they may have to transmit data to a desktop. To facilitate this, the embedded systems are

DEPARTMENT OF ECE, S.R.T.I.S.T Page 6


Railway Track Security System

provided with one or a few communication interfaces such as RS232, RS422, RS485,
Universal Serial Bus (USB), and IEEE 1394, Ethernet etc.
APPLICATION-SPECIFIC CIRCUITRY
Sensors, transducers, special processing and control circuitry may be required fat
an embedded system, depending on its application. This circuitry interacts with the
processor to carry out the necessary work. The entire hardware has to be given power
supply either through the 230 volts main supply or through a battery. The hardware has to
design in such a way that the power consumption is minimized.

2.8 MICRO CONTROLLER


• Microprocessors are single-chip CPUs used in microcomputers. Microcontrollers
and microprocessors are different in three main aspects: hardware architecture,
applications, and instruction set features.
• Hardware architecture: A microprocessor is a single chip CPU while a
microcontroller is a single IC contains a CPU and much of remaining circuitry of
a complete computer (e.g., RAM, ROM, serial interface, parallel interface, timer,
and interrupt handling circuit).
• Applications: Microprocessors are commonly used as a CPU in computers while
microcontrollers are found in small, minimum component designs performing
control oriented activities.
• Microprocessor instruction sets are processing Intensive.

Their instructions operate on nibbles, bytes, words, or even double words.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 7


Railway Track Security System

CHAPTER 3
HARDWARE DESCRIPTION

3.1 BLOCK DIAGRAM

POWER SUPPLY LCD DISPLAY


SUPPLYUPPLY

INDICATOR-1 MICRO
RED
RED CONTROLLER
TRACKCRACKSE
NSING CIRCUIT

INDICATOR-2
GREEN

Fig 3.1: Block Diagram

DEPARTMENT OF ECE, S.R.T.I.S.T Page 8


Railway Track Security System

3.2 LED (Light Emitting Diode)

Fig: 3.2 LED Displays

A light-emitting diode (LED) is a two-lead semiconductor light source. It is a p–n


junction diode, which emits light when activated. When a suitable voltage is applied to
the leads, electrons are able to recombine with electron holes within the device, releasing
energy in the form of photons. This effect is called electroluminescence, and the color of
the light (corresponding to the energy of the photon) is determined by the energy band
gap of the semiconductor. LEDs are typically small (less than 1 mm2 ) and integrated
optical components may be used to shape the radiation pattern.
Appearing as practical electronic components in 1962, the earliest LEDs emitted
low-intensity infrared light. Infrared LEDs are still frequently used as transmitting
elements in remote-control circuits, such as those in remote controls for a wide variety of
consumer electronics. The first visible-light LEDs were also of low intensity and limited
to red. Modern LEDs are available across the visible, ultraviolet,
and infrared wavelengths, with very high brightness.
Early LEDs were often used as indicator lamps for electronic devices, replacing
small incandescent bulbs. They were soon packaged into numeric readouts in the form
of seven-segment displays and were commonly seen in digital clocks. Recent
developments in LEDs permit them to be used in environmental and task lighting. LEDs
have allowed new displays and sensors to be developed, while their high switching rates
are also used in advanced communications technology.
LEDs have many advantages over incandescent light sources including lower
energy consumption, longer lifetime, improved physical robustness, smaller size, and
faster switching. Light-emitting diodes are now used in applications as diverse as aviation

DEPARTMENT OF ECE, S.R.T.I.S.T Page 9


Railway Track Security System

lighting, automotive headlamps, advertising, general lighting, traffic signals, camera


flashes, and lighted wallpaper. As of 2017, LED lights home room lighting are as cheap
or cheaper than compact fluorescent lamp sources of comparable output. They are also
significantly more energy efficient and, arguably, have fewer environmental concerns
linked to their disposal.
INITIAL COMMERCIAL DEVELOPMENT
The first commercial LEDs were commonly used as replacements
for incandescent and neon indicator lamps, and in seven-segment displays, first in
expensive equipment such as laboratory and electronics test equipment, then later in such
appliances as TVs, radios, telephones, calculators, as well as watches. Until 1968, visible
and infrared LEDs were extremely costly, in the order of US$200 per unit, and so had
little practical use. The Monsanto Company was the first organization to mass-produce
visible LEDs, using gallium arsenide phosphide (GaAsP) in 1968 to produce red LEDs
suitable for indicators. Hewlett Packard (HP) introduced LEDs in 1968, initially using
GaAsP supplied by Monsanto. These red LEDs were bright enough only for use as
indicators, as the light output was not enough to illuminate an area. Readouts in
calculators were so small that plastic lenses were built over each digit to make them
legible. Later, other colors became widely available and appeared in appliances and
equipment. In the 1970s commercially successful LED devices at less than five cents
each were produced by Fairchild Optoelectronics. These devices employed compound
semiconductor chips fabricated with the planar process invented by Dr. Jean Hoerni
at Fairchild Semiconductor. The combination of planar processing for chip fabrication
and innovative packaging methods enabled the team at Fairchild led by optoelectronics
pioneer Thomas Brandt to achieve the needed cost reductions. These methods continue to
be used by LED producers.

LED display of a TI-30 scientific calculator (ca. 1978), which uses plastic lenses
to increase the visible digit size Most LEDs were made in the very common 5 mm T1¾
and 3 mm T1 packages, but with rising power output, it has grown increasingly necessary
to shed excess heat to maintain reliability, so more complex packages have been adapted
for efficient heat dissipation. Packages for state-of-the-art high-power LEDs bear little
resemblance to early LEDs.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 10


Railway Track Security System

WORKING PRINCIPLE
A P-N junction can convert absorbed light energy into a proportional electric
current. The same process is reversed here (i.e. the P-N junction emits light when
electrical energy is applied to it). This phenomenon is generally
called electroluminescence, which can be defined as the emission of light from a semi-
conductor under the influence of an electric field. The charge carriers recombine in a
forward-biased P-N junction as the electrons cross from the N-region and recombine with
the holes existing in the P-region. Free electrons are in the conduction band of energy
levels, while holes are in the valence energy band. Thus the energy level of the holes will
be lesser than the energy levels of the electrons. Some portion of the energy must be
dissipated in order to recombine the electrons and the holes. This energy is emitted in the
form of heat and light.
The electrons dissipate energy in the form of heat for silicon and germanium
diodes but in gallium arsenide phosphide (GaAsP) and gallium phosphide (GaP)
semiconductors, the electrons dissipate energy by emitting photons. If the semiconductor
is translucent, the junction becomes the source of light as it is emitted, thus becoming a
light-emitting diode, but when the junction is reverse biased no light will be produced by
the LED and, if the potential is great enough, the device will be damaged.
3.3 LCD 16x2 ( Liquid Crystal Display)
LCD (Liquid Crystal Display) screen is an electronic display module and find a
wide range of applications. A 16x2 LCD display is very basic module and is very
commonly used in various devices and circuits. These modules are preferred over seven
segments and other multi segment LEDs. The reasons being: LCDs are economical;
easily programmable; have no limitation of displaying special & even custom characters ,

Fig 3.3 Alphanumeric Character 16x2 LCD display.

PIN DESCRIPTION
DEPARTMENT OF ECE, S.R.T.I.S.T Page 11
Railway Track Security System

Pin No Function Name


1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V) Vcc
3 Contrast adjustment; through a variable resistor VEE

4 Selects command register when low; and data register Register


when high Select
5 Low to write to the register; High to read from the Read/write
register
6 Sends data to data pins when a high to low pulse is Enable
given
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-
Table: 3.1 LCD Commands
WORKING PRINCIPLE
A 16x2 LCD means it can display 16 characters per line and there are 2 such
lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two
registers, namely, Command and Data. The command register stores the command
instructions given to the LCD. A command is an instruction given to LCD to do a
predefined task like initializing it, clearing its screen, setting the cursor position,
controlling display etc. The data register stores the data to be displayed on the LCD. The
data is the ASCII value of the character to be displayed on the LCD. Click to learn more
about internal structure of a LCD.

COMMANDS

DEPARTMENT OF ECE, S.R.T.I.S.T Page 12


Railway Track Security System

3.4 POWER SUPPLY


230V AC to5V DC Power Supply section

Required components
S.No Component Name Quantity Ratings
1 Step down Transformer 1 12-0-12 1Amp
2 Bridge rectifier 1 Diode type
3 Voltage regulator 1 7805
4 Filter 1 1000uF
5 Filter 1 100uF
Table: 3.2 Power supply

Block Diagram of Power Supply:

DEPARTMENT OF ECE, S.R.T.I.S.T Page 13


Railway Track Security System

Fig: 3.4 Block Diagram of Power Supply

Step-Down Transformer
A transformer is an electrical device that transfers electrical energy
between two or more circuits through electromagnetic induction. Commonly,
transformers are used to increase or decrease the voltages of alternating current in
electric power applications.

It is a general purpose chassis mounting mains transformer. Transformer has 240V


primary windings and secondary winding. The transformer has flying colored insulated

DEPARTMENT OF ECE, S.R.T.I.S.T Page 14


Railway Track Security System

connecting leads (Approx 100 mm long).The Transformer act as step down transformer
reducing 230V AC to 12V AC voltage. The transformer is a static electrical device that
transfers energy by inductive coupling between its winding circuits. A varying current in
the primary winding creates a varying magnetic flux in the transformer's core and thus a
varying magnetic flux through the secondary winding. This varying magnetic flux
induces a varying electromotive force (E.M.F) or voltage in the secondary winding. The
transformer has cores made of high permeability silicon steel. The steel has a
permeability many times that of free space and the core thus serves to greatly reduce the
magnetizing current and confine the flux to a path which closely couples the windings.
The solid core uses one of the common design of laminated core is made from
interleaved stacks of E - shaped steel sheets capped with I - shaped pieces, leading to its
name of E - I transformer. Such a design tends to exhibit more losses, but is very
economical to manufacture. Windings are arranged concentrically to minimize flux
leakage. The effect of laminations is to confine eddy currents to highly elliptical paths
that enclose little flux, and so reduce their magnitude. Thinner laminations reduce losses,
but are more laborious and expensive to construct. Thin laminations are generally used on
high-frequency transformers, with some of very thin steel laminations able to operate up
to 10 KHz.
BRIDGE RECTIFIER:

application and for any other technical guidance. A Bridge rectifier is an Alternating
Current (AC) to Direct Current (DC) converter that rectifies mains AC input to DC
output. Bridge Rectifiers are widely used in power supplies that provide necessary DC
voltage for the electronic components or devices. They can be constructed with four or
more diodes or any other controlled solid state switches.
Depending on the load current requirements, a proper bridge rectifier is selected.
Components’ ratings and specifications, breakdown voltage, temperature ranges, transient
current rating, forward current rating, mounting requirements and other considerations
are taken into account while selecting a rectifier power supply for an appropriate
electronic circuit’s application..A bridge rectifier circuit is a common part of the
electronic power supplies. Many electronic circuits require rectified DC power supply for
powering the various electronic basic components from available AC mains supply. We
can find this rectifier in a wide variety of electronic AC power devices like home

DEPARTMENT OF ECE, S.R.T.I.S.T Page 15


Railway Track Security System

appliances, motor controllers, modulation process, welding applications, etc. The main
advantage of bridge rectifier is that it produces almost double the output voltage as with
the case of a full wave rectifier using center-tapped transformer. But this circuit doesn’t
need center tapped transformer so it resembles low-cost rectifier. The bridge rectifier
circuit diagram consists of various stages of devices like transformer, Diode Bridge,
filtering and regulators. Generally all these blocks combination is called as regulated DC
power supply that powers various electronic appliances.
A single-phase bridge rectifier consists of four diodes and this configuration is
connected across the load. During the Positive half cycle of the input AC waveform
diodes D1 and D2 are forward biased and D3 and D4 are reverse biased. When the
voltage, more than the threshold level of the diodes D1 and D2, starts conducting – the
load current starts flowing through it, as shown as red lines path in the diagram below.
During the negative half cycle of the input AC waveform, the diodes D3 and D4 are
forward biased, and D1 and D2 are reverse biased. Load current starts flowing through
the D3 and D4 diodes when these diodes starts conducting as shown in the figure. We can
observe that in both the cases, the load current direction is same, i.e., up to down as
shown in the figure – so unidirectional, which means DC current. Thus, by the usage of a
bridge rectifier, the input AC current is converted into a DC current. The output at the
load with this bridge wave rectifier is pulsating in nature, but for producing a pure DC
requires additional filter like capacitor. The same operation is applicable for different
bridge rectifiers, but in case of controlled rectifiers thyristors triggering is necessary to
drive the current to load. This is all about the bridge rectifier theory its types, circuit and
working principles. We hope that this wholesome matter about this topic will be helpful
in building students’ electronics or electrical projects as well as in observing various
electronic devices or appliances. We appreciate you for your keen attention and focus on
this article.
7805:
A regulated power supply is very much essential for several electronic devices
due to the semiconductor material employed in them have a fixed rate of current as well
as voltage. The device may get damaged if there is any deviation from the fixed rate. The
AC power supply gets converted into constant DC by this circuit. By the help of a voltage
regulator DC, unregulated output will be fixed to a constant voltage. The circuit is made
up of linear voltage regulator 7805 along with capacitors and resistors with bridge
rectifier made up from diodes. From giving an unchanging voltage supply to building
confident that output reaches uninterrupted to the appliance, the diodes along with
capacitors handle elevated efficient signal conveyable.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 16


Railway Track Security System

CAPACITOR:
The rectifier diode supplies current to charge a reservoir capacitor on each cycle
of the input wave. The reservoir capacitor is large electrolytic, usually of several hundred
or even a thousand or more microfarads, especially in mains frequency PSUs. This very
large value of capacitance is required because the reservoir capacitor, when charged, must
provide enough DC to maintain a steady PSU output in the absence of an input current;
i.e. during the gaps between the positive half cycles when the rectifier is not conducting.

CHAPTER 4
ARDUINO PROCESSOR
4.1 ARDUINO DESCRIPTION
• What is Arduinio?
• Why Arduino?
• How do I use Arduino?

4.1.1 WHAT IS ARDUINO?


Arduino is an open-source electronics platform based on easy-to-use hardware
and software. Arduino boards are able to read inputs - light on a sensor, a finger on a

DEPARTMENT OF ECE, S.R.T.I.S.T Page 17


Railway Track Security System

button, or a Twitter message - and turn it into an output - activating a motor, turning on an
LED, publishing something online. You can tell your board what to do by sending a set of
instructions to the microcontroller on the board. To do so you use the Arduino
programming language (based on Wiring), and the Arduino Software (IDE), based on
Processing.
Over the years Arduino has been the brain of thousands of projects, from
everyday objects to complex scientific instruments. A worldwide community of makers -
students, hobbyists, artists, programmers, and professionals - has gathered around this
open-source platform, their contributions have added up to an incredible amount of
accessible knowledge that can be of great help to novices and experts alike.
Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast
prototyping, aimed at students without a background in electronics and programming. As
soon as it reached a wider community, the Arduino board started changing to adapt to
new needs and challenges, differentiating its offer from simple 8-bit boards to products
for IoT applications, wearable, 3D printing, and embedded environments. All Arduino
boards are completely open-source, empowering users to build them independently and
eventually adapt them to their particular needs. The software, too, is open-source, and it
is growing through the contributions of users worldwide.
4.1.2 WHY ARDUINO?
Thanks to its simple and accessible user experience, Arduino has been used in
thousands of different projects and applications. The Arduino software is easy-to-use for
beginners, yet flexible enough for advanced users. It runs on Mac, Windows, and Linux.
Teachers and students use it to build low cost scientific instruments, to prove chemistry
and physics principles, or to get started with programming and robotics. Designers and
architects build interactive prototypes, musicians and artists use it for installations and to
experiment with new musical instruments. Makers, of course, use it to build many of the
projects exhibited at the Maker Faire, for example. Arduino is a key tool to learn new
things. Anyone - children, hobbyists, artists, programmers - can start tinkering just
following the step by step instructions of a kit, or sharing ideas online with other
members of the Arduino community.
There are many other microcontrollers and microcontroller platforms available for
physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's
Handyboard, and many others offer similar functionality. All of these tools take the messy
details of microcontroller programming and wrap it up in an easy-to-use package.
Arduino also simplifies the process of working with microcontrollers, but it offers some
advantage for teachers, students, and interested amateurs over other systems

DEPARTMENT OF ECE, S.R.T.I.S.T Page 18


Railway Track Security System

 Inexpensive - Arduino boards are relatively inexpensive compared to other


microcontroller platforms. The least expensive version of the Arduino module can
be assembled by hand, and even the pre-assembled Arduino modules cost less
than $50

 Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh


OSX, and Linux operating systems. Most microcontroller systems are limited to
Windows.

 Simple, clear programming environment - The Arduino Software (IDE) is


easy-to-use for beginners, yet flexible enough for advanced users to take
advantage of as well. For teachers, it's conveniently based on the Processing
programming environment, so students learning to program in that environment
will be familiar with how the Arduino IDE works.

 Open source and extensible software - The Arduino software is published as


open source tools, available for extension by experienced programmers. The
language can be expanded through C++ libraries, and people wanting to
understand the technical details can make the leap from Arduino to the AVR C
programming language on which it's based. Similarly, you can add AVR-C code
directly into your Arduino programs if you want to.

 Open source and extensible hardware - The plans of the Arduino boards are
published under a Creative Commons license, so experienced circuit designers
can make their own version of the module, extending it and improving it. Even
relatively inexperienced users can build the breadboard version of the module in
order to understand how it works and save money.

4.1.3 HOW DO I USE ARDUINO?


See the getting started guide. If you are looking for inspiration you can find a
great variety of Tutorials on Arduino Project Hub.
The text of the Arduino getting started guide is licensed under a Creative
Commons Attribution-ShareAlike 3.0 License. Code samples in the guide are released
into the public domain.
Overview
5V
8-bit
16 MHz

DEPARTMENT OF ECE, S.R.T.I.S.T Page 19


Railway Track Security System

AVR

4.2 OVERVIEW
Arduino/Genuine Uno is a microcontroller board based on the ATmega328P
(datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs),
6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP
header and a reset button. It contains everything needed to support the microcontroller;
simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or
battery to get started.. You can tinker with your UNO without worring too much about
doing something wrong, worst case scenario you can replace the chip for a few dollars
and start over again.
"Uno" means one in Italian and was chosen to mark the release of Arduino
Software (IDE) 1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the
reference versions of Arduino, now evolved to newer releases. The Uno board is the first
in a series of USB Arduino boards, and the reference model for the Arduino platform; for
an extensive list of current, past or outdated boards see the Arduino index of boards.
You can find here your board warranty information’s.
The Uno differs from all preceding boards in that it does not use the FTDI USB-
to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2up to version R2)
programmed as a USB-to-serial converter. Revision 2of the Uno board has a resistor
pulling the 8U2 HWB line to ground, making it easier to put into DFU mode. Revision
3of the board has the following new features:

 1.0 pin out: added SDA and SCL pins that are near to the AREF pin and two other new
pins placed near to the RESET pin, the IOREF that allow the shields to adapt to the
voltage provided from the board. In future, shields will be compatible both with the board
that uses the AVR, which operate with 5V and with the ArduinoDue, that operate with
3.3V. The second one is a not connected pin that is reserved for future purposes.

 Stronger RESET circuit.

 At mega 16U2 replace the 8U2. "Uno" means one in Italian and is named to mark the
upcoming release of Arduino 1.0. The Uno and version 1.0 will be the reference versions
of Arduino, moving forward. The Uno is the latest in a series of USB Arduino boards,
and the reference model for the Arduino platform; for a comparison with previous
versions, see the index of Arduino boards
SUMMERY
MicrocontrollerATmega328Operating Voltage5V Input Voltage (recommended)7-
12VInput Voltage (limits)6-20VDigital I/O Pins14 (of which 6 provide PWM

DEPARTMENT OF ECE, S.R.T.I.S.T Page 20


Railway Track Security System

output)Analog Input Pins6DC Current per I/O Pin40 mA DC Current for 3.3V Pin50 mA
Flash Memory32 KB (ATmega328) of which 0.5 KB used by boot loader SRAM 2 KB
(ATmega328)EEPROM1 KB (ATmega328)Clock Speed 16 MHz Schematic & Reference
Design
EAGLE FILES: Arduino-uno-Rev3-reference-design.zip
(NOTE: works withEagle6.0andnewer)

4.3 ARDUINO PIN DIAGRAM

DEPARTMENT OF ECE, S.R.T.I.S.T Page 21


Railway Track Security System

Fig: 4.1 ATmega328P pin mapping


Schematic:
Arduino-uno-Rev3-schematic
Note: The Arduino reference design can use an Atmega8, 168, or 328, Current models
use an ATmega328, but an Atmega8 is shown in the schematic for reference. The pin
configuration is identical on all three processors.
Power:TheArduino Uno can be powered via the USB connection or with an external
power supply. The power source is selected automatically. External (non-USB) power can
come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be
connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads
from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.
The board can operate on an external supply of 6 to 20 volts. If supplied with less than
7V, however, the 5V pin may supply less than five volts and the board may be unstable. If
using more than 12V, the voltage regulator may overheat and damage the board. The
recommended range is 7 to 12 volts. The power pins are as follows

 VIN.The input voltage to the Arduino board when it's using an external power source
(as opposed to 5 volts from the USB connection or other regulated power source). You

DEPARTMENT OF ECE, S.R.T.I.S.T Page 22


Railway Track Security System

can supply voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.

 5V.This pin outputs a regulated 5V from the regulator on the board. The board can be
supplied with power either from the DC power jack (7 -12V), the USB connector (5V), or
the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the
regulator, and can damage your board. We don't advise it.

 3V3.A 3.3 volt supply generated by the on-board regulator. Maximum current draw is
50 mA.

 GND. Ground pins.

Memory The ATmega328 has 32 KB (with 0.5 KB used for the boot loader). It also has 2
KB of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM
library). Input and Output Each of the 14 digital pins on the Uno can be used as an input
or output, using pin Mode (), digital Write (), and digital Read () functions. They operate
at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-
up resistor (disconnected by default) of 20-50 ohms. In addition, some pins have
specialized functions:

Serial: 0 (RX) and 1 (TX).Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to-
TTL Serial chip.

External Interrupts: 2 and 3.These pins can be configured to trigger an interrupt on a


low value, a rising or falling edge, or a change in value. See the attach Interrupt ()
function for details.

PWM: 3, 5, 6, 9, 10, and 11.Provide 8-bit PWM output with the analog Write ()
function.

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK).These pins support SPI communication


using the SPI library.

LED: 13.There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off. The Uno has 6 analog inputs, labeled
A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values).
By default they measure from ground to 5 volts, though is it possible to change the upper
end of their range using the AREF pin and the analog Reference
() function. Additionally, some pins have specialized functionality:

TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire
library. There are a couple of other pins on the board:

DEPARTMENT OF ECE, S.R.T.I.S.T Page 23


Railway Track Security System

AREF.Reference voltage for the analog inputs. Used with analog Reference ().

Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board. See also the mapping between
Arduino pins and ATmega328 ports. The mapping for the Atmega8, 168, and 328 is
identical. Communication The Arduino Uno has a number of facilities for communicating
with a computer, another Arduino, or other microcontrollers.
The ATmega328 provides UART TTL (5V) serial communication, which is
available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on the board channels this
serial communication over USB and appears as a virtual com port to software on the
computer. The '16U2 firmware uses the standard USB COM drivers, and no external
driver is needed. However, on Windows, a .inf file is required. The Arduino software
includes a serial monitor which allows simple textual data to be sent to and from the
Arduino board. The RX and TX LEDs on the board will flash when data is being
transmitted via the USB- to-serial chip and USB connection to the computer (but not for
serial communication on pins 0 and 1). A Software Serial library allows for serial
communication on any of the Uno's digital pins. The ATmega328 also supports I2C
(TWI) and SPI communication. The Arduino software includes a Wire library to simplify
use of the I2C bus; see the documentation for details. For SPI communication, use the
SPI library

4.4 PROGRAMMING
The Arduino Uno can be programmed with the Arduino software (download).
Select "Arduino Uno from the Tools > Board menu (according to the microcontroller on
your board). For details, see the reference and tutorials
The ATmega328 on the Arduino Uno comes pre burned with a boot loader that
allows you to upload new code to it without the use of an external hardware programmer.
It communicates using the original STK500 protocol (reference, C header files). You can
also bypass the boot loader and program the microcontroller through the ICSP (In-Circuit
Serial Programming) header; see these instructions for details. The ATmega16U2 (or 8U2
in the rev1 and rev2 boards) firmware source code is available. The ATmega16U2/8U2 is
loaded with a DFU boot loader, which can be activated by:

 On Rev1 boards: connecting the solder jumper on the back of the board (near the map
of Italy) and then resetting the 8U2.

 On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB line to
ground, making it easier to put into DFU mode. You can then use Atmel's FLIP software
(Windows) or the DFU programmer (Mac OS X and Linux) to load a new firmware. Or

DEPARTMENT OF ECE, S.R.T.I.S.T Page 24


Railway Track Security System

you can use the ISP header with an external programmer (overwriting the DFU boot
loader). See this user-contributed tutorial for more information.
Automatic (Software) Reset
Rather than requiring a physical press of the reset button before an upload, the
Arduino Uno is designed in a way that allows it to be reset by software running on a
connected computer. One of the hardware flow control lines (DTR) of the
ATmega8U2/16U2 is connected to the reset line of the ATmega328via a 100 nano farad
capacitor. When this line is asserted (taken low), the reset line drops long enough to reset
the chip. The Arduino software uses this capability to allow you to upload code by simply
pressing the upload button in the Arduino environment. This means that the boot loader
can have a shorter timeout, as the lowering of DTR can be well-coordinated with the start
of the upload. This setup has other implications. When the Uno is connected to either a
computer running Mac OS X or Linux, it resets each time a connection is made to it from
software (via USB). For the following half-second or so, the boot loader is running on the
Uno. While it is programmed to ignore malformed data (i.e. anything besides an upload
of new code), it will intercept the first few bytes of data sent to the board after a
connection is opened. If a sketch running on the board receives one-time configuration or
other data when it first starts, make sure that the software with which it communicates
waits a second after opening the connection and before sending this data. The Uno
contains a trace that can be cut to disable the auto-reset. The pads on either side of the
trace can be soldered together to re-enable it. It's labeled "RESET-EN". You may also be
able to disable the auto-reset by connecting a 110 ohm resistor from 5V to the reset line;
see this forum thread for details.
USB Over current Protection TheArduino Uno has a resettable poly fuse that protects
your computer's USB ports from shorts and over current. Although most computers
provide their own internal protection, the fuse provides an extra layer of protection. If
more than 500 mA is applied to the USB port, the fuse will automatically break the
connection until the short or overload is removed.

4.5 PHYSICAL CHARACTERISTICS


The maximum length and width of the Uno PCB are 2.7 and 2.1 inches
respectively, with the USB connector and power jack extending beyond the former
dimension. Four screw holes allow the board to be attached to a surface or case. Note that
the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even multiple of the
100 mil spacing of the other pins.

4.6 ARDUINO HOW TO PROJECT IDE

DEPARTMENT OF ECE, S.R.T.I.S.T Page 25


Railway Track Security System

This page is obsolete. You should instead see the Windows Howto or the Mac OS
X howto (both in the Arduino guide).
These are the steps you need to follow in order to be up and running:
1. Get an Arduino board
2. Download the Arduino environment
3. Install the USB drivers
4. Connect the board
5. Upload a program
1. Get an Arduino board
The Arduinoi/o board is a simple circuit featuring the ATmega8 processor from
Atmel. The board is composed of a printed circuit board (PCB) and electronic parts.
There are a few ways to get an Arduino board:

 Buy a readymade board. See how you can buy a board or just the PCB.

o European distributor

o US distributor

 Build your own board. If you want you can build your own PCB just by
downloading the CAD files from the Hardware page. Extract the .brd file and
send it to a PCB manufacturer. Be aware that manufacturing a single pcb will be
very expensive. It's better to get together with other people and make 20 or 30 at a
time. Since you get the full CAD files you can make your own customised version
of Arduino. if you make modifications or fix bugs please send us your changes!
o Purchase parts. purchase the parts from any electronics store. The Serial
version in particular has been designed to use the most basic parts that can
be found anywhere in the world. The USB version on the other hand
requires some advanced soldering

DEPARTMENT OF ECE, S.R.T.I.S.T Page 26


Railway Track Security System

Fig: 4.2 Arduino micro controller board


o Skills because of the FTDI chip that is ansmd part. Here is a list of parts
for the serial board.
o Assemble the board. We put together a step by step guide on how to build
an arduino board. Newbies: never soldered before? afraid of trashing
thousands of boards before getting one properly soldered? fear not :) learn
to master the art of soldering.
o Program the bootloader. In order for the development environment to be
able to program the chip, this has to be programmed with a piece of code
called bootloader. See the boot loader page on how to program it on your
chip.
2. Download the Arduino environment
To program the Arduino board you need the Arduino environment.
Download Arduino: From the software page.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 27


Railway Track Security System

Linux note: For help getting the Arduino IDE running on Debian, please see the FAQ
("How can I run the Arduino IDE under Linux?").
Mac OS X note: After downloading the IDE, run the macosx_setup.command. It corrects
permission on a few files for use with the serial port and will prompt you for your
password. You may need to reboot after running this script.

For more information, see the guide to the Arduino environment.


3. Install the USB drivers
If you are using a USB Arduino, you will need to install the drivers for the FTDI chip on
the board. These can be found in the driver’s directory of the Arduino distribution.
On Windows, you will need to unzip FTDI USB Drivers.zip. Then, when you plug in the
Arduino board, point the Windows Add Hardware wizard to the FTDI USB Drivers
directory.
On the Mac, mount the FTDIUSBSerialDriver_v2_1_6.dmg (on PPC machines) or the
FTDIUSBSerialDriver_v2_2_6_Intel.dmg (on Intel machines) disk image and run the
included FTDIUSBSerialDriver.pkg.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 28


Railway Track Security System

The latest version of the drivers can be found on the FTDI website.
4 .Connect the board
If you're using a serial board, power the board with an external power supply (6 to
25 volts DC, with the core of the connector positive). Connect the board to a serial port
on your computer.
On the USB boards, the power source is selected by the jumper between the USB
and power plugs. To power the board from the USB port (good for controlling low power
devices like LEDs), place the jumper on the two pins closest to the USB plug. To power
the board from an external power supply (needed for motors and other high current
devices), place the jumper on the two pins closest to the power plug. Either way, connect
the board to a USB port on your computer. On Windows, the Add New Hardware wizard
will open; tell it you want to specify the location to search for drivers and point to the
folder containing the USB drivers you unzipped in the previous step.
The power LED should go on.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 29


Railway Track Security System

5 .Upload a Program
Open the LED blink example sketch: File > Sketchbook > Examples >led_blink.

Here's what the code for the LED blink example looks like.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 30


Railway Track Security System

Select the serial device of the Arduino board from the Tools | Serial Port menu. On
Windows, this should be COM1 or COM2 for a serial Arduino board, or COM3, COM4,
or COM5 for a USB board. On the Mac, this should be something like /dev/cu.usbserial-
1B1 for a USB board, or something like /dev/cu.USA19QW1b1P1.1 if using a Keyspan
adapter with a serial board (other USB-to-serial adapters use different names).

DEPARTMENT OF ECE, S.R.T.I.S.T Page 31


Railway Track Security System

Push the reset button on the board then click the Upload button in the IDE. Wait a few
seconds. If successful, the message "Done uploading." will appear in the status bar.

If the Arduino board doesn't show up in the Tools | Serial Port menu, or you get an
error while uploading, please see the FAQ for troubleshooting suggestions.
A few seconds after the upload finishes, you should see the amber (yellow) LED
on the board start to blink.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 32


Railway Track Security System

CHAPTER 5
SOFTWARE IMPLEMENTATION
5.1 DATA TYPES
You people have already come across the word “Data types” in C- Language.
Herealso the functionality and the meaning of the word is same except a small change in
the prefix of their labels. Now we will discuss some of the widely used data types for
embedded C- programming.
Unsigned char:
The unsigned char is an 8-bit data type that takes a value in the range of 0-255(00-
FFH). It is used in many situations, such as setting a counter value, where thereis no need
for signed data we should use the unsigned char instead of the signed char.Remember that
C compilers use the signed char as the default if we do not put the keyword .
Signed char:
The signed char is an 8-bit data type that uses the most significant bit (D7of D7-
D0) to represent the – or + values. As a result, we have only 7 bits for themagnitude of
the signed number, giving us values from -128 to +127. In situationswhere + and – are
needed to represent a given quantity such as temperature, the use ofthe signed char data
type is a must.
Unsigned int:
The unsigned int is a 16-bit data type that takes a value in the range of 0 to65535
(0000-FFFFH). It is also used to set counter values of more than 256. We mustuse the int
data type unless we have to. Since registers and memory are in 8-bit chunks,the misuse of
int variables will result in a larger hex file. To overcome this we can usethe unsigned char
in place of unsigned int.
Signed int:
Signed int is a 16-bit data type that uses the most significant bit (D15 of D15-D0)
to represent the – or + value. As a result we have only 15 bits for the magnitude ofthe
number or values from -32,768 to +32,767.
Sbit (single bit):
The sbit data type is widely used and designed specifically to access single bit
addressable registers. It allows access to the single bits of the SFR registers.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 33


Railway Track Security System

5.2 ABOUT KEIL


1. Click on the Keil u Vision Icon on Desktop
2. The following fig will appear

3. Click on the Project menu from the title bar.


4. Then Click on New Project

DEPARTMENT OF ECE, S.R.T.I.S.T Page 34


Railway Track Security System

5. Save the Project by typing suitable project name with no extension in u r

DEPARTMENT OF ECE, S.R.T.I.S.T Page 35


Railway Track Security System

own folder sited in either C:\ or D

6. Then Click on Save button above.


7. Select the component for u r project. i.e. Atmel……

DEPARTMENT OF ECE, S.R.T.I.S.T Page 36


Railway Track Security System

8. Click on the + Symbol beside of Atmel

9. Select AT89C51 as shown below

DEPARTMENT OF ECE, S.R.T.I.S.T Page 37


Railway Track Security System

10. Then Click on “OK”


11. The Following fig will appear

DEPARTMENT OF ECE, S.R.T.I.S.T Page 38


Railway Track Security System

12. Then Click either YES or NO………mostly “NO”


13. Now your project is ready to USE
14. Now double click on the Target1, you would get another option “Source
group 1” as shown in next page.
15. Click on the file option from menu bar and select “new”

DEPARTMENT OF ECE, S.R.T.I.S.T Page 39


Railway Track Security System

16. The next screen will be as shown in next page, and just maximize it by
double clicking on its blue boarder.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 40


Railway Track Security System

17. Now start writing program in either in “C” or “ASM”


18. For a program written in Assembly, then save it with extension “. asm” and
for “C” based program save it with extension “ .C”

DEPARTMENT OF ECE, S.R.T.I.S.T Page 41


Railway Track Security System

19. Now right click on Source group 1 and click on “Add files to Group Source”

DEPARTMENT OF ECE, S.R.T.I.S.T Page 42


Railway Track Security System

20. Now you will get another window, on which by default “C” files will
appear.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 43


Railway Track Security System

21. Now select as per your file extension given while saving the file

22. Click only one time on option “ADD”

23. Now Press function key F7 to compile. Any error will appear if so happen.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 44


Railway Track Security System

24. If the file contains no error, then press Control+F5 simultaneously.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 45


Railway Track Security System

25. The new window is as follows

26. Then Click “OK”


27. Now Click on the Peripherals from menu bar, and check your required port
as shown in fig below

DEPARTMENT OF ECE, S.R.T.I.S.T Page 46


Railway Track Security System

28. Drag the port a side and click in the program file.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 47


Railway Track Security System

29. Now keep Pressing function key “F11” slowly and observe.
30. You are running your program successfully.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 48


Railway Track Security System

CHAPTER 6
ADVANTAGES AND APPLICATIONS

6.1 ADVANTAGES:

 Fast detect and reporting system


 Less cost
 Low power consumption
 Less analysis time
 Easy availability of components
 Reliable circuit
 Complete elimination of manpower

6.2 APPLICATIONS:

 Railway Departments

DEPARTMENT OF ECE, S.R.T.I.S.T Page 49


Railway Track Security System

CHAPTER 7
RESULT, CONCLUTION AND FUTURE SCOPE

7.1 RESULT
Hence, we had designed a crack detection system for the security of railways to
avoid accidents.

7.2 CONCLUSION
The proposed Arduino based railway track security system has the potential for
detecting the cracks in the rail track including minor cracks automatically without any
human intervention. There are many advantages with the proposed system as compared
with traditional detection techniques. The advantages includes fast detect and reporting
system, less cost, low power consumption and less analysis time. Also the easy
availability of the components and the simplicity of idea make the proposed system ideal
for implementation on a large scale with very little initial investment. Therefore it can
work efficiently and effectively under working condition. By this proposed model, we
will easily avoids the accidents occurs by the track side crack which will help us for
saving many lives.

7.3 FUTURE SCOPE


By using Wireless sensor network techniques we can develop more and more
reliable security system applications in which continuously monitors the railway track
through the sensor and detects any abnormality in the track. The sensor nodes are
equipped with the sensors that can sense the vibration in the railway track due to coming
train. The geographical positioning sensors are placed on the trains. These sensors send
the train’s geographic location. The complete process is needed to be real time in nature
and should meet the deadlines.
The crack detection system can be enhanced using Anti Collision Device (ACD)
is a self-acting microprocessor based data communication device designed and developed
by Konkan Railway (KR). The network of ACD system prevents high-speed head on
collision in mid-sections, station areas and at level-crossing gates, thereby saving the
lives of rail passengers and road users. This device can be integrated with the Anti-
Collision Device for better sophistication and optimization.

DEPARTMENT OF ECE, S.R.T.I.S.T Page 50


Railway Track Security System

APPENDIX

#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int ledPin = 9;
const int ledPin1 = 10;
const int ledPin2= 13;
const int buttonPin = 6;
const int buttonPin1 = 7;
const int buttonPin2= 8;
int buttonState = 0;
int buttonState1 = 0;
int buttonState2= 0;
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("...WELCOME TO...");
lcd.setCursor(0,1);
lcd.print("...PROJECT...");
delay(4000);
pinMode(buttonPin, INPUT);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop()
{
buttonState = digitalRead(buttonPin);
buttonState1 = digitalRead(buttonPin1);
buttonState2 = digitalRead(buttonPin2);
if (buttonState == HIGH&&buttonState1== LOW&&buttonState2== LOW)
{
// turn LED on:
digitalWrite(ledPin,LOW);
digitalWrite(ledPin1,LOW);
DEPARTMENT OF ECE, S.R.T.I.S.T Page 51
Railway Track Security System

lcd.clear();
delay(1000);
lcd.setCursor(0, 0);
lcd.print(".FAULT DETECTED");
lcd.setCursor(0,1);
lcd.print(".AT STAGE-1.");
delay(1000);
}
else if (buttonState == HIGH&&buttonState1== HIGH&&buttonState2== LOW)
{
digitalWrite(ledPin,HIGH);
digitalWrite(ledPin1,LOW);
lcd.clear();
delay(1000);
lcd.setCursor(0,0);
lcd.print(".FAULT DETECTED");
lcd.setCursor(0,1);
lcd.print(".AT STAGE-2.");
delay(1000);
}
else if(buttonState == HIGH&&buttonState1== HIGH&&buttonState2== HIGH)
{
digitalWrite(ledPin,HIGH);
digitalWrite(ledPin1,HIGH);
lcd.clear();
delay(1000);
lcd.setCursor(0, 0);
lcd.print(".FAULT ");
lcd.setCursor(0,1);
lcd.print(".NOT DETECTED.");
delay(1000);
}
}

BIBLIOGRAPHY

DEPARTMENT OF ECE, S.R.T.I.S.T Page 52


Railway Track Security System

References

 John Catsoulis (May 2005). Designing Embedded Hardware, 2nd Edition.


O'Reilly. ISBN 0-596-00755-8.
 James M. Conrad; Alexander G. Dean (September 2011). Embedded Systems, An
Introduction Using the Renesas RX62N Microcontroller. Micrium. ISBN 978-
1935-7729-96.
 Klaus Elk (August 2016). Embedded Software Development for the Internet Of
Things, The Basics, The Technologies and Best Practices. ISBN 978-1534602533.

Name of the sites

www.atmel.databook.com
www.keil.com
www.mitel.datbook.com

DEPARTMENT OF ECE, S.R.T.I.S.T Page 53

You might also like