edited doc

114
CHAPTER I INTRODUCTION 1.1 INTRODUCTION Anti theft control system for automobiles is a project which tries to prevent the theft of a vehicle. This system makes use of an embedded chip that has an inductive proximity sensor, which senses the key during insertion and sends a text message to the owner’s mobile stating that the car is being accessed. When key is inserted the light between the photo diode and IR TX is cut, the proximity sensor senses the key and sends message to the owner using GSM, then the unknown gets trapped in the vehicle, the door locks are activated using motor connection, if the owner himself is travelling then he can turn off the vibration sensor which is known only to the owner. If the thief starts the car he can be trapped using GPS. 1.1.1 AIM OF THE PROJECT REPORT The main purpose of this project is protecting vehicle from theft. Now a day’s vehicle thefts are increasing rapidly. People have started to use the theft control systems installed in their vehicles. The commercially available anti-theft vehicular systems are very expensive. And this project is developed as low cost SVCET Page 1

Upload: hari-chandana

Post on 11-Jan-2017

34 views

Category:

Documents


2 download

TRANSCRIPT

CHAPTER I

INTRODUCTION

1.1 INTRODUCTION

Anti theft control system for automobiles is a project which tries to prevent the

theft of a vehicle. This system makes use of an embedded chip that has an inductive

proximity sensor, which senses the key during insertion and sends a text message to

the owner’s mobile stating that the car is being accessed. When key is inserted the

light between the photo diode and IR TX is cut, the proximity sensor senses the key

and sends message to the owner using GSM, then the unknown gets trapped in the

vehicle, the door locks are activated using motor connection, if the owner himself is

travelling then he can turn off the vibration sensor which is known only to the owner.

If the thief starts the car he can be trapped using GPS.

1.1.1 AIM OF THE PROJECT REPORT The main purpose of this project is protecting vehicle from theft. Now a day’s

vehicle thefts are increasing rapidly. People have started to use the theft control

systems installed in their vehicles. The commercially available anti-theft vehicular

systems are very expensive. And this project is developed as low cost vehicle theft

control scheme using a microcontroller and with usage of GSM and GPS technology.

In this project we present an anti theft control system for automobiles that tries to

prevent the theft of a vehicle using GSM and GPS.

1.2 INTRODUCTION TO EMBEDDED SYSTEMSAn Embedded System is a combination of computer hardware and software, and

perhaps additional mechanical or other parts, designed to perform a specific function.

An embedded system is a microcontroller-based, software driven, reliable, real-time

control system, autonomous, or human or network interactive, operating on diverse

physical variables and in diverse environments and sold into a competitive and cost

conscious market.

An embedded system is not a computer system that is used primarily for

processing, not a software system on PC or UNIX, not a traditional business or

SVCET Page 1

scientific application. High-end embedded & lower end embedded systems. High-end

embedded system - Generally 32, 64 Bit Controllers used with OS. Examples

Personal Digital Assistant and Mobile phones etc .Lower end embedded systems -

Generally 8,16 Bit Controllers used with an minimal operating systems and hardware

layout designed for the specific purpose.

1.2.1 SYSTEM DESIGN CALLS:

Fig 1.1: Embedded system design calls

1.2.2 EMBEDDED SYSTEM DESIGN CYCLE

Fig 1.2: “V Diagram of Embedded system”

SVCET Page 2

System

Testing

System

Definition

Targeting

Rapid Prototy

ping

Hardware-in-

the-Loop Testin

g

1.2.3 CHARACTERISTICS OF EMBEDDED SYSTEM

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

a. Throughput – Our system may need to handle a lot of data in a short period of

time.

b. Response–Our system may need to react to events quickly

c. Testability–Setting up equipment to test embedded software can be difficult

d. Debugability–Without a screen or a keyboard, finding out what the software is

doing wrong (other than not working) is a troublesome problem

e. Reliability – embedded systems must be able to handle any situation without

human intervention

f. Memory space – Memory is limited on embedded systems, and you must

make the software and the data fit into whatever memory exists

g. Program installation – you will need special tools to get your software into

embedded systems

h. Power consumption – Portable systems must run on battery power, and the

software in these systems must conserve power

i. Processor hogs – computing that requires large amounts of CPU time can

complicate the response problem

j. 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.

1.2.4 APPLICATIONS1. 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.

SVCET Page 3

1.2.5 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.

RTS classification

Hard Real Time Systems

Soft Real Time System

1. HARD REAL TIME SYSTEM

"Hard" real-time systems have very narrow response time.

Example: Nuclear power system, Cardiac pacemaker.

2. 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.

1.2.6 OVERVIEW OF EMBEDDED SYSTEM ARCHITECTUREEvery 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 operating system runs above the hardware, and the application software

runs above the operating system. The same architecture is applicable to any computer

SVCET Page 4

Fig 1.3: Various blocks of hardware

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.

Central Processing Unit

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. DSP 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 Memory (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.

SVCET Page 5

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.

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 provided with one or a few communication interfaces such as RS232, RS422,

RS485, Universal Serial Bus (USB), 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.

1.2.7 APPLICATION AREASNearly 99 per cent of the processors manufactured end up in embedded

systems. The embedded system market is one of the highest growth areas as these

systems are used in very market segment- consumer electronics, office automation,

industrial automation, biomedical engineering, wireless communication, data

communication, telecommunications, transportation, military and so on.

Consumer appliances

At home we use a number of embedded systems which include digital camera,

digital diary, DVD player, electronic toys, microwave oven, remote controls for TV

and air-conditioner, VCO player, video game consoles, video recorders etc. Today’s

high-tech car has about 20 embedded systems for transmission control, engine spark

control, air-conditioning, navigation etc. Even wristwatches are now becoming

embedded systems.

Office automation

The office automation products using em embedded systems are copying

machine, fax machine, key telephone, modem, printer, scanner etc.

SVCET Page 6

Industrial automation

Today a lot of industries use embedded systems for process control. These

include pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity

generation and transmission. The embedded systems for industrial use are designed to

carry out specific tasks such as monitoring the temperature, pressure, humidity,

voltage, current etc., and then take appropriate action based on the monitored levels to

control other devices or to send information to a centralized monitoring station. In

hazardous industrial environment, where human presence has to be avoided, robots

are used, which are programmed to do specific jobs. The robots are now becoming

very powerful and carry out many interesting and complicated tasks such as hardware

assembly.

Medical electronics

Almost every medical equipment in the hospital is an embedded system. These

equipments include diagnostic aids such as ECG, EEG, blood pressure measuring

devices, X-ray scanners; equipment used in blood analysis, radiation, colonoscopy,

endoscopy etc. Developments in medical electronics have paved way for more

accurate diagnosis of diseases.

Computer networking

Computer networking products such as bridges, routers, Integrated Services

Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame

relay switches are embedded systems which implement the necessary data

communication protocols. For example, a router interconnects two networks. The two

networks may be running different protocol stacks. The router’s function is to obtain

the data packets from incoming pores, analyze the packets and send them towards the

destination after doing necessary protocol conversion. Most networking equipments,

other than the end systems (desktop computers) we use to access the networks, are

embedded systems

Telecommunications

In the field of telecommunications, the embedded systems can be categorized

as subscriber terminals and network equipment. The subscriber terminals such as key

telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The

network equipment includes multiplexers, multiple access systems, Packet

Assemblers Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP

SVCET Page 7

gatekeeper etc. are the latest embedded systems that provide very low-cost voice

communication over the Internet.

Wireless technologies

Advances in mobile communications are paving way for many interesting

applications using embedded systems. The mobile phone is one of the marvels of the

last decade of the 20’h century. It is a very powerful embedded system that provides

voice communication while we are on the move. The Personal Digital Assistants and

the palmtops can now be used to access multimedia services over the Internet. Mobile

communication infrastructure such as base station controllers, mobile switching

centres are also powerful embedded systems.

Insemination

Testing and measurement are the fundamental requirements in all scientific

and engineering activities. The measuring equipment we use in laboratories to

measure parameters such as weight, temperature, pressure, humidity, voltage, current

etc. are all embedded systems. Test equipment such as oscilloscope, spectrum

analyzer, logic analyzer, protocol analyzer, radio communication test set etc. are

embedded systems built around powerful processors. Thank to miniaturization, the

test and measuring equipment are now becoming portable facilitating easy testing and

measurement in the field by field-personnel.

Security

Security of persons and information has always been a major issue. We need

to protect our homes and offices; and also the information we transmit and store.

Developing embedded systems for security applications is one of the most lucrative

businesses nowadays. Security devices at homes, offices, airports etc. for

authentication and verification are embedded systems. Encryption devices are nearly

99 per cent of the processors that are manufactured end up in embedded systems.

Finance

Financial dealing through cash and cheques are now slowly paving way for

transactions using smart cards and ATM machines. Smart card, of the size of a credit

card, has a small micro-controller and memory; and it interacts with the smart card

reader! ATM machine and acts as an electronic wallet. Smart card technology has the

capability of ushering in a cashless society. Well, the list goes on. It is no

exaggeration to say that eyes wherever you go, you can see, or at least feel, the work

of an embedded system. Embedded systems find applications in every industrial

SVCET Page 8

segment- consumer electronics, transportation, avionics, biomedical engineering,

manufacturing, process control and industrial automation, data communication,

telecommunication, defence, security etc.

SVCET Page 9

CHAPTER II

MICROCONTROLLERS

A microcontroller is a small computer on a single integrated circuit containing

a processor core, memory, and programmable input/output peripherals. Program

memory in the form of NOR flash or OTP ROM is also often included on chip, as

well as a typically small amount of RAM. Microcontrollers are designed for

embedded applications, in contrast to the microprocessors used in personal computers

or other general purpose applications.

Fig 2.1: Block diagram of microcontroller

SVCET Page 10

2.1 AT89C51

The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer

with 8kbytes of Flash programmable and erasable read only memory (PEROM). The

device is manufactured using Atmel’s high-density non-volatile memory technology

and is compatible with the industry-standard 80C51 and 80C52 instruction set and Pin

out. The on-chip Flash allows the program memory to be reprogrammed in-system or

by a conventional non-volatile memory programmer by combining a versatile 8-bit

CPU with Flash on a monolithic chip. The Atmel AT89C52 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to many

embedded control applications. The AT89C52 is a low-power, high-performance

CMOS 8-bit microcomputer with 8k bytes of Flash programmable and erasable read

only memory (PEROM).

2.1.1 FEATURES

• Compatible with MCS-51 Products

• 8K Bytes of In-System Reprogrammable Flash Memory

• Endurance: 1,000 Write/Erase Cycles

• Fully Static Operation: 0 Hz to 24 MHz

• Three-level Program Memory Lock

• 256 x 8-bit Internal RAM

• 32 Programmable I/O Lines

• Three 16-bit Timer/Counters

• Eight Interrupt Sources

• Programmable Serial Channel

• Low-power Idle and Power-down Modes

• Five vector two-level interrupt architecture

• A full duplex serial port, Six Interrupt Sources

• On-chip oscillator and clock circuitry

SVCET Page 11

2.1.2 ARCHITECTURE

Fig 2.2: Architecture of microcontroller

SVCET Page 12

2.1.3 PIN DIAGRAM

Fig 2.3: PIN Diagram of microcontroller

2.1.4 PIN DESCRIPTIONPINS 1-8 PORT 1:

Each of these pins can be configured as input or output.

PIN 9 – RST

Logical one on this pin stops microcontroller’s operating and erases the

contents of most registers. By applying logical zero to this pin, the program starts

execution from the beginning. In other words, a positive voltage pulse on this pin

resets the microcontroller.

PINS 10-17 PORT 3:

Similar to port 1, each of these pins can serve as universal input or output.

Besides, all of them have alternative functions:

SVCET Page 13

PINS 10: RECEIVER

Serial asynchronous communication input or Serial synchronous

communication output.

Pin 11: Transmitter

Serial asynchronous communication output or Serial synchronous

communication clock output.

Pin 14:INT0

Interrupt 0 inputs

Pin 13:INT1

Interrupt 1 input

Pin 14:T0

Counter 0 clock input

Pin 15:T1

Counter 1 clock input

Pin 16: WR

Signal for writing to external (additional) RAM

Pin 17: RD

Signal for reading from external RAM

Pin 18, 19: X0, X1

Internal oscillator input and output. A quartz crystal which determines

operating frequency is usually connected to these pins. Instead of quartz crystal, the

miniature ceramics resonators can be also used for frequency stabilization. Later

versions of the microcontrollers operate at a frequency of 0 Hz up to over 50 Hz.

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating

circuit.

XTAL2

Output from the inverting oscillator amplifier.

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, as shown in Figure

1. Either a quartz crystal or ceramic resonator may be used.

To drive the device from an external clock source, XTAL2 should be left

unconnected while XTAL1 is driven as shown in Figure 2. There are no requirements

SVCET Page 14

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.

Fig 2.4: Oscillator connection 1

Fig 2.5: Oscillator connection 2

Pin 20: Ground

Signal Ground

SVCET Page 15

PINS 21-28 PORT 2:

If there is no intention to use external memory then these port pins are

configured as universal inputs/outputs. In case external memory is used then the

higher address byte, i.e. addresses A8-A15 will appear on this port. It is important to

know that even memory with capacity of 64Kb is not used ( i.e. note all bits on port

are used for memory addressing) the rest of bits are not available as inputs or outputs.

Pin 29: 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. If external ROM is used for storing program then it

has a logic-0 value every time the microcontroller reads a byte from memory.

Pin 30: ALE

Prior to each reading from external memory, the microcontroller will set the

lower address byte (A0-A7) on P0 and immediately after that activates the output

ALE. Upon receiving signal from the ALE pin, the external register (74HCT373 or

74HCT375 circuit is usually embedded) memorizes the state of P0 and uses it as an

address for memory chip. In the second part of the microcontroller’s machine cycle, a

signal on this pin stops being emitted and P0 is used now for data transmission (Data

Bus). In this way, by means of only one additional (and cheap) integrated circuit, data

multiplexing from the port is performed. This port at the same time used for data and

address transmission.

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.

SVCET Page 16

PIN 31: EA/VPP:

External Access Enable 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.

By applying logic zero to this pin, P2 and P3 are used for data and address

transmission with no regard to whether there is internal memory or not. That means

that even there is a program written to the microcontroller, it will not be executed, the

program written to external ROM will be used instead. Otherwise, by applying logic

one to the EA pin, the microcontroller will use both memories, first internal and

afterwards external (if it exists), up to end of address space.

PINS 32-39 PORT 0:

Similar to port 2, if external memory is not used, these pins can be used as

universal inputs or outputs. Otherwise, P0 is configured as address output (A0-A7)

when the ALE pin is at high level (1) and as data output (Data Bus), when logic zero

(0) is applied to the ALE pin.

Pin 40: VCC

Power supply (5V) to the microcontroller.

2.2 REGISTER BANKSThe 89c51 uses 8 "R" registers which are used in many of its instructions.

These "R" registers are numbered from 0 through 7 (R0, R1, R2, R3, R4, R5, R6, and

R7). These registers are generally used to assist in manipulating values and moving

data from one memory location to another the Accumulator. Thus if the Accumulator

(A) contained the value 6 and R4 contained the value 3, the Accumulator would

contain the value 9 after this instruction was executed. However, as the memory map

shows, the "R" Register R4 is really part of Internal RAM. Specifically, R4 is address

04h. This can be see in the bright green section of the memory map. But, the 89c51

has four distinct register banks. When the 89c51 is first booted up, register bank 0

(addresses 00h through 07h) is used by default. However, your program may instruct

the 89c51 to use one of the alternate register banks; i.e., register banks 1, 2, or 3. In

this case, R4 will no longer be the same as Internal RAM address 04h. For example, if

SVCET Page 17

your program instructs the 89c51 to use register bank 3, "R" register R4 will now be

synonymous with Internal RAM address 1Ch.

The concept of register banks adds a great level of flexibility to the 89c51,

especially when dealing with interrupts (we'll talk about interrupts later). However,

always remember that the register banks really reside in the first 32 bytes of Internal

RAM.

2.2.1 BASIC REGISTERSThe Accumulator:

The Accumulator, as its name suggests, is used as a general register to

accumulate the results of a large number of instructions. It can hold an 8-bit (1-byte)

value and is the most versatile register the 89c51 has due to the sheer number of

instructions that make use of the accumulator. More than half of the 89c51’s 255

instructions manipulate or use the accumulator in some way.

The "R" registers:

The "R" registers are a set of eight registers that are named R0, R1, etc. up to

and including R7.These registers are used as auxillary registers in many operations.

To continue with the above example, perhaps you are adding 10 and 20. The original

number 10 may be stored in the Accumulator whereas the value 20 may be stored in,

say, register R4. To process the addition you would execute the command

The "B" Register:

The "B" register is very similar to the Accumulator in the sense that it may

hold an 8-bit (1-byte) value. The "B" register is only used by two 89c51 instructions:

MUL AB and DIV AB. Thus, if you want to quickly and easily multiply or divide A

by another number, you may store the other number in "B" and make use of these two

instructions. Aside from the MUL and DIV instructions, the "B" register is often used

as yet another temporary storage register much like a ninth "R" register.

2.2.2 SPECIAL FUNTION REGISTERS A map of the on-chip memory area called the Special Function Register (SFR)

space is shown in Table 1.

Note that not all of the addresses are occupied, and unoccupied addresses may

not be implemented on the chip.

Read accesses to these addresses will in general return random data, and write

accesses will have an indeterminate effect.

SVCET Page 18

User software should not write 1s to these unlisted locations, since they may

be used in future products to invoke new feature.

. Table 2.1: Special function registers

2.3 TIMERS

The 8052 has two timers: Timer 0, Timer 1and Timer 2. They can be used

either as timers to generate a time delay or as counters to count events happening

outside the microcontroller.

SVCET Page 19

Three timers are 16-bit wide. Since the 8052 has an 8-bit architecture, each

16-bit timer is accessed as two separate registers of low byte and high byte. The

timers 1 and 2 functions are same as in 8051.

Lower byte register of Timer 0 is TL0 and higher byte is TH0. Similarly lower

byte register of Timer1 is TL1 and higher byte register is TH1.

2.3.1 TIMER MODE REGISTERSBoth timers 0 and 1 use the same register TMOD to set the various operation modes.

TMOD is an 8-bit register in which the lower 4 bits are set aside for Timer 0

and the upper 4 bits for Timer 1. In each case, the lower 2 bits are used to set the timer

mode and the upper 2 bits to specify the operation.

(MSB) Table 2.2: TMOD (LSB)

GATE

Every timer has a means of starting and stopping. Some timers do this by

software, some by hardware and some have both software and hardware controls. The

timers in the 8051 have both. The start and stop of the timer are controlled by the way

of software by the TR (timer start) bits TR0 and TR1. These instructions start and stop

the timers as long as GATE=0 in the TMOD register. The hardware way of starting

and stopping the timer by an external source is achieved by making GATE=1 in the

TMOD register.

C/T:

Timer or counter selected. Cleared for timer operation and set for counter operation.

M1 :Mode bit 1

M0 :Mode bit 0

SVCET Page 20

GATE C/T M1 M0 GATE C/T M1 M0

Table 2.3: Timer Modes

M1 M0 Mode Operating Mode

0 0 0 13-bit timer mode

8-bit timer/counter THx with TLx as 5-bit prescaler

0 1 1 16-bit timer mode

16-bit timer/counters THx and TLx are cascaded

1 0 2 8-bit auto reload timer/counter

THx holds a value that is to be reloaded into TLx each

time

it overflows

1 1 3 Split timer mode

Timer 2

Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event

counter. The type of operation is selected by bit C/T2 in the SFR T2CON (shown in

Table 2). Timer 2 has three operating modes: capture, auto-reload (up or down

counting), and baud rate generator. The modes are selected by bits in T2CON, as

shown in Table 3. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer

function, the TL2 register is incremented every machine cycle. Since a machine cycle

consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency

. Table 2.4: Timer 2

SVCET Page 21

In the Counter function, the register is incremented in response to a 1-to-0

transition at its corresponding external input pin, T2. In this function, the external

input is sampled during S5P2 of every machine cycle. When the samples show a high

in one cycle and a low in the next cycle, the count is incremented. The new count

value appears in the register during S3P1 of the cycle following the one in which the

transition was detected. Since two machine cycles (24 oscillator periods) are required

to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator

frequency. To ensure that a given level is sampled at least once before it changes, the

level should be held for at least one full machine cycle.

Timer 2 Registers Control and status bits are contained in registers T2CON

(shown in Table 2) and T2MOD (shown in Table 4) for Timer 2. The register pair

(RCAP2H, RCAP2L) are the Capture/Reload registers for Timer 2 in 16-bit capture

mode or 16-bit auto-reload mode.

Table 2.5: timer 2

TF2:

Timer 2 overflow flag set by a Timer 2 overflow and must be cleared by

software. TF2 will not be set when either RCLK = 1 or TCLK = 1.

EXF2:

Timer 2 external flag set when either a capture or reload is caused by a

negative transition on T2EX and EXEN2 = 1. When Timer 2 interrupt is enabled,

EXF2 = 1 will cause the CPU to vector to the Timer 2 interrupt routine. EXF2 must

be cleared by software. EXF2 does not cause an interrupt in up/down counter mode

(DCEN = 1).

RCLK:

Receive clock enable. When set, causes the serial port to use Timer 2 overflow

pulses for its receive clock in serial port Modes 1 and 3. RCLK = 0 causes Timer 1

overflow to be used for the receive clock.

SVCET Page 22

TCLK:

Transmit clock enable. When set, causes the serial port to use Timer 2

overflow pulses for its transmit clock in serial port Modes 1 and 3. TCLK = 0 causes

Timer 1 overflows to be used for the transmit clock.

EXEN2:

Timer 2 external enables. When set, allows a capture or reload to occur as a

result of a negative transition on T2EX if Timer 2 is not being used to clock the serial

port. EXEN2 = 0 causes Timer 2 to ignore events at T2EX.

TR2:

Start/Stop control for Timer 2. TR2 = 1 starts the timer.

C/T2:

Timer or counter select for Timer 2. C/T2 = 0 for timer function. C/T2 = 1 for

external event counter (falling edge triggered).

CP/RL2:

Capture/Reload select. CP/RL2 = 1 causes captures to occur on negative

transitions at T2EX if EXEN2 = 1. CP/RL2= 0 causes automatic reloads to occur

when Timer 2 overflows or negative transitions occur at T2EX when EXEN2= 1.

When either RCLK or TCLK = 1, this bit is ignored and the timer is forced to auto-

reload on Timer 2 overflow.

Interrupt Registers The individual interrupt enable bits are in the IE register.

Two priorities can be set for each of the six interrupt sources in the IP register.

THE DATA POINTER (DPTR):

The Data Pointer (DPTR) is the 89c51’s only user-accessable 16-bit (2-byte)

register. The Accumulator, "R" registers, and "B" register are all 1-byte values.DPTR,

as the name suggests, is used to point to data. It is used by a number of commands

which allow the 89c51 to access external memory

The Program Counter (PC):

The Program Counter (PC) is a 2-byte address which tells the 89c51 where the

next instruction to execute is found in memory. When the 89c51 is initialized PC

always starts at 0000h and is incremented each time an instruction is executed. It is

important to note that PC isn’t always incremented by one. Since some instructions

require 2 or 3 bytes the PC will be incremented by 2 or 3 in these cases

SVCET Page 23

The Stack Pointer (SP):

The Stack Pointer, like all registers except DPTR and PC, may hold an 8-bit

(1-byte) value. The Stack Pointer is used to indicate where the next value to be

removed from the stack should be taken from. When you push a value onto the stack,

the 89c51 first increments the value of SP and then stores the value at the resulting

memory location. When you pop a value off the stack, the 89c51 returns the value

from the memory location indicated by SP, and then decrements the value of SP.

SVCET Page 24

CHAPTER III

BLOCK DIAGRAM

3.1 INTRODUCTION

The block diagram consists of microcontroller, LCD, GPS modem, GSM

modem, relay section, DC motor, proximity sensor,IR transmitter, photo diode. When

key is inserted the light between the photo diode and IR TX is cut, the proximity

sensor senses the key and sends message to the owner using GSM, then the unknown

gets trapped in the vehicle, the door locks are activated using motor connection, if the

owner himself is travelling then he can turn off the vibration sensor which is known

only to the owner. If the thief starts the car he can be trapped using GPS.

Fig 3.1: Block diagram of anti theft tracking system

MICRO CONTROLLER

In this project work system the micro-controller is plays major role. Micro-

controllers were originally used as components in complicated process-control

systems. However, because of their small size and low price, Micro-controllers are

now also being used in regulators for individual control loops. In several areas Micro-

controllers are now outperforming their analog counterparts and are cheaper as well.

SVCET Page 25

LCD: LCD is used to display the information about the current process.

Keypad Section: This section consists of a Linear Keypad. This keypad is used for

select the junctions etc. The keypad is interfaced to microcontroller which

continuously scans the keypad.

Buzzer Section: This section consists of a Buzzer. The buzzer is used to alert /

indicate the completion of process. It is sometimes used to indicate the start of the

embedded system by alerting during start-up.

GPS MODEM:

A GPS modem is used to get the signals and receive the signals from the

satellites. In this project, GPS modem get the signals from the satellites and those are

given to the microcontroller. The signals may be in the form of the coordinates; these

are represented in form of the latitudes, longitudes and altitudes.

GSM modem Section:

This section consists of a GSM modem. The modem will communicate with

microcontroller using serial communication. The modem is interfaced to

microcontroller using MAX 232, a serial driver.

Relay Section:

This section consists of an interfacing circuitry to switch ON / OFF the

system whenever any unhealthy conditions i.e. overload is detected. This circuitry

basically consists of a Relay, transistor and a protection diode. A relay is used to drive

the 230V devices.

DC Motor:

DC motor is an output for this project. And DC motor is connected to

microcontroller. And this motor controlled by the microcontroller with the respective

inputs given by us. Its speed will be varied according to the speed set by the switches.

Proximity sensor:

Proximity sensor block is used to find proximity located in the path of the

robot. It will search for landmine and if it finds, it gives logic high to microcontroller.

Photo diode IR:

SVCET Page 26

The IR LED is used as the IR transmitter, which is connected by using the

resistor logic as shown in the schematic. The IR receiver is connected by using the

transistor logic whose collector is connected to the base of the transistor. The base of

the transistor is connected to the photo diode through the resistor.

3.2 LCD-LIQUID CRYSTAL DISPLAYLiquid Crystal Display also called as LCD is very helpful in providing user

interface as well as for debugging purpose. The most commonly used Character based

LCDs are based on Hitachi's HD44780 controller or other which are compatible with

HD44580. The most commonly used LCDs found in the market today are 1 Line, 2

Line or 4 Line LCDs which have only 1 controller and support at most of 80

characters, whereas LCDs supporting more than 80 characters make use of 2

HD44780 controllers.

3.2.1 PIN DESCRIPTION

Fig 3.2: Pin description

Table 3.1: Pin description

Pin No. Name Description

1 VSS Power supply (GND)

2 VCC Power supply (+5V)

3 VEE Contrast adjust

4 RS0 = Instruction input

1 = Data input

5 R/W0 = Write to LCD module

1 = Read from LCD module

SVCET Page 27

6 EN Enable signal

7 D0 Data bus line 0 (LSB)

8 D1 Data bus line 1

9 D2 Data bus line 2

10 D3 Data bus line 3

11 D4 Data bus line 4

12 D5 Data bus line 5

13 D6 Data bus line 6

14 D7 Data bus line 7 (MSB)

15 LED+ Back Light VCC

16 LED- Back Light GND

DDRAM - Display Data RAM

Display data RAM (DDRAM) stores display data represented in 8-bit

character codes. Its extended capacity is 80 X 8 bits, or 80 characters. The area in

display data RAM (DDRAM) that is not used for display can be used as general data

RAM. So whatever you send on the DDRAM is actually displayed on the LCD. For

LCDs like 1x16, only 16 characters are visible, so whatever you write after 16 chars is

written in DDRAM but is not visible to the user.

CGROM - Character Generator ROM

Now you might be thinking that when you send an ASCII value to DDRAM,

how the character is displayed on LCD? So the answer is CGROM. The character

generator ROM generates 5 x 8 dot or 5 x 10 dot character patterns from 8-bit

character codes. It can generate 208 5 x 8 dot character patterns and 32 5 x 10 dot

character patterns.

CGRAM - Character Generator RAM

As clear from the name, CGRAM area is used to create custom characters in

LCD. In the character generator RAM, the user can rewrite character patterns by

program. For 5 x 8 dots, eight character patterns can be written, and for 5 x 10 dots,

four character patterns can be written.

BF - Busy Flag

Busy Flag is a status indicator flag for LCD. When we send a command or

data to the LCD for processing, this flag is set (i.e. BF =1) and as soon as the

SVCET Page 28

instruction is executed successfully this flag is cleared (BF = 0). This is helpful in

producing and exact amount of delay for the LCD processing.

To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and The

MSB of the LCD data bus (D7) act as busy flag. When BF = 1 means LCD is busy

and will not accept next command or data and BF = 0 means LCD is ready for the

next command or data to process.

Instruction Register (IR) and Data Register (DR)

There are two 8-bit registers in HD44780 controller Instruction and Data

register. Instruction register corresponds to the register where you send commands to

LCD e.g. LCD shift command, LCD clear, LCD address etc. and Data register is used

for storing data which is to be displayed on LCD.

When send the enable signal of the LCD is asserted, the data on the pins is

latched in to the data register and data is then moved automatically to the DDRAM

and hence is displayed on the LCD. Data Register is not only used for sending data to

DDRAM but also for CGRAM, the address where you want to send the data, is

decided by the instruction you send to LCD.

3.2.2 COMMANDS AND INSTRUCTION SETOnly the instruction register (IR) and the data register (DR) of the LCD can be

controlled by the MCU. Before starting the internal operation of the LCD, control

information is temporarily stored into these registers to allow interfacing with various

MCUs, which operate at different speeds, or various peripheral control devices.

There are categories of instructions that:

Designate LCD functions, such as display format, data length, etc.

Set internal RAM addresses

Although looking at the table you can make your own commands and test

them. Below is a brief list of useful commands which are used frequently while

working on the LCD.

SVCET Page 29

Table 3.2: LCD Commands

Table 3.3: Commands list

No. Instruction Hex Decimal

1 Function Set: 8-bit, 1 Line, 5x7 Dots 0x30 48

2 Function Set: 8-bit, 2 Line, 5x7 Dots 0x38 56

3 Function Set: 4-bit, 1 Line, 5x7 Dots 0x20 32

4 Function Set: 4-bit, 2 Line, 5x7 Dots 0x28 40

5 Entry Mode 0x06 6

6 Display off Cursor off 0x08 8

SVCET Page 30

(clearing display without clearing DDRAM content)

7 Display on Cursor on 0x0E 14

8 Display on Cursor off 0x0C 12

9 Display on Cursor blinking 0x0F 15

10 Shift entire display left 0x18 24

12 Shift entire display right 0x1C 30

13 Move cursor left by one character 0x10 16

14 Move cursor right by one character 0x14 20

15 Clear Display (also clear DDRAM content) 0x01 1

16 Set DDRAM address or cursor position on display 0x80+add 128+add

17Set CGRAM address or set pointer to CGRAM

location0x40+add 64+add

Sending Commands to LCD

To send commands we simply need to select the command register. Everything is

same as we have done in the initialization routine. But we will summarize the

common steps and put them in a single subroutine. Following are the steps:

move data to LCD port

select command register

select write operation

send enable signal

wait for LCD to process the command

Sending Data to LCD

To send data we simply need to select the data register. Everything is same as the

command routine. Following are the steps:

move data to LCD port

select data register

select write operation

3.3 POWER SUPPLYThe input to the circuit is applied from the regulated power supply. The a.c. input i.e.,

230V from the mains supply is step down by the transformer to 12V and is fed to a

SVCET Page 31

rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order

to get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to

remove any a.c components present even after rectification. Now, this voltage is given

to a voltage regulator to obtain a pure constant dc voltage.

Fig 3.3: Power supply

Transformer:Usually, DC voltages are required to operate various electronic equipment and

these voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly.

Thus the a.c input available at the mains supply i.e., 230V is to be brought down to

the required voltage level. This is done by a transformer. Thus, a step down

transformer is employed to decrease the voltage to a required level.

Rectifier:

The output from the transformer is fed to the rectifier. It converts A.C. into

pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this project,

a bridge rectifier is used because of its merits like good stability and full wave

rectification.

Filter:

Capacitive filter is used in this project. It removes the ripples from the output

of rectifier and smoothens the D.C. Output received from this filter is constant until

the mains voltage and load is maintained constant. However, if either of the two is

varied, D.C. voltage received at this point changes. Therefore a regulator is applied at

the output stage.

SVCET Page 32

Voltage regulator:

As the name itself implies, it regulates the input applied to it. A voltage

regulator is an electrical regulator designed to automatically maintain a constant

voltage level. In this project, power supply of 5V and 12V are required. In order to

obtain these voltage levels, 7805 and 7812 voltage regulators are to be used. The first

number 78 represents positive supply and the numbers 05, 12 represent the required

output voltage levels.

3.4 VOLTAGE REGULATOR 7805Description:

The LM78XX/LM78XXA series of three-terminal positive regulators are

available in the TO-220/D-PAK package and with several fixed output voltages,

making them useful in a Wide range of applications. Each type employs internal

current limiting, thermal shutdown and safe operating area protection, making it

essentially indestructible. If adequate heat sinking is provided, they can deliver over

1A output Current. Although designed primarily as fixed voltage regulators, these

devices can be used with external components to obtain adjustable voltages and

currents.

Absolute Maximum Ratings:

Table 3.4: Ratings of voltage regulator

Parameter Symbol Value Unit

Input voltage(for V0+5V to 18V) V1 35 V

Thermal resistance junction cases RJC 5 C/W

Thermal resistance junction air RJA 65 C/W

Operating temperature range TOPR 0~+125 C

Storage temperature range TSTG ~65~+150 C

SVCET Page 33

Typical Performance Characteristics:

Fig 3.4: Performance characteristics of regulator

3.5 CAPACITORSA capacitor or condenser is a passive electronic component consisting of a

pair of conductors separated by a dielectric. When a voltage potential difference exists

between the conductors, an electric field is present in the dielectric. This field stores

energy and produces a mechanical force between the plates. The effect is greatest

between wide, flat, parallel, narrowly separated conductors.

Fig 3.5: Capacitors

SVCET Page 34

3.6 RESISTORS

A resistor is a two-terminal electronic component designed to oppose an

electric current by producing a voltage drop between its terminals in proportion to the

current, that is, in accordance with Ohm's law:

V = IR

Resistors are used as part of electrical networks and electronic circuits. They

are extremely commonplace 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).

Fig 3.6: Resistors

The primary characteristics of resistors are their resistance and the power they

can dissipate. Other characteristics include temperature coefficient, noise, and

inductance. Less well-known is critical resistance, the value below which power

dissipation limits the maximum permitted current flow, and above which the limit is

applied voltage. Critical resistance depends upon the materials constituting the

resistor as well as its physical dimensions; it's determined by design.

3.7 IR UNIT

This sensor consists of IR transmitter and receivers on a single plain.Where

Infrared (IR) radiation is part of the electromagnetic spectrum, which includes radio

waves, microwaves, visible light, and ultraviolet light, as well as gamma rays and X-

rays. The IR range falls between the visible portion of the spectrum and radio waves.

SVCET Page 35

IR wavelengths are usually expressed in microns, with the lR spectrum extending

from 0.7 to 1000microns.

PRINCIPE:

Transmitter and receiver are incorporated in a single housing. The modulated

infrared light of the transmitter strikes the object to be detected and is reflected in a

diffuse way. Part of the reflected light strikes the receiver and starts the switching

operation. The two states – i.e. reflection received or no reflection – are used to

determine the presence or absence of an object in the sensing range. This system

safely detects all objects that have sufficient reflection. For objects with a very bad

degree of reflection (matt black rough surfaces) the use of diffuse reflection sensors

for short ranges or with background suppression is recommended.

Fig 3.7: Photo transmitter

Fig 3.8: Receiver characteristics

SVCET Page 36

Sensitivity setting - Diffuse reflection sensors

For diffuse reflection sensors with sensitivity setting the sensitivity should always

be set to maximum independent of the required range in order to achieve the highest

possible operational safety. Only in the case of interfering backgrounds (walls,

machine parts) could it be necessary to reduce the range.

Diffuse reflection sensors for short ranges

Short-range diffuse type sensors are diffuse reflection sensors which have been

specifically designed for short ranges. Light and dark objects are almost equally

detectable within the set sensing range.

Fig 3.9: Diffuse reflection sensors for short ranges

Short-range diffuse types have high excess gains which allow usage even under

extreme environmental conditions (e.g. dust, mist etc.). Objects outside the range are

not detected.

3.9 RELAYS Relay is an electrically operated switch. Current flowing through the coil of

the relay creates a magnetic field which attracts a lever and changes the switch

contacts. The coil current can be on or off so relays have two switch positions and

they are double throw (changeover) switches.

Fig 3.10: Relay

SVCET Page 37

Relays allow one circuit to switch a second circuit which can be completely

separate from the first. For example a low voltage battery circuit can use a relay to

switch a 230V AC mains circuit. There is no electrical connection inside the relay

between the two circuits; the link is magnetic and mechanical.

Fig 3.11: Relay 2

The coil of a relay passes a relatively large current, typically 30mA for a 12V

relay, but it can be as much as 100mA for relays designed to operate from lower

voltages. Most ICs (chips) cannot provide this current and a transistor is usually used

to amplify the small IC current to the larger value required for the relay coil. The

maximum output current for the popular 555 timer IC is 200mA so these devices can

supply relay coils directly without amplification.

Fig 3.12: The relay switch connections COM, NC and NO

COM = Common, always connect to this, it is the moving part of the switch.

NC = Normally Closed, COM is connected to this when the relay coil is off.

NO = Normally Open, COM is connected to this when the relay coil is on.

SVCET Page 38

Connect to COM and NO if you want the switched circuit to be on when the

relay coil is on.

Connect to COM and NC if you want the switched circuit to be on when the

relay coil is off.

Protection diodes for relays

Transistors and ICs (chips) must be protected from the brief high voltage 'spike'

produced when the relay coil is switched off. The diagram shows how a signal diode

(eg 1N4148) is connected across the relay coil to provide this protection. Note that the

diode is connected 'backwards' so that it will normally not conduct. Conduction only

occurs when the relay coil is switched off, at this moment current tries to continue

flowing through the coil and it is harmlessly diverted through the diode. Without the

diode no current could flow and the coil would produce a damaging high voltage

'spike' in its attempt to keep the current flowing.

Advantages of relays:

Relays can switch AC and DC, transistors can only switch DC.

Relays can switch high voltages, transistors cannot.

Relays are a better choice for switching large currents (> 5A).

Relays can switch many contacts at once.

Applications: Cassette, CD Player, CD-ROM, VCD, DVD, DV-ROM .

SVCET Page 39

SVCET Page 40

CHAPTER IV

GLOBAL SYSTEM FOR MOBILE COMMUNICATION

Originally Groupe Spécial Mobile, is a standard set developed by

the European Telecommunications Standards Institute (ETSI) to describe technologies

for second generation (2G) digital cellular networks. Developed as a replacement for

first generation (1G) analog cellular networks, the GSM standard originally described

a digital, circuit switched network optimized for full duplex voice telephony. The

standard was expanded over time to include first circuit switched data transport, then

packet data transport via GPRS (General Packet Radio services). Packet data

transmission speeds were later increased via EDGE (Enhanced Data rates for GSM

Evolution). The GSM standard is more improved after the development of third

generation (3G) UMTS standard developed by the 3GPP. GSM networks will evolve

further as they begin to incorporate fourth generation (4G) LTE Advanced standards.

"GSM" is a trademark owned by the GSM Association.

4.2 GSM CARRIER FREQUENCIESGSM 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.

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 is 270.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 GSM850/900 and 1 watt in GSM1800/1900.

SVCET Page 41

4.3 VOICE CODECSGSM 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 signal.

GSM was further enhanced in 1997[8] 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 refactored into a variable-rate codec called AMR-Narrowband,

which is high quality and robust against interference when used on full rate channels,

and less robust but still relatively high quality when used in good radio conditions on

half-rate channels.

4.4 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).

Fig 4.1: Structure of GSM network

SVCET Page 42

4.5 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.

4.6 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.

Insome countries

(e.g., Bangladesh,Brazil, Chile, HongKong, India, Lebanon, Malaysia, Pakistan, Sing

apore) all phones are sold unlocked. In others (e.g., Finland, Singapore) it is unlawful

for operators to offer any form of subsidy on a phone's price.

4.7 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 development of 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.

SVCET Page 43

GSM uses several cryptographic algorithms for security.

The A5/1 and A5/2 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  cipher

text-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 Karsten Nohl 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. 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. An update by Nancy Owano on Dec. 27, 2011 on

PhysOrg.com quotes Nohl as a "security expert", and details these concerns:

Nohl said that he was able to intercept voice and text conversations by

impersonating another user to listen to their voice mails or make calls or send text

messages. Even more troubling was that he was able to pull this off using a seven-

year-old Motorola cell phone and decryption software available free off the Internet.

GSM was also mentioned in a Reuters story "Hackers say to publish emails

stolen from Stratfor" on Yahoo! News.

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. At present

such attacks often come in the form of a Trojan, malware or a virus and might be

detected by security software.

GSM uses General Packet Radio Service (GPRS) for data transmissions like

browsing the web. The most commonly deployed GPRS and EDGE ciphers were

publicly broken in 2011, and the evidence indicates that they were once again

intentionally left weak by the mobile industry designers.

SVCET Page 44

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/EDGE 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 stations and downgrade attacks, users

will be protected in the medium term, though migration to 128-bit GEA/4 is still

recommended.

But since GEA/0, GEA/1 and GEA/2 are widely deployed, applications should

use SSL/TLS for sensitive data, as they would on wi-finetworks.

4.8GSM OPEN SOURCE SOFTWARE

Several open-source software projects exist that provide certain GSM features:

GSM daemon by Openmoko, BTS develops a station, The GSM Software

Project aims to build a GSM analyzer for less than $1000Osmocom BB developers

intend to replace the proprietary baseband GSM stack with a free software

implementation.

Issues with patents and open source

Patents remain a problem for any open-source GSM implementation, because

it is not possible for GNU or any other free software distributor to guarantee

immunity from all lawsuits by the patent holders against the users. Furthermore new

features are being added to the standard all the time which means they have patent

protection for a number of years.

The original GSM implementations from 1991 are now entirely free of patent

encumbrances and it is expected that Open BTS will be able to implement features of

that initial specification without limit and that as patents subsequently expire, those

features can be added into the open source version. As of 2011, there have been no

law suits against users of Open BTS over GSM use.

International Mobile Subscriber Identity (IMSI)

MSISDN Mobile Subscriber ISDN Number

Handoff

SVCET Page 45

Visitors Location Register (VLR)

Um interface

GSM-R (GSM-Railway)

GSM services

Cell Broadcast

GSM localization

Multimedia Messaging Service (MMS)

NITZ Network Identity and Time Zone

Wireless Application Protocol (WAP)

Network simulation Simulation of GSM networks

Standards

Comparison of mobile phone standards

GEO-Mobile Radio Interface

Intelligent Network

Parlay X

RRLP – Radio Resource Location Protocol

GSM 03.48 – Security mechanisms for the SIM application toolkit

RTP audio video profile

Enhanced Network Selection (ENS)

SVCET Page 46

CHAPTER V

GPS-GLOBAL POSITIONING SYSTEM

The Global Positioning System, usually called GPS, is the only fully-

functional satellite navigation system(allow small electronic devices to determine

their location (Longitude, Latitude, and Altitude) in within a few meters using time

signals transmitted along a line of sight by radio from satellites. Receivers on the

ground with a fixed position can also be used to calculate the precise time as a

reference for scientific experiments.

GPS has become a vital global utility, indispensable for modern navigation on

land, sea, and air around the world, as well as an important tool for map-making and

land surveying. GPS also provides an extremely precise time reference, required for

telecommunications and some scientific research, including the study of earthquakes.

GPS receivers can also gauge altitude and speed with a very high degree of accuracy.

The GPS project was developed in 1973 to overcome the limitations of

previous navigation systems, integrating ideas from several predecessors, including a

number of classified engineering design studies from the 1960s. GPS was created and

realized by the U.S. Department of Defense (DOD) and was originally run with

24 satellites. It became fully operational in 1994.

5.1 WORKING OF GPS

GPS works like this:

A minimum of 24 GPS satellites are in orbit at 20,200 kilometers (12,600

miles) above the Earth. The satellites are spaced so that from any point on Earth, at

least four satellites will be above the horizon.

Each satellite contains a simple computer, atomic clocks, and various radios.

With an understanding of its own orbit and the clock, the satellite continually

broadcasts its changing position and time. The satellites use their on-board atomic

clocks to keep precise time, but are otherwise very simple and unsophisticated when

compared to other modern spacecraft.

A GPS receiver "knows" the location of the satellites. By estimating how far

away a satellite is, the receiver also "knows" it is located somewhere on the surface of

SVCET Page 47

an imaginary sphere centered at the satellite. It then determines the sizes of several

spheres, one for each satellite. The receiver is located where these spheres intersect.

Fig 5.1: Determining position of object in GPS

1- Satellite's position is determined relative to the Earth.

2- Location on Earth is located relative to the satellite.

3- THEN the Location's position on the Earth can be determined from the VECTOR

sum of the other two measurements. All measurements must are done to such a

precision that the location on the Earth is known to within 15 m.

Fig 5.2: Calculation of distance

The distance from the satellite is determined by the time it takes for a radio wave to

reach the site from the satellite.

SVCET Page 48

Distance = (speed of light) x (time of flight)

This is very simple but there are a few difficulties:

The receiver clock is not exactly synchronized with the satellite clock so the time

of flight will be imprecise. The satellite and receiver are in different velocity reference

frames and gravitational regimes.

The speed of light is 300,000 km/s in a vacuum. However, while traveling through

the Earth Ionosphere and Troposphere, the radio waves travel at slightly slower

speeds.

The location is a vector and must also include direction. In order to do this,

distances from several satellites are required. This is called triangulation. We wish to

find our latitude, longitude and height above the center of the Earth. These are three

different numbers and would require distances to three different satellites

Time for the signal to reach GPS receiver is determined. Distance is computed by

multiplying by the speed of light. Distance from two satellites defines 2 points (in 2

dimensional space.The distance from a third satellite narrows the location to an “error

triangle.”Assume the error in each of our measurements is a constant, k.Solve for k,

so that the “error triangle” is as small as possible.

Fig 5.3: Calculation of triangulation point

SVCET Page 49

5.2 STRUCTURE

Fig 5.4: Segments of GPS

The current GPS consists of three major segments. These are the space

segment (SS), a control segment (CS), and a user segment (US).The U.S. Air Force

develops, maintains, and operates the space and control segments. GPS

satellites broadcast signals from space, and each GPS receiver uses these signals to

calculate its three-dimensional location (latitude, longitude, and altitude) and the

current time.

The space segment is composed of 24 to 32 satellites in medium Earth

orbit and also includes the payload adapters to the boosters required to launch them

into orbit. The control segment is composed of a master control station, an alternate

master control station, and a host of dedicated and shared ground antennas and

monitor stations. The user segment is composed of hundreds of thousands of U.S. and

allied military users of the secure GPS Precise Positioning Service and tens of

SVCET Page 50

User segment

Ground antennas

Control segment

Master station Monitor station

Space segment

millions of civil, commercial, and scientific users of the Standard Positioning Service

(see GPS navigation devices).

5.3 SPACE SEGMENT

Fig 5.5: Space segment

The space segment (SS) is composed of the orbiting GPS satellites or Space

Vehicles (SV) in GPS parlance. The GPS design originally called for 24 SVs, eight

each in three approximately circular orbits, but this was modified to six orbital planes

with four satellites each. The orbits are centered on the Earth, not rotating with the

Earth, but instead fixed with respect to the distant stars. The six orbit planes have

approximately 55° inclination (tilt relative to Earth's equator) and are separated by

60° right ascension of the ascending node (angle along the equator from a reference

point to the orbit's intersection). The orbital period is one-half a sidereal day, i.e. 11

hours and 58 minutes. The orbits are arranged so that at least six satellites are always

within line of sight from almost everywhere on Earth's surface. The result of this

objective is that the four satellites are not evenly spaced (90 degrees) apart within

each orbit. In general terms, the angular difference between satellites in each orbit is

30, 105, 120, and 105 degrees apart which, of course, sum to 360 degrees.

5.4 CONTROL SEGMENT The control segment is composed of

1. A master control station (MCS),

2. An alternate master control station,

3. Four dedicated ground antennas and

4. Six dedicated monitor stations

SVCET Page 51

Fig 5.6: Control segment

The MCS can also access U.S. Air Force Satellite Control Network (AFSCN)

ground antennas (for additional command and control capability) and NGA (National

Geospatial-Intelligence Agency) monitor stations. The flight paths of the satellites are

tracked by dedicated U.S. Air Force monitoring stations

in Hawaii, Kwajalein, Ascension Island, Diego Garcia, Colorado Springs,

Colorado and Cape Canaveral, along with shared NGA monitor stations operated in

England, Argentina, Ecuador, Bahrain, Australia and Washington DC.

The tracking information is sent to the Air Force Space Command MCS

at Schriever Air Force Base 25 km (16 mi) ESE of Colorado Springs, which is

operated by the 2nd Space Operations Squadron (2 SOPS) of the U.S. Air Force. Then

2 SOPS contacts each GPS satellite regularly with a navigational update using

dedicated or shared (AFSCN) ground antennas (GPS dedicated ground antennas are

located at Kwajalein, Ascension Island, Diego Garcia, and Cape Canaveral).

These updates synchronize the atomic clocks on board the satellites to within a

few nanoseconds of each other, and adjust the ephemeris of each satellite's internal

orbital model. The updates are created by a Kalman filter that uses inputs from the

ground monitoring stations, space weather information, and various other inputs.

The Operation Control Segment (OCS) currently serves as the control segment of

record. It provides the operational capability that supports global GPS users and keeps

the GPS system operational and performing within specification.

OCS successfully replaced the legacy 1970’s-era mainframe computer at

Schriever Air Force Base in September 2007. After installation, the system helped

enable upgrades and provide a foundation for a new security architecture that

supported the U.S. armed forces. OCS will continue to be the ground control system

of record until the new segment, Next Generation GPS Operation Control

System (OCX), is fully developed and functional.

SVCET Page 52

5.5 USER SEGMENTThe user segment is composed of hundreds of thousands of U.S. and allied

military users of the secure GPS Precise Positioning Service, and tens of millions of

civil, commercial and scientific users of the Standard Positioning Service.

Fig 5.7: User segment

In general, GPS receivers are composed of an antenna, tuned to the

frequencies transmitted by the satellites, receiver-processors, and a highly stable clock

(often a crystal oscillator). They may also include a display for providing location and

speed information to the user. A receiver is often described by its number of channels:

this signifies how many satellites it can monitor simultaneously. Originally limited to

four or five, this has progressively increased over the years so that, as of 2007,

receivers typically have between 12 and 20 channels.

Fig 5.8: User segment 2

GPS receivers may include an input for differential corrections, using

the RTCM SC-104 format. This is typically in the form of an RS-232 port at

4,800 bit/s speed. Data is actually sent at a much lower rate, which limits the accuracy

of the signal sent using RTCM. Receivers with internal DGPS receivers can

SVCET Page 53

outperform those using external RTCM data. As of 2006, even low-cost units

commonly include Wide Area Augmentation System (WAAS) receivers.

Many GPS receivers can relay position data to a PC or other device using

the NMEA 0183 protocol. Although this protocol is officially defined by the National

Marine Electronics Association (NMEA  references to this protocol have been

compiled from public records, allowing open source tools like gpsd to read the

protocol without violating intellectual property laws.

Other proprietary protocols exist as well, such as

the SiRF and MTK protocols. Receivers can interface with other devices using

methods including a serial connection, USB, or Bluetooth.

SVCET Page 54

CHAPTER VI

SERIAL COMMUNICATION

Computers transfer data in two ways: parallel and serial. In parallel data

transfers, often 8 or more lines are used to transfer data to a device that is only a few

feet away. Although a lot of data can be transferred in a short amount of time by using

many wires in parallel, the distance cannot be great. To transfer to a device located

many meters away, the serial method is best suitable.

In serial communication, the data is sent one bit at a time. The 8051 has serial

communication capability built into it, thereby making possible fast data transfer

using only a few wires.

The fact that serial communication uses a single data line instead of the 8-bit

data line instead of the 8-bit data line of parallel communication not only makes it

cheaper but also enables two computers located in two different cities to communicate

over the telephone.

The main requirements for serial communication are:

1. Microcontroller

2. PC

3. RS 232 cable

4. MAX 232 IC

5. HyperTerminal

6.1 ASYNCHRONOUS AND SYNCHRONOUS SERIAL

COMMUNICATIONSerial data communication uses two methods, asynchronous and synchronous.

The synchronous method transfers a block of data at a time, while the asynchronous

method transfers a single byte at a time. With synchronous communications, the two

devices initially synchronize themselves to each other, and then continually send

characters to stay in sync. Even when data is not really being sent, a constant flow of

bits allows each device to know where the other is at any given time. That is, each

character that is sent is either actual data or an idle character. Synchronous

communications allows faster data transfer rates than asynchronous methods, because

additional bits to mark the beginning and end of each data byte are not required. The

SVCET Page 55

serial ports on IBM-style PCs are asynchronous devices and therefore only support

asynchronous serial communications.

Asynchronous means "no synchronization", and thus does not require sending

and receiving idle characters. However, the beginning and end of each byte of data

must be identified by start and stop bits. The start bit indicates when the data byte is

about to begin and the stop bit signals when it ends. The requirement to send these

additional two bits causes asynchronous communication to be slightly slower than

synchronous however it has the advantage that the processor does not have to deal

with the additional idle characters.

There are special IC chips made by many manufacturers for serial data

communications. These chips are commonly referred to as UART(universal

asynchronous receiver-transmitter) and USART(universal synchronous-asynchronous

receiver-transmitter). The 8051 has a built-in UART.

In the asynchronous method, the data such as ASCII characters are packed

between a start and a stop bit. The start bit is always one bit, but the stop bit can be

one or two bits. The start bit is always a 0 (low) and stop bit (s) is 1 (high). This is

called framing.

The rate of data transfer in serial data communication is stated as bps (bits per

second). Another widely used terminology for bps is baud rate. The data transfer rate

of a given computer system depends on communication ports incorporated into that

system. And in asynchronous serial data communication, this baud rate is generally

limited to 100,000bps. The baud rate is fixed to 9600bps in order to interface with the

microcontroller using a crystal of 11.0592 MHz.

6.2 RS232 CABLETo allow compatibility among data communication equipment, an interfacing

standard called RS232 is used. Since the standard was set long before the advent of

the TTL logic family, its input and output voltage levels are not TTL compatible. For

this reason, to connect any RS232 to a microcontroller system, voltage converters

such as MAX232 are used to convert the TTL logic levels to the RS232 voltage levels

and vice versa.

6.3 MAX 232Max232 IC is a specialized circuit which makes standard voltages as required

by RS232 standards. This IC provides best noise rejection and very reliable against

SVCET Page 56

discharges and short circuits. MAX232 IC chips are commonly referred to as line

drivers.

To ensure data transfer between PC and microcontroller, the baud rate and

voltage levels of Microcontroller and PC should be the same. The voltage levels of

microcontroller are logic1 and logic 0 i.e., logic 1 is +5V and logic 0 is 0V. But for

PC, RS232 voltage levels are considered and they are: logic 1 is taken as -3V to -25V

and logic 0 as +3V to +25V. So, in order to equal these voltage levels, MAX232 IC is

used. Thus this IC converts RS232 voltage levels to microcontroller voltage levels

and vice versa.

Fig 6.1: MAX232 IC

6.3 SCON (serial control) registersThe SCON register is an 8-bit register used to program the start bit, stop bit

and data bits of data framing.

Table 6.1: SCON

SVCET Page 57

SM0 SM1 SM2 REN TB8 RB8 TI RI

Table 6.2: SCON types and modes

SM0 SCON.7 Serial port mode specifier

SM1 SCON.6 Serial port mode specifier

SM2 SCON.5 Used for multiprocessor communication

REN SCON.4 Set/cleared by software to enable/disable

reception

TB8 SCON.3 Not widely used

RB8 SCON.2 Not widely used

TI SCON.1 Transmit interrupt flag. Set by hardware at the

beginning of the stop bit in mode 1. Must be

cleared by software.

RI SCON.0 Receive interrupt flag. Set by hardware at the

beginning of the stop bit in mode 1. Must be

cleared by software.

SM0 SM1

0 0 Serial Mode 0

0 1 Serial Mode 1, 8-bit data, 1 stop bit, 1 start bit

1 0 Serial Mode 2

1 1 Serial Mode 3

SVCET Page 58

Of the four serial modes, only mode 1 is widely used. In the SCON register,

when serial mode 1 is chosen, the data framing is 8 bits, 1 stop bit and 1 start bit,

which makes it compatible with the COM port of IBM/ compatible PC’s. And the

most important is serial mode 1 allows the baud rate to be variable and is set by Timer

1 of the 8051. In serial mode 1, for each character a total of 10 bits are transferred,

where the first bit is the start bit, followed by 8 bits of data and finally 1 stop bit.

SVCET Page 59

CHAPTER VII

KEIL SOFTWAREKeil development tools for the 8051 Microcontroller Architecture support

every level of software developer from the professional applications engineer to the

student just learning about embedded software development. The industry-standard

Keil C Compilers, Macro Assemblers, Debuggers, Real-time Kernels, Single-board

Computers, and Emulators support all 8051 derivatives and help you get.

7.1 SIMULATIONThe µVision Simulator allows you to debug programs using only your PC

using simulation drivers provided by Keil and various third-party developers. A good

simulation environment, like µVision, does much more than simply simulate the

instruction set of a microcontroller — it simulates your entire target system including

interrupts, start up code, on-chip peripherals, external signals, and I/O. This software

is used for execution of microcontroller programs. Keil development tools for the

MC architecture support every level of software developer from the professional

applications engineer to the student just learning about embedded software

development. The industry-standard keil C compilers, macro assemblers, debuggers,

real, time Kernels, Single-board computers and emulators support all microcontroller

derivatives and help you to get more projects completed on schedule. The keil

software development tools are designed to solve the complex Problems facing

embedded software developers.

When starting a new project, simply select the microcontroller you the device

database and the µvision IDE sets all compiler, assembler, linker, and memory

options for you. Numerous example programs are included to help you get started

with the most popular embedded AVR devices. The keil µ Vision debugger accurately

simulates on-chip peripherals (PC, CAN, UART, SPI, Interrupts, I/Oports,A/D

converter, D/A converter and PWM modules)of your AVR device. Simulation helps

you understand h/w configurations and avoids time wasted on setup problems.

Additionally, with simulation, you can write and test applications before target h/w is

available.

SVCET Page 60

Click on the Keil uVision Icon on Desktop.The following fig will appear

Fig 7.1: Keil software step1

1. Click on the Project menu from the title bar

Then Click on New Project

Fig 7.2: Keil software step2

2. Save the Project by typing suitable project name with no extension in u r own folder

sited in either C:\ or D:\

SVCET Page 61

Fig 7.3: Keil software step3

Then Click on save button above.

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

4. Click on the + Symbol beside of Atmel

Fig 7.4: Keil software step4

5. Select AT89C52 as shown below

SVCET Page 62

Fig 7.5: Keil software step5

6. Then Click on “OK”

7. The Following fig will appear

Fig 7.6: Keil software step6

SVCET Page 63

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

9. Now your project is ready to USE

10. Now double click on the Target1, you would get another option “Source group 1” as

shown in next page.

Fig 7.7: Keil software step7

11. Click on the file option from menu bar and select “new”

Fig 7.8: Keil software step8

SVCET Page 64

12. The next screen will be as shown in next page, and just maximize it by double

clicking on its blue boarder.

Fig 7.9: Keil software step9

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

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

based program save it with extension “ .C”

Fig 7.10: Keil software step1

SVCET Page 65

15. The next screen will be as shown in next page, and just maximize it by double

clicking on its blue boarder.

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

Fig 7.11: Keil software step11

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

Fig 7.12: Keil software step12

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

18. Click only one time on option “ADD”

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

SVCET Page 66

Fig 7.13: Keil software step13

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

21. The new window is as follows

Fig 7.14: Keil software step14

22. Then Click “OK”

SVCET Page 67

23. Now Click on the Peripherals from menu bar, and check your required port as shown

in fig below

Fig 7.15: Keil software step15

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

Fig 7.16: Keil software step16

25. Now keep Pressing function key “F11” slowly and observe.

You are running your program successfully.

SVCET Page 68

CHAPTER VIII

SOFTWARE DESCRIPTION

8. 1SOURCE CODE

************* MODULES:

MAIN SECTION:

LPC2148 Microcontroller

LCD(4-bit data ) RS-P1.16,EN-P1.17,DATA -P1.18-P1.19

GSM (UART0)

GPS (UART1)

keys (3) P1,22-P1.24

1. Ir-Photodiode P0.16

Proximity P0.17

Motor P0.19

Ignition Key p0.20

****************/

/************************** HEADER FILES

************************************/

#include <LPC214X.H>

#include "lcd.h"

#include "UART.h"

#include <string.h>

/************************** PIN CONNECTIONS

***********************************/

#define photodiode (1<<16) //P0.16

#define proximity (1<<17)

#define buzzer (1<<18) // Buzzer declaration of pin no 18 of PORT0

#define motor (1<<19)

#define key (1<<20)

/************** PIN DECLARATIONS ****************/

SVCET Page 69

#define inc (1<<22) //P1.22

#define dec (1<<2)

#define ent (1<<24)

unsigned char c[20],a[5],i,f1,f2;

unsigned char d[50],j,fg1,fg2;

unsigned char m,n,ti[10],lt[15],lg[15];

unsigned char flag,f,x,b[20],k,numr[15],loc,z;

unsigned char phno[]="+919160508552"; // owner no

unsigned char phno1[]="+919494971169"; // police no

///*********** GSM Interrupt service routine program *******//

void gsm (void) __irq

{

unsigned char temp,IIR;

while((IIR=(U0IIR & 0x01))==0)

{

temp=U0RBR;

c[i++]=temp;

break;

}

}

///*********** GPS Interrupt service routine program *******//

void gps (void) __irq

{

unsigned char temp,IIR;

while((IIR=(U1IIR & 0x01))==0)

{

temp=U1RBR;

if(fg1==1){d[j++]=temp;if(j==45){d[j]='\0';fg2=1;} }

SVCET Page 70

if(temp=='$'){j=0;fg1=1;}

break;

}

}

/* KEY PAD SCAN FUNCTION*/

unsigned char keyscan(unsigned char loc)

{

unsigned char temp=0;

while((IOPIN1 & 0x01000000)!=0x00)

{

if((IOPIN1 & 0x00400000)==0x00)

{

delay(1000);

while((IOPIN1 & 0x00400000)==0x00);

delay(10);

if(temp>=9)

{

temp=9;

}

else

{

temp++;

}

}

if((IOPIN1 & 0x00800000)==0x00)

{

delay(1000);

while((IOPIN1 & 0x00800000)==0x00);

delay(10);

if(temp<=0)

{

temp=0;

}

else

SVCET Page 71

{

temp--;

}

}

lcdcmd(loc);

lcddata(temp+0x30);

}

delay(1000);

while((IOPIN1 & 0x01000000)==0x00);

delay(300);

return temp;

}

/************* MESSAGE SENDING **************/

void message(unsigned char *ph)

{

gsmint();

gpsint();

lcdclear();

disp_loc(0x80,"SENDING SMS...");

serial0("AT+CMGS=");

serial_char0(0x22);serial0(ph);serial_char0(0x22);

serial_char0(0x0d);

delay(2000);

serial0("VEHICLE IS GOING TO BE THEFTED, IS AT LOCATION");

serial0("LT:");

serial0(lt);

serial0("LG:");

serial0(lg);

serial_char0(0x1A);

disp_loc(0x80,"SENDING SENDED...");

delay(10000);

}

SVCET Page 72

void msg1(void)

{

gsmint();

lcdclear();

disp_loc(0x80,"SENDING SMS...");

serial0("AT+CMGS=");

serial_char0(0x22);serial0(phno);serial_char0(0x22);

serial_char0(0x0d);

delay(2000);

serial0("YOUR VEHICLE IS GOING TO BE ACESSED");

serial_char0(0x1A);

disp_loc(0x80,"SENDING SENDED...");

delay(10000);

}

/************************** MAIN FUNCTION

*************************************/

int main( void )

{

unsigned int mask1,mask2,count,chk_flag;

/************ LCDINTILISATIONS *****************/

lcdint();

disp_loc(0x80," WELCOME TO ");

disp_loc(0xc0," THE PROJECT ");

delay(5000);

PINSEL1=0x15400000;

serialint0();

VICIntEnable=0x40;

U0IER=0x01;

VICVectAddr0=(unsigned)gsm;

VICVectCntl0=0x26;

serialint1();

VICIntEnable|=0x80;

U1IER=0x01;

VICVectAddr1=(unsigned)gps;

SVCET Page 73

VICVectCntl1=0x27;

gsmint();

gpsint();

IODIR0=0x00f00000;

IOPIN0=0x00ff0000;

IOSET0=0x00ff0000;

IODIR0|=buzzer;

IODIR0|=motor;

IOCLR0=motor;

IOCLR0=buzzer;

count=0;

lcdclear();

disp_loc(0x80," WELCOME TO ");

disp_loc(0xc0," THE PROJECT ");

while(1)

{

mask1=IOPIN0 & 0x00010000; //photodiode

mask2=IOPIN0 & 0x00020000; //proximity

if((mask1==0) &&(mask2==0))

{

msg1();

lcdclear();

disp_loc(0x80,"ENTER PASSWORD");

p1: delay(100);

a[0]=keyscan(0xc0)+0x30;

a[1]=keyscan(0xc1)+0x30;

a[2]=keyscan(0xc2)+0x30;

a[3]='\0';

delay(100);

disp_loc(0x80,"PASSWORD ENTERED");

delay(100);

if(!(strcmp(a,"123")))

{

SVCET Page 74

delay(200);

lcdclear();

disp_loc(0x80,"AUTHENTICATION");

disp_loc(0xc0," SUCCEED ");

p3: delay(500);

chk_flag=0;

while(chk_flag==0)

{

if(IOPIN0 ==((IOPIN0 & 0xff0fffff)|

(0x00E00000)))

{

IOSET0=motor;

}

else

{

IOCLR0=motor;

}

mask1=IOPIN0 & 0x00010000; //photodiode

mask2=IOPIN0 & 0x00020000; //proximity

if((mask1!=0) &&(mask2!=0))

{

chk_flag=1;

}

}

lcdclear();

disp_loc(0x80," WELCOME TO ");

disp_loc(0xc0," THE PROJECT ");

}

else

{

count++;

IOSET0=buzzer;

SVCET Page 75

disp_loc(0xc0,"WRONG PASSWORD");

delay(500);

IOCLR0=buzzer;

if(count>=3)

{

count=0;

lcdclear();

message(phno);

message(phno1);

lcdclear();

disp_loc(0x80," THE VEHICLE ");

disp_loc(0xc0," ACESS DENIED ");

delay(5000);

lcdclear();

disp_loc(0x80," ENTER SECRETE ");

p2: disp_loc(0xc0," KEY:");

delay(100);

a[0]=keyscan(0xc5)+0x30;

a[1]=keyscan(0xc6)+0x30;

a[2]=keyscan(0xc7)+0x30;

a[3]='\0';

delay(100);

if(!(strcmp(a,"456")))

{

delay(200);

lcdclear();

disp_loc(0x80,"AUTHENTICATION");

disp_loc(0xc0," SUCCEED ");

goto p3;

}

else

{

IOSET0=buzzer;

lcdclear();

SVCET Page 76

disp_loc(0x80,"REENTER SECRETE

");

delay(100);

IOCLR0=buzzer;

goto p2;

}

}

else

{

lcdclear();

disp_loc(0x80,"REENTER PASSWORD");

goto p1;

}

}

}

}

}

SVCET Page 77

RESULTS

Hence the project is designed in such a way so as to protect the vehicle from being

theft, using the modules namely,

a. GSM-Global system for mobiles

b. GPS-Global positioning system

c. Microcontroller

Softwares used are

a. Keil software

b. Embedded C

c. GSM Open source software

d. GPS HyperTerminal software

ADVANTAGES

• Protects vehicle from theft.

• Low cost vehicle theft control scheme.

• The message is sent to the police and the owner about the unauthorized usage.

• The GPS used here tracks the location and sends the information.

• It leaves no choice for the thief to escape.

• The second lock system is available only with the owner, hence a total control

over the vehicle is established.

• Flexible operation.

• Postion can be easily identified.

SVCET Page 78

CONCLUSIONS

The project “Anti Theft Control System Design Using Embedded system” has

been successfully designed and tested. It has been developed by integrating features

of all the hardware components used. Presence of every module has been reasoned out

and placed carefully thus contributing to the best working of the unit.

FUTURE ENHANCEMENT:

The whole system can be made more compact and flexible. All the modules

and sensing system can be brought under a single chip and System-On- Chip (SOC)

for anti-theft control can be designed.

SVCET Page 79

REFERENCES

M. Gianluigi, G. Italiano, GSM and GPRS performance of IPSEC.

Microcontroller by Mazidi.

Microcontroller 8051 by Kenneth Ayala.

Raj Kamal “Embedded Systems – architecture , programming and

Design “Second Edition 2009.

Anti Theft Control System available at the market.

http://www.unitracking.com/howitworks.html

http//www.gpsuser.pdf.

http://www.erols.com/dlwilson/gpscomp.htm

Www. Wikipedia .com.

SVCET Page 80