You are on page 1of 52

RAILWAY TRACK SECURITY SYSTEM

A Main Project Report


Submitted to the FACULTY of ENGINEERING of
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, KAKINADA
in partial fulfillment of the requirements
for award of the Degree of
Bachelor of Technology
in
Electronics and Communication Engineering
by
M.SURYA CHANDRA S.CHAITANYA BHARATHI
(09481A0472) (09481A04A1)

N.P.G.J.SWAROOP P.GOWTHAM KRISHNA


(09481A0474) (09481A0488)

Under the Guidance of

Mr.Y. SRI CHAKRAPANI


Associate Professor

Department of Electronics and Communication Engineering


GUDLAVALLERU ENGINEERING COLLEGE
SESHADRI RAO KNOWLEDGE VILLAGE
GUDLAVALLERU-521 356
ANDHRA PRADESH

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.

(Mr.Y. SRI CHAKRAPANI) (Dr. M.Kamaraju)


PROJECT GUIDE HEAD OF THE DEPARTMENT

2
ACKNOWLEDGEMENT

We are glad to express our deep sense of gratitude to Mr. Y. SRI


CHAKRAPANI , Associate Professor, Electronics and Communication Engineering for
his guidance and cooperation in completing this project. Through this we want to convey
our sincere thanks to him for inspiring during our main project.

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 also express our gratitude to our principal Dr. P. NAGESWARA


REDDY, for his encouragement and facilities provided during the course of main
project.

We express our heartful gratitude to lab technicians, who helped us in all


aspects of lab work.

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

1.2 Requirements of the Project 1

Chapter 2: CONCEPT OF RAILWAY TRACK SECURITY


SYSTEM 2
2.1 Concept 2
2.2 Block Diagram
2
2.3 Circuit Diagram 3

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

Chapter 4: SOFTWARE DETAILS 28


4.1 KEIL Compiler 28
4.2 Embedded C 28
4.3 Procedure to write code in KEIL Compiler
29
4.4 Proload
31
Chapter 5: RESULTS
33
5.1 Status before Track Failure 33
5.2 Status after Track Failure 34

Chapter 6: FUTURE WORK AND CONCLUSION 35

6.1 Future Work 35


6.2 Conclusion 35

Appendix A: DATASHEET SPECIFICATIONS OF AT89C51


MICROCONTROLLER 36
Appendix B: DATA SHEET OF MAX232 IC 37
Appendix C: VARIOUS TYPES OF LED 39
Appendix D: CODE 41
References 44

LIST OF FIGURES

5
Fig.No. Figure Name Page
No.

2.1 Block diagram of the Railway track security system 3


2.2 Circuit diagram of the railway track security system 4
3.1 Pin diagram 6
3.2 Oscillator connections 9
3.3 GSM Logo 10
3.4 Pin diagram of LCD display 17
3.5 Circuit diagram of voltage regulator 18
3.6 A Full-wave rectifier using two diodes 20
3.7 Capacitor symbol 22
3.8 Capacitor 23
3.9 Capacitor plates separated by a distance d 23
3.10 Resistors 24
3.11 Resistor symbol 24
3.12 Diode symbol 25
3.13 Diode V-I Characteristics 27
5.1 Photograph showing track before failure 33
5.2 Photograph showing track after failure 34

LIST OF TABLES

6
Table No. Table Title Page
No.

3.3.1 Voltage levels of RS232 16


3.4.1 Pin description of LCD display 17
4.1 Data types in Embedded C 29

NOMENCLATURE
GSM Global System For Mobile

RAM Random Access Memory

EDGE Enhanced Data rates for GSM Evolution

SIM Subscriber Identity Module

GPRS General Packet Radio Service

LED Light Emitting Diode

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.

This is to avoid train accidents by using latest communication technologies. In


this 8051 microcontroller is interfaced with GSM communication protocols which are
used to convey the message of crack detection via SMS. 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 microcontroller. The program thereafter sends an SMS
to concerned railway authority through GSM modem interfaced through a level shifter IC
to the microcontroller. An LCD is also interfaced to the micro controller to display the
status of GSM modem and 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.

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.

1.1 Overview of the Project


The project is designed to detect a crack, if any, on the railway track and alert the
respective railway department. This is to avoid rail accidents by using latest
communication technologies. In this project GSM communication protocols are used to
convey the message of crack detection via SMS. This GSM technology is fast and
efficient technology to send message without any delay. By using GSM AT commands
(extended commands) the GSM modem is guided to send the message and these
commands are simple and easy to understand.

1.2 Requirements of the project


AT89C51 Micro Controller
GSM Modem (sim 300)
Max 232
LCD Display
IC 7805 Voltage Regulator
Transformer
Capacitors
Resistors
1N4007 Diode
KEIL Compiler Vision4

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.

2.2 Block Diagram

The block diagram of RAILWAY TRACK SECURITY SYSTEM is shown in

below Fig.2.2. It consists of following blocks.

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.

2.3 Circuit Diagram

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

The circuit shown in fig.2.3 consists of a power supply of 5V DC to drive the


circuit, two jumper sockets and conducting wire to detect the track breakage, a lcd
display to display the track condition, a AT89C51 micro controller, a MAX232 interface
to convert the logic levels, a GSM modem to send the message to station master and a
DB9 connector to connect MAX232 and GSM modem.
As long as track is in good condition i.e., until the track breakage occurs, the
micro controllers receives logic 1 and the display shows that the track is good condition.
When the track failed, the micro controller receives logic 0 and the display shows that the
track is failed and micro controller sends this information to the GSM modem through
MAX232 interface and GSM modem sends message to the station masters mobile.
In this chapter, the concept, overview and the block diagram of the project and the
complete circuit diagram and its description are described. The components used in the
project will be described in the 3rd chapter.

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

Fig 3.1: Pin diagram

3.1.3 Pin Description


VCC is the Supply voltage.

GND it is microcontroller Ground.

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

Flash programming and verification.

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.

Port Pin Alternate Functions


1. P3.0 RXD (serial input port)
2. P3.1 TXD (serial output port)
3. P3.2 INT0 (external interrupt 0)
4. P3.3 INT1 (external interrupt 1)
5. P3.4 T0 (timer 0 external input)
6. P3.5 T1 (timer 1 external input)
7. P3.6 WR (external data memory write strobe)

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.

EA/VPP External Access Enable. EA must be strapped to GND in order to enable


the device to fetch code from external program memory locations starting at
0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be
internally latched on reset. EA should be strapped to VCC for internal program
executions. This pin also receives the 12-volt programming enable voltage (VPP)
during Flash programming, for parts that require 12-volt VPP.

XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
XTAL2
Output from the inverting oscillator amplifier.

3.1.4 Oscillator Characteristics


XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier which can be configured for use as an on-chip oscillator Either a quartz crystal

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.5 Idle Mode


In idle mode, the CPU puts itself to sleep while all the onchip peripherals remain
active. The mode is invoked by software. The content of the on-chip RAM and all the
special functions registers remain unchanged during this mode. The idle mode can be
terminated by any enabled interrupt or by a hardware reset. It should be noted that when
idle is terminated by a hard ware reset, the device normally resumes program execution,
from where it left off, up to two machine cycles before the internal reset algorithm takes
control. On-chip hardware inhibits access to internal RAM in this event, but access to the
port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin
when Idle is terminated by reset, the instruction following the one that invokes Idle
should not be one that writes to a port pin or to external memory. The connections of the
oscillator circuit are shown in the Fig 3.2.

Fig 3.2: Oscillator Connections


Note: C1, C2 = 30 pF To 10 pF for Crystals, 40 pF To 10 pF for Ceramic Resonators

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

3.2 GSM Modem


GSM (Global System for Mobile Communications, originally Groupe Spcial
Mobile), is a standard set developed by the European Telecommunications Standards
Institute (ETSI) to describe protocols for second generation (2G) digital cellular
networks used by mobile phones. The GSM standard was developed as a replacement for
first generation (1G) analog cellular networks, and originally described a digital, circuit
switched network optimized for full duplex voice telephony. This was expanded over
time to include data communications, first by circuit switched transport, then packet data
transport via GPRS (General Packet Radio Services) and EDGE (Enhanced Data rates for
GSM Evolution or EGPRS). Further improvements were made when
the 3GPP developed third generation (3G) UMTS standards followed by fourth
generation (4G) LTE Advanced standards. "GSM" is a trademark owned by the GSM
Association. The logo of GSM is shown in the Fig. 3.3.

Fig.3.3: GSM logo

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.

Base Station subsystem

GSM is a cellular network, which means that cell phones connect to it by


searching for cells in the immediate vicinity. There are five different cell sizes in a GSM
network macro, micro, pico, femto and umbreulla cells. The coverage area of each cell
varies according to the implementation environment. Macro cells can be regarded as cells
where the base station antenna is installed on a mast or a building above average roof top
level. Micro cells are cells whose antenna height is under average roof top level; they are
typically used in urban areas. Pico cells are small cells whose coverage diameter is a few
dozen meters; they are mainly used indoors. Femto cells are cells designed for use in
residential or small business environments and connect to the service providers network
via a broadband internet connection. Umbrella cells are used to cover shadowed regions
of smaller cells and fill in gaps in coverage between those cells.

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.

3.2.2 GSM carrier frequencies

GSM networks operate in a number of different carrier frequency ranges


(separated into GSM frequency ranges for 2G and UMTS frequency bands for 3G), with
most 2G GSM networks operating in the 900 MHz or 1800 MHz bands. Where these
bands were already allocated, the 850 MHz and 1900 MHz bands were used instead (for
example in Canada and the United States). In rare cases the 400 and 450 MHz frequency
bands are assigned in some countries because they were previously used for first-
generation systems. Most 3G networks in Europe operate in the 2100 MHz frequency
band. For more information on worldwide GSM frequency usage, see GSM frequency
bands. Regardless of the frequency selected by an operator, it is divided into timeslots for
individual phones to use. This allows eight full-rate or sixteen half-rate speech channels
per radio frequency. These eight radio timeslots (or eight burst periods) are grouped into
a TDMA frame. Half rate channels use alternate frames in the same timeslot. The
channel data rate for all 8 channels is270.833 Kbit/s, and the frame duration is 4.615 ms.
The transmission power in the handset is limited to a maximum of 2 watts in GSM
850/900 and 1 watt in GSM 1800/1900.

3.2.3 Voice codecs


GSM has used a variety of voice codecs to squeeze 3.1 kHz audio into between
6.5 and 13 Kbit/s. Originally, two codecs, named after the types of data channel they
were allocated, were used, called Half Rate (6.5 Kbit/s) and Full Rate (13 Kbit/s). These
used a system based upon linear predictive coding (LPC). In addition to being efficient
with bitrates, these codecs also made it easier to identify more important parts of the
audio, allowing the air interface layer to prioritize and better protect these parts of the

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.

3.2.4 Subscriber Identity Module (SIM)


One of the key features of GSM is the Subscriber Identity Module, commonly
known as a SIM card. The SIM is a detachable smart card containing the user's
subscription information and phone book. This allows the user to retain his or her
information after switching handsets. Alternatively, the user can also change operators
while retaining the handset simply by changing the SIM. Some operators will block this
by allowing the phone to use only a single SIM, or only a SIM issued by them; this
practice is known as SIM locking.

3.2.5 Phone locking


Sometimes mobile network operators restrict handsets that they sell for use with
their own network. This is called locking and is implemented by a software feature of the
phone. Because the purchase price of the mobile phone to the consumer may be
subsidized with revenue from subscriptions, operators must recoup this investment before
a subscriber terminates service. A subscriber may usually contact the provider to remove
the lock for a fee, utilize private services to remove the lock, or make use of free or fee-
based software and websites to unlock the handset themselves. Unlocking a phone
without an operator's consent is illegal in many countries and may carry severe penalties.

In some countries(e.g., Bangladesh, Brazil, Chile, Hong Kong, India, Lebanon,


Malaysia , Pakistan, Singapore) all phones are sold unlocked. In other countries, it is
unlawful for operators to offer any form of subsidy on a phone's price.

3.2.6 GSM service security


GSM was designed with a moderate level of service security. The system was
designed to authenticate the subscriber using a pre-shared key and challenge-response.
Communications between the subscriber and the base station can be encrypted. The

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.

On 28 December 2009 German computer engineer KarsteNohl announced that he


had cracked the A5/1 cipher. According to Nohl, he developed a number of rainbow
tables (static values which reduce the time needed to carry out an attack) and have found
new sources for known plaintext attacks. He also said that it is possible to build "a full
GSM interceptor ... from open source components" but that they had not done so because
of legal concerns. Nohl claimed that he was able to intercept voice and text conversations
by impersonating another user to listen to their voice mails, make calls or send text
messages using a seven-year-old Motorola cell phone and decryption software available
free off the Internet. New attacks have been observed that take advantage of poor security
implementations, architecture and development for smart phone applications. Some
wiretapping and eavesdropping techniques hijack the audio input and output providing an
opportunity for a 3rd party to listen in to the conversation.

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.

3.3 MAX 232

The MAX232 is an integrated circuit, first created by Maxim Integrated Products,


that converts signals from an RS-232 serial port to signals suitable for use
in TTL compatible digital logic circuits. The MAX232 is a dual driver/receiver and
typically converts the RX, TX, CTS and RTS signals. The drivers provide RS-232
voltage level outputs (approx. 7.5 V) from a single + 5 V supply via on-chip charge
pumps and external capacitors. This makes it useful for implementing RS-232 in devices
that otherwise do not need any voltages outside the 0 V to + 5 V range, as power supply
design does not need to be made more complicated just for driving the RS-232 in this
case.

The receivers reduce RS-232 inputs (which may be as high as 25 V), to


standard 5 V TTL levels. These receivers have a typical threshold of 1.3 V, and a
typical hysteresis of 0.5 V. The later MAX232A is backwards compatible with the
original MAX232 but may operate at higher baud rates and can use smaller external
capacitors 0.1 F in place of the 1.0 F capacitors used with the original device. The
newer MAX3232 is also backwards compatible, but operates at a broader voltage range,
from 3 to 5.5 V.

Voltage Levels:

It is helpful to understand what occurs to the voltage levels. When a MAX232 IC


receives a TTL level to convert, it changes a TTL Logic 0 to between +3 and +15 V, and
changes TTL Logic 1 to between -3 to -15 V, and vice versa for converting from RS232
to TTL. This can be confusing when you realize that the RS232 Data Transmission
voltages at a certain logic state are opposite from the RS232 Control Line voltages at the
same logic state. The voltage levels of RS232 are shown in the Table 3.3.1.

23
Table 3.3.1: Voltage levels of RS232

RS232 Line Type & Logic Level RS232 Voltage TTL Voltage to/from MAX232

Data Transmission (Rx/Tx) Logic 0 +3 V to +15 V 0V

Data Transmission (Rx/Tx) Logic 1 -3 V to -15 V 5V

Control Signals (RTS/CTS/DTR


-3 V to -15 V 5V
/DSR) Logic 0

Control Signals (RTS/CTS/DTR/DSR) Logic 1 +3 V to +15 V 0V

3.4 LCD 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
(unlike in seven segments), animations and so on.
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.

24
3.4.1 Pin Diagram

The pin diagram of 16x2 LCD display is shown in the Fig.3.4

Fig.3.4: Pin diagram of LCD display

3.4.2 Pin Description


The description of the pins of LCD display is shown the Table3.4.1
Table 3.4.1: Pin Description of LCD display
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 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.

3.5.1.1 Circuit Diagram

The circuit diagram of the voltage regulator is shown in the Fig.3.5

Fig.3.5: Circuit diagram of Voltage Regulator

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.

3.5.2.1 Volts Center Tapped


Volts center tapped (VCT) describes the voltage output of a center tapped
transformer. For example: A 24 VCT transformer will measure 24 VAC across the outer
two taps (winding as a whole), and 12 VAC from each outer tap to the center-tap (half

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.

3.5.2.2 Common applications for center tapped

In a rectifier, a center-tapped transformer and two diodes can form a full-wave


rectifier that allows both half-cycles of the AC waveform to contribute to the direct
current, making it smoother than a half-wave rectifier. This form of circuit saves on
rectifier diodes compared to a diode bridge, but has poorer utilization of the
transformer windings.
Center-tapped two-diode rectifiers were a common feature of power supplies
in vacuum-tube equipment. Modern semiconductor diodes are low-cost and compact
so usually a four-diode bridge is used (up to a few hundred watts total output) which
produces the same quality of DC as the center-tapped configuration with a more
compact and cheaper power transformer.
Center-tapped configurations may still be used in high-current applications, such
as large automotive battery chargers, where the extra transformer cost is offset by
less costly rectifiers. Center-tapped transformers are also used for dual-voltage power
supplies. When a center-tapped transformer is combined with a bridge (four diode)
rectifier, it is possible to produce a positive and a negative voltage with respect to a
ground at the tap.
Dual voltage supplies are important for all sorts of electronics equipment. A full
wave rectifier using two diode and a center tapped transformer is shown in the
Fig.3.6

Fig 3.6: A full-wave rectifier using two diodes

In early vacuum tube audio amplifiers, center-tapped transformers were


sometimes used as the phase inverter to drive the two output tubes of a push-pull
stage. The technique is nearly as old as electronic amplification and is well

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

Fig.3.7: Capacitor Symbol

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.

Fig.3.9: Capacitor plates separated by distance d


The capacitor is a reasonably general model for electric fields within electric
circuits. An ideal capacitor is wholly characterized by a constant capacitance C, defined
as the ratio of charge Q on each conductor to the voltage V between them

Sometimes charge build-up affects the capacitor mechanically, causing its


capacitance to vary. In this case, capacitance is defined in terms of incremental changes

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.

Fig.3.10 Resistors Fig.3.11 Resistor Symbol

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.

Fig.3.12: Diode symbol


The most common function of a diode is to allow an electric current to pass in
one direction (called the diode's forward direction) while blocking current in the opposite
direction (the reverse direction). Thus, the diode can be thought of as an electronic
version of a check valve. This unidirectional behaviour is called rectification, and is used

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.

Forward Voltage Drop


Electricity uses up a little energy pushing its way through the diode, rather like a
person pushing through a door with a spring. This means that there is a small voltage
across a conducting diode, it is called the forward voltage drop and is about 0.7V for all
normal diodes which are made from silicon. The forward voltage drop of a diode is
almost constant whatever the current passing through the diode so they have a very steep
characteristic as current-voltage graph.
Reverse Voltage
When a reverse voltage is applied a perfect diode does not conduct, but all real
diodes leak a very tiny current of a few A or less. This can be ignored in most circuits
because it will be very much smaller than the current flowing in the forward direction.
However, all diodes have a maximum reverse voltage PIV (usually 50V or more) and if
this is exceeded the diode will fail and pass a large current in the reverse direction, this is
called breakdown. The characteristics are shown in Fig 3.13.

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

Data types Size in Bits Data Range


unsigned char 8-bit 0-255
signed char 8-bit -128 to +127
unsigned int 16-bit 0 to 65535
signed int 16-bit -32,768 to +32,767
Sbit 1-bit SFR bit addressable only
Bit 1-bit RAM bit addressable only

4.3 Procedure to write code in KEIL Compiler


The following steps required to write an assembly language program in keil and to
compile it.
Install the Keil Software in the PC in any of the drives.
After installation, an icon will be created with the name Keil uVision3. Just
drag this icon onto the desktop so that it becomes easy whenever you try to write
programs in Keil.
Double click on this icon to start the Keil compiler.
A page opens with different options in it showing the project workspace at the
leftmost corner side, output window in the bottom and an ash colored space for
the program to be written.
Now to start using the Keil, click on the option project.
A small window opens showing the options like new project, import project, open
project etc. Click on New project.
A small window with the title bar Create new project opens. The window asks
the user to give the project name with which it should be created and the
destination location. The project can be created in any of the drives available. You
can create a new folder and then a new file or can create directly a new file.
After the file is saved in the given destination location, a window opens where a
list of vendors will be displayed and you have to select the device for the target
you have created.

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.

Install the Proload Software in the PC.


Now connect the Programmer kit to the PC (CPU) through serial cable.

Power up the programmer kit from the ac supply through adapter.

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

5.1 Status before Track Failure

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.

Fig.5.1: Photograph showing track before failure

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.

Fig.5.2: Photograph showing track after failure

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.1 Future Work


In future exact location where the track had failed can be determined by using
GPS.
Automation of this project i.e. rectifying the track failure without human
interface can be done.

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]

Gallium arsenide (GaAs)


Infrared > 760 V < 1.63
Aluminium gallium arsenide (AlGaAs)

Aluminium gallium arsenide (AlGaAs)


1.63 < V < Gallium arsenide phosphide (GaAsP)
Red 610 < < 760
2.03 Aluminium gallium indium phosphide (AlGaInP)
Gallium(III) phosphide (GaP)

Gallium arsenide phosphide (GaAsP)


2.03 < V <
Orange 550 < < 610 Aluminium gallium indium phosphide (AlGaInP)
2.10
Gallium(III) phosphide (GaP)

Gallium arsenide phosphide (GaAsP)


2.10 < V <
Yellow 570 < < 550 Aluminium gallium indium phosphide (AlGaInP)
2.18
Gallium(III) phosphide (GaP)

Indium gallium nitride (InGaN) / Gallium(III)


nitride (GaN)
Green 500 < < 570 1.5 < V < 4.0 Gallium(III) phosphide (GaP)
Aluminium gallium indium phosphide (AlGaInP)
Aluminium gallium phosphide (AlGaP)

Zinc selenide (ZnSe)


Indium gallium nitride (InGaN)
Blue 450 < < 500 2.48 < V < 3.7
Silicon carbide (SiC) as substrate
Silicon (Si) as substrate under development

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

Diamond (235 nm)


Boron nitride (215 nm)
Aluminium nitride (AlN) (210 nm)
Ultraviolet < 400 3.1 < V < 4.4
Aluminium gallium nitride (AlGaN)
Aluminium gallium indium nitride (AlGaInN)
[61]
down to 210 nm

Blue with one or two phosphor layers:


Pink multiple types V ~ 3.3 yellow with red, orange or pink phosphor added afterwards,
or white with pink pigment or dye.

White Broad spectrum V = 3.5 Blue/UV diode with yellow phosphor

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

You might also like