Sei sulla pagina 1di 68

[Type the document title]

CHAPTER-1
INTRODUCTION
INTRODUCTION TO PROJECT:
In this project Live Human Detection and Alerting System it will detect the humans
using PIR sensor and sends the signal from the transmitter side to the receiver side and
notifies it to the user by sending a gsm to their mobile. Human Detection system can detect
the presence of human; it sends the signal from the transmitter side to the receiver side and
notifies it to the user by continuous buzz. A unique passive Infrared sensor is used in our
design that emits infrared rays to detect humans. As a human body emits thermal radiation.
Will be received and manipulated by the PIR (Passive infrared sensor). Once a human
target is located manipulated by the PIR once a human target is located the system has to be
give and alert which may be held to localized the victim location as soon as possible.
After sensing through PIR sensor it notifies by sending an SMS through a GSM to the
intended user’s mobile through GSM or it sends an alert through the thingspeak cloud.

Introduction to Embedded Systems:


Embedded systems are electronic devices that incorporate microprocessors with in
Their implementations. The main purposes of the microprocessors are to simplify the
system design and provide flexibility. Having a microprocessor in the device means that
removing the bugs, making modifications, or adding new features are only matters of
rewriting the software that controls the device. Or in other words embedded computer
systems are electronic systems that include a microcomputer to perform a specific
dedicated application. The computer is hidden inside these products. Embedded systems are
ubiquitous. Every week millions of tiny computer chips come pouring out of factories
finding their way into our everyday products.

Embedded systems are self-contained programs that are embedded within a piece of
hardware. Whereas a regular computer has many different applications and software that

DEPARTMENT OF ECE Page 1


[Type the document title]

can be applied to various tasks, embedded systems are usually set to a specific task that
cannot be altered without physically manipulating the circuitry. Another way to think of an
embedded system is as a computer system that is created with optimal efficiency, thereby
allowing it to complete specific functions as quickly as possible.

Embedded systems designers usually have a significant grasp of hardware


technologies. They used specific programming languages and software to develop
embedded systems and manipulate the equipment. When searching online, companies offer
embedded systems development kits and other embedded systems tools for use by
engineers and businesses.

Embedded systems technologies are usually fairly expensive due to the necessary
development time and built in efficiencies, but they are also highly valued in specific
industries. Smaller businesses may wish to hire a consultant to determine what sort of
embedded systems will add value to your organization.

An embedded system is a system which is going to do a predefined specified task is


the embedded system and is even defined as combination of both software and hardware. A
general-purpose definition of embedded systems is that they are devices used to control,
monitor or assist the operation of equipment, machinery or plant. "Embedded" reflects the
fact that they are an integral part of the system. At the other extreme a general-purpose
computer may be used to control the operation of a large complex processing plant, and its
presence will be obvious.

All embedded systems are including computers or microprocessors. Some of these


computers are however very simple systems as compared with a personal computer The
very simplest embedded systems are capable of performing only a single function or set of
functions to meet a single predetermined purpose. In more complex systems an application
program that enables the embedded system to be used for a particular purpose in a specific
application determines the functioning of the embedded system. The ability to have
programs means that the same embedded system can be used for a variety of different
purposes. In some cases a microprocessor may be designed in such a way that application

DEPARTMENT OF ECE Page 2


[Type the document title]

software for a particular purpose can be added to the basic software in a second process,
after which it is not possible to make further changes. The applications software on such
processors is sometimes referred to as firmware.

The simplest devices consist of a single microprocessor (often called a "chip”),


which may itself be packaged with other chips in a hybrid system or Application Specific
Integrated Circuit (ASIC). Its input comes from a detector or sensor and its output goes to a
switch or activator which (for example) may start or stop the operation of a machine or, by
operating a valve, may control the flow of fuel to an engine.

As the embedded system is the combination of both software and hardware

Figure1: Block diagram of Embedded System

Software deals with the languages like ALP, C, and VB etc., and Hardware deals with
Processors, Peripherals, and Memory.

Memory: It is used to store data or address.

Peripherals: These are the external devices connected

Processor: It is an IC which is used to perform some task

DEPARTMENT OF ECE Page 3


[Type the document title]

Applications of embedded systems:


I. Manufacturing and process control
II. Construction industry
III. Transport
IV. Buildings and premises
V. Domestic service
VI. Communications
VII. Office systems and mobile equipment
VIII. Banking, finance and commercial
IX. Medical diagnostics, monitoring and life support
X. Testing, monitoring and diagnostic systems

Processors are classified into four types like:

I. Micro Processor (µp)


II. Micro controller (µc)
III. Digital Signal Processor (DSP)
I. Application Specific Integrated Circuits (ASIC)

Micro Processor (µp)


A silicon chip that contains a CPU. In the world of personal computers, the terms
microprocessor and CPU are used interchangeably. At the heart of all personal computers
and most workstations sits a microprocessor. Microprocessors also control the logic of
almost all digital devices, from clock radios to fuel-injection systems for automobiles.

Three basic characteristics differentiate microprocessors


I. Instruction set : The set of instructions that the microprocessor can execute.
II. Bandwidth : The number of bits processed in a single instruction.
III. Clock speed : Given in megahertz (MHz), the clock speed determines how many
instructions per second the processor can execute.

DEPARTMENT OF ECE Page 4


[Type the document title]

In both cases, the higher the value, the more powerful the CPU. For example, a 32-
bit microprocessor that runs at 50MHz is more powerful than a 16-bit microprocessor that
runs at 25MHz. In addition to bandwidth and clock speed, microprocessors are classified as
being either RISC (reduced instruction set computer) or CISC (complex instruction set
computer).

A microprocessor has three basic elements, as shown above. The ALU performs all
arithmetic computations, such as addition, subtraction and logic operations (AND, OR, etc).
It is controlled by the Control Unit and receives its data from the Register Array. The
Register Array is a set of registers used for storing data. These registers can be accessed by
the ALU very quickly. Some registers have specific functions - we will deal with these
later. The Control Unit controls the entire process. It provides the timing and a control
signal for getting data into and out of the registers and the ALU and it synchronizes the
execution of instructions (we will deal with instruction execution at a later date).

Three Basic Elements of a Microprocessor

Micro Controller (µc): 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.

Figure2: Block Diagram of Micro Controller (µc)

DEPARTMENT OF ECE Page 5


[Type the document title]

Digital Signal Processors (DSPs):

Digital Signal Processors is one which performs scientific and mathematical


operation. Digital Signal Processor chips - specialized microprocessors with architectures
designed specifically for the types of operations required in digital signal processing. Like a
general-purpose microprocessor, a DSP is a programmable device, with its own native
instruction code. DSP chips are capable of carrying out millions of floating point operations
per second, and like their better-known general-purpose cousins, faster and more powerful
versions are continually being introduced. DSPs can also be embedded within complex
"system-on-chip" devices, often containing both analog and digital circuitry.

Application Specific Integrated Circuit (ASIC)

ASIC is a combination of digital and analog circuits packed into an IC to achieve the
desired control/computation function

ASIC typically contains

I. CPU cores for computation and control


II. Peripherals to control timing critical functions
III. Memories to store data and program
IV. Analog circuits to provide clocks and interface to the real world which is
analog in nature
V. I/Os to connect to external components like LEDs, memories, monitors etc.

Computer Instruction Set


There are two different types of computer instruction set there are:

I. RISC (Reduced Instruction Set Computer) and


II. CISC (Complex Instruction Set computer)

DEPARTMENT OF ECE Page 6


[Type the document title]

Reduced Instruction Set Computer (RISC):

A RISC (reduced instruction set computer) is a microprocessor that is designed to


perform a smaller number of types of computer instruction so that it can operate at a higher
speed (perform more million instructions per second, or millions of instructions per
second). Since each instruction type that a computer must perform requires additional
transistors and circuitry, a larger list or set of computer instructions tends to make the
microprocessor more complicated and slower in operation.

Complex Instruction Set Computer (CISC):

CISC, which stands for Complex Instruction Set Computer, is a philosophy for
designing chips that are easy to program and which make efficient use of memory. Each
instruction in a CISC instruction set might perform a series of operations inside the
processor. This reduces the number of instructions required to implement a given program,
and allows the programmer to learn a small but flexible set of instructions.

The advantages of CISC

At the time of their initial development, CISC machines used available technologies to
optimize computer performance.Microprogramming is as easy as assembly language to
implement, and much less expensive than hardwiring a control unit.

I. The ease of micro-coding new instructions allowed designers to make CISC


machines upwardly compatible: a new computer could run the same programs as earlier
computers because the new computer would contain a superset of the instructions of the
earlier computers.
II. As each instruction became more capable, fewer instructions could be used to
implement a given task. This made more efficient use of the relatively slow main memory.
III. Because micro program instruction sets can be written to match the constructs of
high-level language.

DEPARTMENT OF ECE Page 7


[Type the document title]

Disadvantages of CISC

Still, designers soon realized that the CISC philosophy had its own problems, including:

I. Earlier generations of a processor family generally were contained as a subset in


every new version --- so instruction set & chip hardware become more complex with each
generation of computers.
II. So that as many instructions as possible could be stored in memory with the least
possible wasted space, individual instructions could be of almost any length---this means
that different instructions will take different amounts of clock time to execute, slowing
down the overall performance of the machine.
III. Many specialized instructions aren't used frequently enough to justify their
existence --- approximately 20% of the available instructions are used in a typical program.
IV. CISC instructions typically set the condition codes as a side effect of the instruction.
Not only does setting the condition codes take time, but programmers have to remember to
examine the condition code bits before a subsequent instruction changes them.

Memory Architecture
There two different type’s memory architectures there are:

I. Harvard Architecture
II. Von-Neumann Architecture

Harvard Architecture

Computers have separate memory areas for program instructions and data. There are
two or more internal data buses, which allow simultaneous access to both instructions and
data. The CPU fetches program instructions on the program memory bus.

The Harvard architecture is a computer architecture with physically separate storage


and signal pathways for instructions and data. The term originated from the Harvard Mark I
relay-based computer, which stored instructions on punched tape (24 bits wide) and data in
electro-mechanical counters. These early machines had limited data storage, entirely

DEPARTMENT OF ECE Page 8


[Type the document title]

contained within the central processing unit, and provided no access to the instruction
storage as data. Programs needed to be loaded by an operator, the processor could not boot
itself. Even in these cases, it is common to have special instructions to access program
memory as data for read-only tables, or for reprogramming.

Von-Neumann Architecture
A computer has a single, common memory space in which both program instructions and
data are stored. There is a single internal data bus that fetches both instructions and data.
They cannot be performed at the same time.

The von Neumann architecture is a design model for a stored-program digital computer
that uses a central processing unit (CPU) and a single separate storage structure
("memory") to hold both instructions and data. It is named after the mathematician and
early computer scientist John von Neumann. Such computers implement a universal Turing
machine and have a sequential architecture.

A stored-program digital computer is one that keeps its programmed instructions, as well
as its data, in read-write, random-access memory (RAM). Stored-program computers were
advancement over the program-controlled computers of the 1940s, such as the Colossus
and the ENIAC, which were programmed by setting switches and inserting patch leads to
route data and to control signals between various functional units.

In the vast majority of modern computers, the same memory is used for both data
and program instructions. The mechanisms for transferring the data and instructions
between the CPU and memory are, however, considerably more complex than the original
von Neumann architecture.

The terms "von Neumann architecture" and "stored-program computer" are generally used
interchangeably, and that usage is followed in this article.

DEPARTMENT OF ECE Page 9


[Type the document title]

Figure4: Schematic of the Von-Neumann Architecture

Basic Difference between Harvard and Von-Neumann Architecture

I. The primary difference between Harvard architecture and the Von Neumann
architecture is in the Von Neumann architecture data and programs are stored in the
same memory and managed by the same information handling system.
II. Whereas the Harvard architecture stores data and programs in separate memory
devices and they are handled by different subsystems.
III. In a computer using the Von-Neumann architecture without cache; the central
processing unit (CPU) can either be reading and instruction or writing/reading data
to/from the memory. Both of these operations cannot occur simultaneously as the
data and instructions use the same system bus.
IV. In a computer using the Harvard architecture the CPU can both read an instruction
and access data memory at the same time without cache. This means that a
computer with Harvard architecture can potentially be faster for a given circuit
complexity because data access and instruction fetches do not contend for use of a
single memory pathway.
V. Today, the vast majority of computers are designed and built using the Von
Neumann architecture template primarily because of the dynamic capabilities and
efficiencies gained in designing, implementing, operating one memory system as
opposed to two. Von Neumann architecture may be somewhat slower than the
contrasting Harvard Architecture for certain specific tasks, but it is much more
flexible and allows for many concepts unavailable to Harvard architecture such as
self programming, word processing and so on.

DEPARTMENT OF ECE Page 10


[Type the document title]

VI. Harvard architectures are typically only used in either specialized systems or for
very specific uses. It is used in specialized digital signal processing (DSP), typically
for video and audio processing products. It is also used in many small
microcontrollers used in electronics applications such as Advanced RISK Machine
(ARM) based products for many vendors.

Characteristics:
Two major areas of differences are cost and power consumption. Since many
embedded systems are produced in the tens of thousands to millions of units range,
reducing cost is a major concern. Embedded systems often use a (relatively) slow processor
and small memory size to minimize costs. The slowness is not just clock speed. The whole
architecture of the computer is often intentionally simplified to lower costs. For example,
embedded systems often use peripherals controlled by synchronous serial interfaces, which
are ten to hundreds of times slower than comparable peripherals used in PCs.Programs on
an embedded system often must run with real-time constraints with limited hardware
resources: often there is no disk drive, operating system, keyboard or screen. A flash drive
may replace rotating media, and a small keypad and LCD screen may be used instead of a
PC's keyboard and screen.Firmware is the name for software that is embedded in hardware
devices, e.g. in one or more ROM/Flash memory IC chips.

Embedded systems are routinely expected to maintain 100% reliability while


running continuously for long periods, sometimes measured in years. Firmware is usually
developed and tested too much stricter requirements than is general-purpose software,
which can usually be easily restarted if a problem occurs.

Tools
Like a typical computer programmer, embedded system designers use compilers,
assemblers and debuggers to develop an embedded system.Those software tools can come
from several sources: Software companies that specialize in the embedded market Ported
from the GNU software development tools. Sometimes, development tools for a personal
computer can be used if the embedded processor is a close relative to a common PC

DEPARTMENT OF ECE Page 11


[Type the document title]

processor. Embedded system designers also use a few software tools rarely used by typical
computer programmers.Some designers keep a utility program to turn data files into code,
so that they can include any kind of data in a program. Most designers also have utility
programs to add a checksum or CRC to a program, so it can check its program data before
executing it.

Operating system
They often have no operating system, or a specialized embedded operating system
(often a real-time operating system), or the programmer is assigned to port one of these to
the new system.

Debugging
Debugging is usually performed with an in-circuit emulator, or some type of
debugger that can interrupt the micro controller’s internal microcode.The microcode
interrupt lets the debugger operate in hardware in which only the CPU works. The CPU-
based debugger can be used to test and debug the electronics of the computer from the
viewpoint of the CPU. This feature was pioneered on the PDP-11.

Developers should insist on debugging which shows the high-level language, with
breakpoints and single stepping, because these features are widely available. Also,
developers should write and use simple logging facilities to debug sequences of real-time
events.PC or mainframe programmers first encountering this sort of programming often
become confused about design priorities and acceptable methods. Mentoring, code-
reviews and ego less programming are recommended.

Design of embedded systems


The electronics usually uses either a microprocessor or a micro controller. Some
large or old systems use general-purpose mainframes computers or minicomputers.

Start-up :

All embedded systems have start-up code. Usually it disables interrupts, sets up

DEPARTMENT OF ECE Page 12


[Type the document title]

the electronics, tests the computer (RAM, CPU and software), and then starts the
application code. Many embedded systems recover from short-term power failures by
restarting (without recent self-tests). Restart times under a tenth of a second are common.
Many designers have found one of more hardware plus software-controlled LEDs useful to
indicate errors during development (and in some instances, after product release, to produce
troubleshooting diagnostics). A common scheme is to have the electronics turn off the
LED(s) at reset, whereupon the software turns it on at the first opportunity, to prove that the
hardware and start-up software have performed their job so far. After that, the software
blinks the LED(s) or sets up light patterns during normal operation, to indicate program
execution progress and/or errors. This serves to reassure most technicians/engineers and
some users.

The control loop


In this design, the software simply has a loop. The loop calls subroutines. Each
subroutine manages a part of the hardware or software. Interrupts generally set flags, or
update counters that are read by the rest of the software.A simple API disables and enables
interrupts. Done right, it handles nested calls in nested subroutines, and restores the
preceding interrupt state in the outermost enable. This is one of the simplest methods of
creating an exokernel.Typically, there's some sort of subroutine in the loop to manage a list
of software timers, using a periodic real time interrupt. When a timer expires, an associated
subroutine is run, or flag is set.Any expected hardware event should be backed-up with a
software timer. Hardware events fail about once in a trillion times. That's about once a year
with modern hardware. With a million mass-produced devices, leaving out a software timer
is a business disaster State machines may be implemented with a function-pointer per state-
machine (in C++, C or assembly, anyway). A change of state stores a different function into
the pointer. The function pointer is executed every time the loop runs. Many designers
recommend reading each IO device once per loop, and storing the result so the logic acts on
consistent values.

Many designers prefer to design their state machines to check only one or two
things per state. Usually this is a hardware event, and a software timer.

DEPARTMENT OF ECE Page 13


[Type the document title]

Designers recommend that hierarchical state machines should run the lower-level
state machines before the higher, so the higher run with accurate information. Complex
functions like internal combustion controls are often handled with multi-dimensional tables.
Instead of complex calculations, the code looks up the values. The software can interpolate
between entries, to keep the tables small and cheap One major weakness of this system is
that it does not guarantee a time to respond to any particular hardware event. Careful
coding can easily assure that nothing disables interrupts for long. Thus interrupt code can
run at very precise timings. Another major weakness of this system is that it can become
complex to add new features. Algorithms that take a long time to run must be carefully
broken down so only a little piece gets done each time through the main loop. This system's
strength is its simplicity, and on small pieces of software the loop is usually so fast that
nobody cares that it is not predictable. Another advantage is that this system guarantees that
the software will run. There is no mysterious operating system to blame for bad behavior.

User interfaces
User interfaces for embedded systems vary wildly, and thus deserve some special
comment. Designers recommend testing the user interface for usability at the earliest
possible instant. A quick, dirty test is to ask an executive secretary to use cardboard models
drawn with magic markers, and manipulated by an engineer. The videotaped result is likely
to be both humorous and very educational. In the tapes, every time the engineer talk, the
interface has failed: It would cause a service call.

Exactly one person should approve the user interface. Ideally, this should be a customer,
the major distributor or someone directly responsible for selling the system. The decision maker
should be able to decide. The problem is that a committee will never make up its mind, and neither
will some people. Not doing this causes avoidable, expensive delays. A usability test is more
important than any number of opinions. Interface designers at PARC, Apple Computer, Boeing
and HP minimize the number of types of user actions. For example, use two buttons (the absolute
minimum) to control a menu system (just to be clear, one button should be "next menu entry" the
other button should be "select this menu entry"). A touch-screen or screen-edge buttons also
minimize the types of user actions.

DEPARTMENT OF ECE Page 14


[Type the document title]

Another basic trick is to minimize and simplify the type of output. Designs should
consider using a status light for each interface plug, or failure condition, to tell what failed.
A cheap variation is to have two light bars with a printed matrix of errors that they select-
the user can glue on the labels for the language that she speaks. For example, Boeing's
standard test interface is a button and some lights. When you press the button, all the lights
turn on. When you release the button, the lights with failures stay on. The labels are in
Basic English. For another example, look at a small computer printer. You might have one
next to your computer. Notice that the lights are labeled with stick-on labels that can be
printed in any language. Really look at it.

Designers use colors. Red means the users can get hurt- think of blood. Yellow
means something might be wrong. Green means everything's OK. Another essential trick is
to make any modes absolutely clear on the user's display.

If an interface has modes, they must be reversible in an obvious way. Most


designers prefer the display to respond to the user. The display should change immediately
after a user action. If the machine is going to do anything, it should start within 7 seconds,
or give progress reports. If a design needs a screen, many designers use plain text. It can be
sold as a temporary expedient. Why is it better than pictures? Users have been reading signs
for years. A GUI is pretty and can do anything, but typically adds a year from artist,
approval and translator delays and one or two programmers to a project's cost, without
adding any value. Often, a clever GUI actually confuses users. If a design needs to point to
parts of the machine (as in copiers), these are labeled with numbers on the actual machine,
that are visible with the doors closed. A network interface is just a remote screen. It needs
the same caution as any other user interface. One of the most successful general-purpose
screen-based interfaces is the two menu buttons and a line of text in the user's native
language. It's used in pagers, medium-priced printers, network switches, and other medium-
priced situations that require complex behavior from users When there's text, there are
languages. The default language should be the one most widely understood. Right now this
is English. French and Spanish follow.

DEPARTMENT OF ECE Page 15


[Type the document title]

Most designers recommend that one use the native character sets, no matter how
painful. People with peculiar character sets feel coddled and loved when their language
shows up on machinery they use. Text should be translated by professional translators, even
if native speakers are on staff. Marketing staff have to be able to tell foreign distributors
that the translations are professional.

A foreign organization should give the highest-volume distributor the duty to


review and correct any translations in his native language. This stops critiques by other
native speakers, who tend to believe that no foreign organization will ever know their
language as well as they.

AT89C51 MICROCONTROLLER

FEATURES
I. 80C51 based architecture
II. 4-Kbytes of on-chip Reprogrammable Flash Memory
III. 128 x 8 RAM
IV. Two 16-bit Timer/Counters
V. Full duplex serial channel
VI. Boolean processor
VII. Four 8-bit I/O ports, 32 I/O lines

GENERAL DESCRIPTION:

THE MICROCONTROLLER:
A microcontroller is a general purpose device, but that is meant to read data, perform
limited calculations on that data and control its environment based on those calculations.
The prime use of a microcontroller is to control the operation of a machine using a fixed
program that is stored in ROM and that does not change over the lifetime of the system.
The microcontroller design uses a much more limited set of single and double byte
instructions that are used to move data and code from internal memory to the ALU. The

DEPARTMENT OF ECE Page 16


[Type the document title]

microcontroller is concerned with getting data from and to its own pins; the architecture
and instruction set are optimized to handle data in bit and byte size.

The AT89C51 is a low-power, high-performance CMOS 8-bit microcontroller with 4k


bytes of Flash Programmable and erasable read only memory (EROM). The device is
manufactured using Atmel’s high-density nonvolatile memory technology and is
functionally compatible with the industry-standard 80C51 microcontroller instruction set
and pin out. By combining versatile 8-bit CPU with Flash on a monolithic chip, the Atmel’s
AT89c51 is a powerful microcomputer, which provides a high flexible and cost- effective
solution to many embedded control applications.

Pin configuration of AT89c51 Microcontroller

FIGURE5: PIN CONFIGURATION OF AT89C51 MICROCONTROLLER

DEPARTMENT OF ECE Page 17


[Type the document title]

AT89C51 Block Diagram

FIGURE6: BLOCK DIAGRAM OF AT89C51 MICROCONTROLLER

DEPARTMENT OF ECE Page 18


[Type the document title]

PIN DESCRIPTION:
VCC: Supply voltage

GND:Ground

Port 0

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 can also be configured to be the multiplexed low order address/data bus
during access to external program and data memory. In this mode, P 0 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.

Port 1

Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The port 1output
buffers can sink/source four TTL inputs. When 1s are written to port 1 pins, they are pulled
high by the internal pull-ups can be used as inputs. As inputs, Port 1 pins that are externally
being pulled low will source current (1) because of the internal pull-ups.

Port 2

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 can be used as inputs. As inputs, Port 2 pins that are
externally being pulled low will source current because of the internal pull-ups.

Port 2 emits the high-order address byte during fetches from external program
memory and during access to DPTR. In this application Port 2 uses strong internal pull-ups
when emitting 1s. During accesses to external data memory that use 8-bit data address
(MOVX@R1), Port 2 emits the contents of the P2 Special Function Register. Port 2 also

DEPARTMENT OF ECE Page 19


[Type the document title]

receives the high-order address bits and some control signals during Flash programming
and verification.

Port 3

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 can be used as inputs. As inputs, Port 3 pins that are externally being
pulled low will source current because of the internal pull-ups.

Port pin Alternate Functions

P3.0 RXD(serial input port)

P3.1 TXD(serial input port)

P3.2 INT0(external interrupt 0)

P3.3 INT1(external interrupt 1)

P3.4 T0(timer 0 external input)

P3.5 T1(timer 1 external input)

P3.6 WR(external data memory write strobe)

P3.7 RD(external data memory read strobe)

Port 3 also receives some control signals for Flash Programming and verification

TABLE1:PORT FUNCTIONS

DEPARTMENT OF ECE Page 20


[Type the document title]

RST:

Rest input A on this pin for two machine cycles while the oscillator is running resets the
device.

ALE/PROG:

Address Latch Enable is an output pulse for latching the low byte of the address during
access 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/16 the oscillator frequency and
may be used for external timing or clocking purpose. Note, however, that one ALE pulse is
skipped during each access to external Data memory.

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 when 12-volt programming
is selected.

XTAL1:

DEPARTMENT OF ECE Page 21


[Type the document title]

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

XTAL 2:

Output from the inverting oscillator amplifier.

OPERATING DESCRIPTION
The detail description of the AT89C51 included in this description is:

I. Memory Map and Registers


II. Timer/Counters
III. Interrupt System

MEMORY MAP AND REGISTERS


Memory:

The AT89C51 has separate address spaces for program and data memory. The program and
data memory can be up to 64K bytes long. The lower 4K program memory can reside on-
chip. The AT89C51 has 128 bytes of on-chip RAM. The lower 128 bytes can be accessed
either by direct addressing or by indirect addressing. The lower 128 bytes of RAM can be
divided into 3 segments as listed below

I. Register Banks 0-3: locations 00H through 1FH (32 bytes). The device after reset
defaults to register bank 0. To use the other register banks, the user must select them
in software. Each register bank contains eight 1-byte registers R0-R7. Reset
initializes the stack point to location 07H, and is incremented once to start from
08H, which is the first register of the second register bank.
II. Bit Addressable Area: 16 bytes have been assigned for this segment 20H-2FH.
Each one of the 128 bits of this segment can be directly addressed (0-7FH). Each of
the 16 bytes in this segment can also be addressed as a byte.

DEPARTMENT OF ECE Page 22


[Type the document title]

III. Scratch Pad Area: 30H-7FH are available to the user as data RAM. However, if
the data pointer has been initialized to this area, enough bytes should be left aside to
prevent SP data destruction.

FIGURE 7: MEMORY REGISTERS

SPECIAL FUNCTION REGISTERS


The Special Function Registers (SFR's) are located in upper 128 Bytes direct
addressing area. The SFR Memory Map in shows that. Not all of the addresses are
occupied. Unoccupied addresses are not implemented on the chip. Read accesses to these
addresses in general return random data, and write accesses have no effect. User software
should not write 1s to these unimplemented locations, since they may be used in future
microcontrollers to invoke new features. In that case, the reset or inactive values of the new
bits will always be 0, and their active values will be 1.

The functions of the SFR’s are outlined in the following sections.

Accumulator (ACC):

ACC is the Accumulator register. The mnemonics for Accumulator-specific instructions,


however, refer to the Accumulator simply as A.

DEPARTMENT OF ECE Page 23


[Type the document title]

B Register (B):The B register is used during multiply and divide operations. For other
instructions it can be treated as another scratch pad register.

Program Status Word (PSW):

The PSW register contains program status information.

Stack Pointer (SP):

The Stack Pointer Register is eight bits wide. It is incremented before data is stored
during PUSH and CALL executions. While the stack may reside anywhere in on chip
RAM, the Stack Pointer is initialized to 07H after a reset. This causes the stack to begin at
location 08H.

Data Pointer (DPTR):

The Data Pointer consists of a high byte (DPH) and a low byte (DPL). Its function
is to hold a 16-bit address. It may be manipulated as a 16-bit register or as two independent
8-bit registers.

Serial Data Buffer (SBUF):

The Serial Data Buffer is actually two separate registers, a transmit buffer and a
receive buffer register. When data is moved to SBUF, it goes to the transmit buffer, where
it is held for serial transmission. (Moving a byte to SBUF initiates the transmission.) When
data is moved from SBUF, it comes from the receive buffer.

Timer Registers:

Register pairs (TH0, TL0) and (TH1, TL1) are the 16-bit Counter registers for
Timer/Counters 0 and 1, respectively.

Control Registers:

DEPARTMENT OF ECE Page 24


[Type the document title]

Special Function Registers IP, IE, TMOD, TCON, SCON, and PCON contain
control and status bits for the interrupt system, the Timer/Counters, and the serial port.

TIMER/COUNTERS:

The IS89C51 has two 16-bit Timer/Counter registers: Timer 0 and Timer 1. All two
can be configured to operate either as Timers or event counters. As a Timer, the register is
incremented every machine cycle. Thus, the register counts machine cycles. Since a
machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator
frequency.

As a Counter, the register is incremented in response to a 1-to-0 transition at its


corresponding external input pin, T0 and T1. 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. There are no restrictions on the duty cycle of the
external input signal, but it should be held for at least one full machine cycle to ensure that
a given level is sampled at least once before it changes.In addition to the Timer or Counter
functions, Timer 0 and Timer 1 have four operating modes: 13-bit timer, 16-bit timer, 8-bit
auto-reload, split timer.

TIMERS:

FIGURE8:TIMERS

SFR’S USED IN TIMERS:

DEPARTMENT OF ECE Page 25


[Type the document title]

The special function registers used in timers are:

I. TMOD Register
II. TCON Register
III. Timer(T0) & timer(T1) Registers

(i) TMOD Register:

TMOD is dedicated solely to the two timers (T0 & T1).

I. The timer mode SFR is used to configure the mode of operation of each of the two
timers. Using this SFR your program may configure each timer to be a 16-bit timer,
or 13 bit timer, 8-bit auto reload timer, or two separate timers. Additionally you
may configure the timers to only count when an external pin is activated or to count
“events” that are indicated on an external pin.
II. It can consider as two duplicate 4-bit registers, each of which controls the action of
one of the timers.

(ii) TCON Register:

I. The timer control SFR is used to configure and modify the way in which the 8051’s
two timers operate. This SFR controls whether each of the two timers is running or
stopped and contains a flag to indicate that each timer has overflowed. Additionally,
some non-timer related bits are located in TCON SFR.
II. These bits are used to configure the way in which the external interrupt flags are
activated, which are set when an external interrupt occurs.

(iii) TIMER 0 (T0):

DEPARTMENT OF ECE Page 26


[Type the document title]

I. TO (Timer 0 low/high, address 8A/8C h)

These two SFR’s taken together represent timer 0. Their exact behavior depends on
how the timer is configured in the TMOD SFR; however, these timers always count up.
What is configurable is how and when they increment in value.

(iv) TIMER 1 (T1):

I. T1 (Timer 1 Low/High, address 8B/ 8D h)

These two SFR’s, taken together, represent timer 1. Their exact behavior depends on
how the timer is configured in the TMOD SFR; however, these timers always count up.
What is Configurable is how and when they increment in value.

The Timer or Counter function is selected by control bits C/T in the Special
Function Register TMOD. These two Timer/Counters have four operating modes, which
are selected by bit pairs (M1, M0) in TMOD. Modes 0, 1, and 2 are the same for both
Timer/Counters, but Mode 3 is different.

The four modes are described in the following sections.

Mode 0:

Both Timers in Mode 0 are 8-bit Counters with a divide-by-32 pre scalar. Figure 8
shows the Mode 0 operation as it applies to Timer 1. In this mode, the Timer register is
configured as a 13-bit register. As the count rolls over from all 1s to all 0s, it sets the Timer
interrupt flag TF1. The counted input is enabled to the Timer when TR1 = 1 and either
GATE = 0 or INT1 = 1. Setting GATE = 1 allows the Timer to be controlled by external
input INT1, to facilitate pulse width measurements. TR1 is a control bit in the Special
Function Register TCON. Gate is in TMOD.

DEPARTMENT OF ECE Page 27


[Type the document title]

The 13-bit register consists of all eight bits of TH1 and the lower five bits of TL1.
The upper three bits of TL1 are indeterminate and should be ignored. Setting the run flag
(TR1) does not clear the registers.

Mode 0 operation is the same for Timer 0 as for Timer 1, except that TR0, TF0 and
INT0 replace the corresponding Timer 1 signals. There are two different GATE bits, one
for Timer 1 (TMOD.7) and one for Timer 0 (TMOD.3).

Mode 1:

Mode 1 is the same as Mode 0, except that the Timer register is run with all 16 bits.
The clock is applied to the combined high and low timer registers (TL1/TH1). As clock
pulses are received, the timer counts up: 0000H, 0001H, 0002H, etc. An overflow occurs
on the FFFFH-to-0000H overflow flag. The timer continues to count. The overflow flag is
the TF1 bit in TCON that is read or written by software

Mode 2:

Mode 2 configures the Timer register as an 8-bit Counter (TL1) with automatic
reload, as shown in Figure 10. Overflow from TL1 not only sets TF1, but also reloads TL1
with the contents of TH1, which is preset by software. The reload leaves the TH1
unchanged. Mode 2 operation is the same for Timer/Counter 0.

Mode 3:

Timer 1 in Mode 3 simply holds its count. The effect is the same as setting TR1 = 0.
Timer 0 in Mode 3 establishes TL0and TH0 as two separate counters. The logic for Mode 3
on Timer 0 is shown in Figure 11. TL0 uses the Timer 0 control bits: C/T, GATE, TR0,
INT0, and TF0. TH0 is locked into a timer function (counting machine cycles) and over the
use of TR1 and TF1 from Timer 1. Thus, TH0 now controls the Timer 1 interrupt.

Mode 3 is for applications requiring an extra 8-bit timer or counter. With Timer 0 in
Mode 3, the AT89C51 can appear to have three Timer/Counters. When Timer 0 is in Mode
3, Timer 1 can be turned on and off by switching it out of and into its own Mode 3. In this

DEPARTMENT OF ECE Page 28


[Type the document title]

case, Timer 1 can still be used by the serial port as a baud rate generator or in any
application not requiring an interrupt.

INTERRUPT SYSTEM:

An interrupt is an external or internal event that suspends the operation of micro


controller to inform it that a device needs its service. In interrupt method, whenever any
device needs its service, the device notifies the micro controller by sending it an interrupt
signal. Upon receiving an interrupt signal, the micro controller interrupts whatever it is
doing and serves the device. The program associated with interrupt is called as interrupt
service subroutine (ISR).Main advantage with interrupts is that the micro controller can
serve many devices.

Baud Rate:

The baud rate in Mode 0 is fixed as shown in the following equation. Mode 0 Baud
Rate = Oscillator Frequency /12 the baud rate in Mode 2 depends on the value of the
SMOD bit in Special Function Register PCON. If SMOD = 0 the baud rate is 1/64 of the
oscillator frequency. If SMOD = 1, the baud rate is 1/32 of the oscillator frequency.

Mode 2 Baud Rate = 2SMODx (Oscillator Frequency)/64.

In the IS89C51, the Timer 1 overflow rate determines the baud rates in Modes 1 and 3.

Lower the vector, higher the priority. The External Interrupts INT0 and INT1 can
each be either level-activated or transition-activated, depending on bits IT0 and IT1 in
Register TCON. The flags that actually generate these interrupts are the IE0 and IE1 bits in
TCON. When the service routine is vectored, hardware clears the flag that generated an
external interrupt only if the interrupt was transition-activated. If the interrupt was level-
activated, then the external requesting source (rather than the on-chip hardware) controls
the request flag.

DEPARTMENT OF ECE Page 29


[Type the document title]

The Timer 0 and Timer 1 Interrupts are generated by TF0and TF1, which are set by
a rollover in their respective Timer/Counter registers (except for Timer 0 in Mode 3).When
a timer interrupt is generated, the on-chip hardware clears the flag that is generated.

The Serial Port Interrupt is generated by the logical OR of RI and TI. The service
routine normally must determine whether RI or TI generated the interrupt, and the bit must
be cleared in software. All of the bits that generate interrupts can be set or cleared by
software, with the same result as though they had been set or cleared by hardware. That is,
interrupts can be generated and pending interrupts can be canceled in software.

Each of these interrupt sources can be individually enabled or disabled by setting or


clearing a bit in Special Function Register IE (interrupt enable) at address 0A8H. There is a
global enable/disable bit that is cleared to disable all interrupts or to set the interrupts.

IE (Interrupt enable register)

Steps in enabling an interrupt


Bit D7 of the IE register must be set to high to allow the rest of register to take
effect. If EA=1, interrupts are enabled and will be responded to if their corresponding bits
in IE are high. If EA=0, no interrupt will be responded to even if the associated bit in the IE
register is high.

Description of each bit in IE register

D7 bit: Disables all interrupts. If EA =0, no interrupt is acknowledged, if EA=1 each


interrupt source is individually enabled or disabled by setting or clearing its enable bit.

D6 bit: Reserved.

D5 bit: Enables or disables timer 2 over flow interrupt (in 8052).

D4 bit: Enables or disables serial port interrupt.

D3 bit: Enables or disables timer 1 over flow interrupt.

DEPARTMENT OF ECE Page 30


[Type the document title]

D2 bit: Enables or disables external interrupt 1.

D1 bit: Enables or disables timer 0 over flow interrupt.

D0 bit: Enables or disables external interrupt 0.

Interrupt priority in 89C51

There is one more SRF to assign priority to the interrupts which is named as
interrupt priority (IP). User has given the provision to assign priority to one interrupt.
Writing one to that particular bit in the IP register fulfils the task of assigning the priority.

DEPARTMENT OF ECE Page 31


[Type the document title]

CHAPTER-2
BLOCK DIAGRAM AND WORKING
BLOCK DIAGRAM:

The block diagram consists of:

I. GSM module
II. Power Supply
III. PIR sensor
IV. NodeMCU

GSM MODULE:

GSM (Global System for Mobile communications) is an open, digital cellular


technology used for transmitting mobile voice and data services.

DEPARTMENT OF ECE Page 32


[Type the document title]

GSM (Global System for Mobile communication) is a digital mobile telephone


system that is widely used in Europe and other parts of the world. GSM uses a variation of
Time Division Multiple Access (TDMA) and is the most widely used of the three digital
wireless telephone technologies (TDMA, GSM, and CDMA). GSM digitizes and
compresses data, then sends it down a channel with two other streams of user data, each in
its own time slot. It operates at either the 900 MHz or 1,800 MHz frequency band. It
supports voice calls and data transfer speeds of up to 9.6 kbit/s, together with the
transmission of SMS (Short Message Service).

PIR SENSOR:
A passive infrared sensor (PIR sensor) is an electronic sensor that measures

infrared (IR) light radiating from objects in its field of view. They are most often used in
PIR-based motion detectors.

The PIR sensor is typically mounted on a printed circuit board containing the necessary
electronics required to interpret the signals from the sensor itself. The complete assembly is
usually contained within a housing, mounted in a location where the sensor can cover area
to be monitored.

NodeMCU:

NodeMCU is an open source IoT platform ISfirmware which runs on


the ESP8266 Wi-Fi SoC from Espress if Systems, and hardware which is based on the
ESP-12 module. "NodeMCU" by default refers to the firmware rather than the development
kits. The firmware uses the Lua scripting language. It is based on the eLua project, and
built on the Espressif Non-OS SDK for ESP8266. It uses many open source projects, such
as lua-cjson and SPIFFS.

WORKING:

DEPARTMENT OF ECE Page 33


[Type the document title]

An individual PIR sensor detects changes in the amount of infrared radiation


impinging upon it, which varies depending on the temperature and surface characteristics of
the objects in front of the sensor. human, passes in front of the background, such as a wall,
the temperature at that point in the sensor's field of view will rise from room temperature to
body temperature, and then back again. The sensor converts the resulting change in the
incoming infrared radiation into a change in the output voltage, and this triggers the
detection. Objects of similar temperature but different surface characteristics may also have
a different infrared emission pattern, and thus moving them with respect to the background
may trigger the detector as well.

As soon as the PIR sensor detects the changes the presence of a human body a
message(SMS) is sent to the intended recepient’s mobile through the GSM module.Once
the module is connected to WIFI message is also sent to the recepient through
THINGSPEAK cloud.The message “HUMAN DETECTED” is displayed on the screen.

DEPARTMENT OF ECE Page 34


[Type the document title]

CHAPTER-3

HARDWARE COMPONENTS DESCRIPTION

NodeMCU:
NodeMCU is an open source IoT platform. firmware which runs on
the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on the ESP-
12 module. "NodeMCU" by default refers to the firmware rather than the development kits.
The firmware uses the Lua scripting language. It is based on the eLua project, and built on
the Espressif Non-OS SDK for ESP8266. It uses many open source projects, such as lua-
cjson

NodeMCU was created shortly after the ESP8266 came out. On December 30,
2013, Espressif Systems is a WIFI SoC integrated with a Tensilica Xtensa LX106
core,widely used in IoT applications (see related projects). NodeMCU started on 13 Oct
2014, when Hong committed the first file of nodemcu-firmware to GitHub gerber file of an
ESP8266 board, named devkit v0.9.MQTT client library from Contiki to the ESP8266 SoC
platform and committed to NodeMCU project, then NodeMCU was able to support the
MQTT IoT protocol, using Lua to access the MQTT broker. Another important update was
made on 30 Jan 2015, when Devsaurus ported the u8glib to NodeMCU project, NodeMCU
to easily drive LCD, Screen, OLED, even VGA displays.

In summer 2015 the creators abandoned the firmware project and a group of
independent contributors took over. By summer 2016 the NodeMCU included more than 40
different modules. Due to resource constraints users need to select the modules relevant for
their project and build a firmware tailored to their needs.

ESP8266 Arduino Core


As Arduino.cc began developing new MCU boards based on non-AVR processors
like the ARM/SAM MCU and used in the Arduino Due, they needed to modify the Arduino
IDE so that it would be relatively easy to change the IDE to support alternate toolchains to

DEPARTMENT OF ECE Page 35


[Type the document title]

allow Arduino C/C++ to be compiled for these new processors. They did this with the
introduction of the Board Manager and the SAM Core. A "core" is the collection of
software components required by the Board Manager and the Arduino IDE to compile an
Arduino C/C++ source file for the target MCU's machine language. Some ESP8266
enthusiasts developed an Arduino core for the ESP8266 WiFi SoC, popularly called the
"ESP8266 Core for the Arduino IDE". NodeMCUs.

GSM

Definition of GSM:
GSM (Global System for Mobile communications) is an open, digital cellular
technology used for transmitting mobile voice and data services.

GSM (Global System for Mobile communication) is a digital mobile telephone


system that is widely used in Europe and other parts of the world. GSM uses a variation of
Time Division Multiple Access (TDMA) and is the most widely used of the three digital
wireless telephone technologies (TDMA, GSM, and CDMA). GSM digitizes and
compresses data, then sends it down a channel with two other streams of user data, each in
its own time slot. It operates at either the 900 MHz or 1,800 MHz frequency band. It
supports voice calls and data transfer speeds of up to 9.6 kbit/s, together with the
transmission of SMS (Short Message Service).

History:

In 1982, the European Conference of Postal and Telecommunications


Administrations (CEPT) created the Group Special Mobile (GSM) to develop a standard for
a mobile telephone system that could be used across Europe. In 1987, a memorandum of
understanding was signed by 13 countries to develop a common cellular telephone system
across Europe. Finally the system created by SINTEF lead by Torleiv Maseng was
selected.

DEPARTMENT OF ECE Page 36


[Type the document title]

In 1989, GSM responsibility was transferred to the European Telecommunications


Standards Institute (ETSI) and phase I of the GSM specifications were published in 1990.
The first GSM network was launched in 1991 by Radiolinja in Finland with joint technical
infrastructure maintenance from Ericsson.

By the end of 1993, over a million subscribers were using GSM phone networks
being operated by 70 carriers across 48 countries. As of the end of 1997, GSM service was
available in more than 100 countries and has become the de facto standard in Europe and
Asia.

GSM Frequencies:

GSM networks operate in a number of different frequency ranges (separated into


GSM frequency ranges for 2G and UMTS frequency bands for 3G). Most 2G GSM
networks operate in the 900 MHz or 1800 MHz bands. Some countries in the Americas
(including Canada and the United States) use the 850 MHz and 1900 MHz bands because
the 900 and 1800 MHz frequency bands were already allocated. Most 3G GSM networks in
Europe operate in the 2100 MHz frequency band. The rarer 400 and 450 MHz frequency
bands are assigned in some countries where these frequencies were previously used for
first-generation systems.

GSM-900 uses 890–915 MHz to send information from the mobile station to the
base station (uplink) and 935–960 MHz for the other direction (downlink), providing 124
RF channels (channel numbers 1 to 124) spaced at 200 kHz. Duplex spacing of 45 MHz is
used. In some countries the GSM-900 band has been extended to cover a larger frequency
range. This 'extended GSM', E-GSM, uses 880–915 MHz (uplink) and 925–960 MHz
(downlink), adding 50 channels (channel numbers 975 to 1023 and 0) to the original GSM-
900 band.

Time division multiplexing is used to allow eight full-rate or sixteen half-rate


speech channels per radio frequency channel. There are eight radio timeslots (giving eight

DEPARTMENT OF ECE Page 37


[Type the document title]

burst periods) grouped into what is called 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. GSM operates in the 900MHz and 1.8GHz
bands in Europe and the 1.9GHz and 850MHz bands in the US. The 850MHz band is also
used for GSM and 3G in Australia, Canada and many South American countries. By having
harmonized spectrum across most of the globe, GSM’s international roaming capability
allows users to access the same services when travelling abroad as at home. This gives
consumers seamless and same number connectivity in more than 218 countries.

Terrestrial GSM networks now cover more than 80% of the world’s population.
GSM satellite roaming has also extended service access to areas where terrestrial coverage
is not available.

Mobile Telephony Standards:

First Generation of Mobile Networks(1G):

The first generation of mobile telephony (written 1G) operated using analogue
communications and portable devices that were relatively large. It used primarily the
following standards:

DEPARTMENT OF ECE Page 38


[Type the document title]

I. AMPS (Advanced Mobile Phone System), which appeared in 1976 in the United
States, was the first cellular network standard. It was used primarily in the
Americas, Russia and Asia. This first-generation analogue network had weak
security mechanisms which allowed hacking of telephones lines.
II. TACS (Total Access Communication System) is the European version of the
AMPS model. Using the 900 MHz frequency band, this system was largely used in
England and then in Asia (Hong-Kong and Japan).
III. ETACS (Extended Total Access Communication System) is an improved version
of the TACS standard developed in the United Kingdom that uses a larger number
of communication channels.

The first-generation cellular networks were made obsolete by the appearance of an entirely
digital second generation.

Second Generation of Mobile Networks (2G):


The second generation of mobile networks marked a break with the first generation of
cellular telephones by switching from analogue to digital. The main 2G mobile telephony
standards are:

i. GSM (Global System for Mobile communications) is the most commonly used
standard in Europe at the end of the 20th century and supported in the United States.
This standard uses the 900 MHz and 1800 MHz frequency bands in Europe. In the
United States, however, the frequency band used is the 1900 MHz band. Portable
telephones that are able to operate in Europe and the United States are therefore
called tri-band.
ii. CDMA (Code Division Multiple Access) uses a spread spectrum technique that
allows a radio signal to be broadcast over a large frequency range.
iii. TDMA (Time Division Multiple Access) uses a technique of time division of
communication channels to increase the volume of data transmitted simultaneously.
TDMA technology is primarily used on the American continent, in New Zealand
and in the Asia-Pacific region.

DEPARTMENT OF ECE Page 39


[Type the document title]

With the 2G networks, it is possible to transmit voice and low volume digital data, for
example text messages (SMS, for Short Message Service) or multimedia messages (MMS,
for Multimedia Message Service). The GSM standard allows a maximum data rate of 9.6
kbps.

Extensions have been made to the GSM standard to improve throughput. One of
these is the GPRS (General Packet Radio System) service which allows theoretical data
rates on the order of 114 Kbit/s but with throughput closer to 40 Kbit/s in practice. As this
technology does not fit within the "3G" category, it is often referred to as 2.5G

The EDGE (Enhanced Data Rates for Global Evolution) standard, billed as 2.75G,
quadruples the throughput improvements of GPRS with its theoretical data rate of 384
Kbps, thereby allowing the access for multimedia applications. In reality, the EDGE
standard allows maximum theoretical data rates of 473 Kbit/s, but it has been limited in
order to comply with the IMT-2000 (International Mobile Telecommunications-2000)
specifications from the ITU (International Telecommunications Union).

Third Generation of Mobile Networks(3G):

The IMT-2000 (International Mobile Telecommunications for the year 2000)


specifications from the International Telecommunications Union (ITU) defined the
characteristics of 3G (third generation of mobile telephony). The most important of these
characteristics are:

1. High transmission data rate.


2. 144 Kbps with total coverage for mobile use.
3. 384 Kbps with medium coverage for pedestrian use.
4. 2 Mbps with reduced coverage area for stationary use.
5. World compatibility.
6. Compatibility of 3rd generation mobile services with second generation networks.

3G offers data rates of more than 144 Kbit/s, thereby allowing the access to multimedia
uses such as video transmission, video-conferencing or high-speed internet access. 3G

DEPARTMENT OF ECE Page 40


[Type the document title]

networks use different frequency bands than the previous networks: 1885-2025 MHz and
2110-2200 MHz.

The main 3G standard used in Europe is called UMTS (Universal Mobile


Telecommunications System) and uses WCDMA (Wideband Code Division Multiple
Access) encoding. UMTS technology uses 5 MHz bands for transferring voice and data,
with data rates that can range from 384 Kbps to 2 Mbps. HSDPA (High Speed Downlink
Packet Access) is a third generation mobile telephony protocol, (considered as "3.5G"),
which is able to reach data rates on the order of 8 to 10 Mbps. HSDPA technology uses the
5 GHz frequency band and uses WCDMA encoding.

Introduction to the GSM Standard:

The GSM (Global System for Mobile communications) network is at the start of the
21st century, the most commonly used mobile telephony standard in Europe. It is called as
Second Generation (2G) standard because communications occur in an entirely digital
mode, unlike the first generation of portable telephones. When it was first standardized in
1982, it was called as Group Special Mobile and later, it became an international standard
called "Global System for Mobile communications" in 1991.

In Europe, the GSM standard uses the 900 MHz and 1800 MHz frequency bands. In
the United States, however, the frequency band used is the 1900 MHz band. For this
reason, portable telephones that are able to operate in both Europe and the United States are
called tri-band while those that operate only in Europe are called bi-band.

The GSM standard allows a maximum throughput of 9.6 kbps which allows
transmission of voice and low-volume digital data like text messages (SMS, for Short
Message Service) or multimedia messages (MMS, for Multimedia Message Service).

GSM Standards:

DEPARTMENT OF ECE Page 41


[Type the document title]

GSM uses narrowband TDMA, which allows eight simultaneous calls on the same
radio frequency. There are three basic principles in multiple access, FDMA (Frequency
Division Multiple Access), TDMA (Time Division Multiple Access), and CDMA (Code
Division Multiple Access). All three principles allow multiple users to share the same
physical channel. But the two competing technologies differ in the way user sharing the
common resource.

TDMA allows the users to share the same frequency channel by dividing the signal
into different time slots. Each user takes turn in a round robin fashion for transmitting and
receiving over the channel. Here, users can only transmit in their respective time slot.

CDMA uses a spread spectrum technology that is it spreads the information


contained in a particular signal of interest over a much greater bandwidth than the original
signal. Unlike TDMA, in CDMA several users can transmit over the channel at the same
time.

TDMA in brief:
In late1980’s, as a search to convert the existing analog network to digital as a
means to improve capacity, the cellular telecommunications industry association chose
TDMA over FDMA. Time Division Multiplex Access is a type of multiplexing where two
or more channels of information are transmitted over the same link by allocating a different
time interval for the transmission of each channel. The most complex implementation using
TDMA principle is of GSM’s (Global System for Mobile communication). To reduce the
effect of co-channel interference, fading and multipath, the GSM technology can use
frequency hopping, where a call jumps from one channel to another channel in a short
interval.

DEPARTMENT OF ECE Page 42


[Type the document title]

TDMA systems still rely on switch to determine when to perform a handoff.


Handoff occurs when a call is switched from one cell site to another while travelling. The
TDMA handset constantly monitors the signals coming from other sites and reports it to the
switch without caller’s awareness. The switch then uses this information for making better
choices for handoff at appropriate times. TDMA handset performs hard handoff, i.e.,
whenever the user moves from one site to another, it breaks the connection and then
provides a new connection with the new site.

Advantages of TDMA:
There are lots of advantages of TDMA in cellular technologies.

1. It can easily adapt to transmission of data as well as voice communication.


2. It has an ability to carry 64 kbps to 120 Mbps of data rates. This allows the operator
to do services like fax, voice band data and SMS as well as bandwidth intensive
application such as multimedia and video conferencing.
3. Since TDMA technology separates users according to time, it ensures that there will
be no interference from simultaneous transmissions.
4. It provides users with an extended battery life, since it transmits only portion of the
time during conversations. Since the cell size grows smaller, it proves to save base
station equipment, space and maintenance.

TDMA is the most cost effective technology to convert an analog system to digital.

Disadvantages of TDMA:
One major disadvantage using TDMA technology is that the users has a predefined
time slot. When moving from one cell site to other, if all the time slots in this cell are full
the user might be disconnected. Likewise, if all the time slots in the cell in which the user is
currently in are already occupied, the user will not receive a dial tone.

The second problem in TDMA is that it is subjected to multipath distortion. To


overcome this distortion, a time limit can be used on the system. Once the time limit is
expired, the signal is ignored.

DEPARTMENT OF ECE Page 43


[Type the document title]

The concept of cellular network


Mobile telephone networks are based on the concept of cells, circular zones that
overlap to cover a geographical area.

Cellular networks are based on the use of a central transmitter-receiver in each cell,
called a "base station" (or Base Transceiver Station, written BTS). The smaller the radius of
a cell, the higher is the available bandwidth. So, in highly populated urban areas, there are
cells with a radius of a few hundred meters, while huge cells of up to 30 kilometers provide
coverage in rural areas.

In a cellular network, each cell is surrounded by 6 neighbouring cells (thus a cell is


generally drawn as a hexagon). To avoid interference, adjacent cells cannot use the same
frequency. In practice, two cells using the same frequency range must be separated by a
distance of two to three times the diameter of the cell.

Architecture of the GSM Network:

In a GSM network, the user terminal is called a mobile station. A mobile station is
made up of a SIM (Subscriber Identity Module) card allowing the user to be uniquely
identified and a mobile terminal. The terminals (devices) are identified by a unique 15-digit
identification number called IMEI (International Mobile Equipment Identity). Each SIM
card also has a unique (and secret) identification number called IMSI (International Mobile
Subscriber Identity). This code can be protected using a 4-digit key called a PIN code.

DEPARTMENT OF ECE Page 44


[Type the document title]

The SIM card therefore allows each user to be identified independently of the
terminal used during communication with a base station. Communications occur through a
radio link (air interface) between a mobile station and a base station.

All the base stations of a cellular network are connected to a base station
controller (BSC) which is responsible for managing distribution of the resources. The
system consisting of the base station controller and its connected base stations is called
the Base Station Subsystem (BSS).

Finally, the base station controllers are themselves physically connected to the Mobile
Switching Centre (MSC), managed by the telephone network operator, which connects
them to the public telephone network and the Internet. The MSC belongs to a Network
Station Subsystem (NSS), which is responsible for managing user identities, their location
and establishment of communications with other subscribers. The MSC is generally
connected to databases that provide additional functions:

1. The Home Location Register (HLR) is a database containing information


(geographic position, administrative information etc.) of the subscribers registered
in the area of the switch (MSC).

DEPARTMENT OF ECE Page 45


[Type the document title]

2. The Visitor Location Register (VLR) is a database containing information of users


other than the local subscribers. The VLR retrieves the data of a new user from the
HLR of the user's subscriber zone. The data is maintained as long as the user is in
the zone and is deleted when the user leaves or after a long period of inactivity
(terminal off).
3. The Equipment Identify Register (EIR) is a database listing the mobile terminals.
4. The Authentication Centre (AUC) is responsible for verifying user identities.
5. The cellular network formed in this way is designed to support mobility via
management of handovers (movements from one cell to another).

Finally, GSM networks support the concept of roaming i.e., movement from one operator
network to another.

Introduction to Modem:

Modem stands for modulator-demodulator:

A modem is a device or program that enables a computer to transmit data over


telephone or cable lines. Computer information is stored digitally, whereas information
transmitted over telephone lines is transmitted in the form of analog waves. A modem
converts between these two forms.

Fortunately, there is one standard interface for connecting external modems to


computers called RS-232. Consequently, any external modem can be attached to any
computer that has an RS-232 port, which almost all personal computers have. There are

DEPARTMENT OF ECE Page 46


[Type the document title]

also modems that come as an expansion board that can be inserted into a vacant expansion
slot. These are sometimes called onboard or internal modems.

While the modem interfaces are standardized, a number of different protocols for
formatting data to be transmitted over telephone lines exist. Some, like CCITT V.34 are
official standards, while others have been developed by private companies. Most modems
have built-in support for the more common protocols at slow data transmission speeds at
least, most modems can communicate with each other. At high transmission speeds,
however, the protocols are less standardized.

Apart from the transmission protocols that they support, the following characteristics
distinguish one modem from another:

I. Bps: How fast the modem can transmit and receive data. At slow rates, modems are
measured in terms of baud rates. The slowest rate is 300 baud (about 25 cps). At
higher speeds, modems are measured in terms of bits per second (bps). The fastest
modems run at 57,600 bps, although they can achieve even higher data transfer rates
by compressing the data. Obviously, the faster the transmission rate, the faster the
data can be sent and received. It should be noted that the data cannot be received at
a faster rate than it is being sent.
II. Voice/data: Many modems support a switch to change between voice and data
modes. In data mode, the modem acts like a regular modem. In voice mode, the
modem acts like a regular telephone. Modems that support a voice/data switch have
a built-in loudspeaker and microphone for voice communication.
III. Auto-answer: An auto-answer modem enables the computer to receive calls in the
absence of the operator.
IV. Data compression: Some modems perform data compression, which enables them
to send data at faster rates. However, the modem at the receiving end must be able
to decompress the data using the same compression technique.

DEPARTMENT OF ECE Page 47


[Type the document title]

V. Flash memory: Some modems come with flash memory rather than conventional
ROM which means that the communications protocols can be easily updated if
necessary.
VI. Fax capability: Most modern modems are fax modems, which mean that they can
send and receive faxes.

GSM Modem:

A GSM modem is a wireless modem that works with a GSM wireless network. A
wireless modem behaves like a dial-up modem. The main difference between them is that a
dial-up modem sends and receives data through a fixed telephone line while a wireless
modem sends and receives data through radio waves.

A GSM modem can be an external device or a PC Card / PCMCIA Card. Typically,


an external GSM modem is connected to a computer through a serial cable or a USB cable.
A GSM modem in the form of a PC Card / PCMCIA Card is designed for use with a laptop
computer. It should be inserted into one of the PC Card / PCMCIA Card slots of a laptop
computer. Like a GSM mobile phone, a GSM modem requires a SIM card from a wireless
carrier in order to operate.

A SIM card contains the following information:

I. Subscriber telephone number (MSISDN)


II. International subscriber number (IMSI, International Mobile Subscriber Identity)
III. State of the SIM card
IV. Service code (operator)
V. Authentication key
VI. PIN (Personal Identification Code)
VII. PUK (Personal Unlock Code)

DEPARTMENT OF ECE Page 48


[Type the document title]

Computers use AT commands to control modems. Both GSM modems and dial-up
modems support a common set of standard AT commands. In addition to the standard AT
commands, GSM modems support an extended set of AT commands. These extended AT
commands are defined in the GSM standards. With the extended AT commands, the
following operations can be performed:

I. Reading, writing and deleting SMS messages.


II. Sending SMS messages.
III. Monitoring the signal strength.
IV. Monitoring the charging status and charge level of the battery.
V. Reading, writing and searching phone book entries.

The number of SMS messages that can be processed by a GSM modem per minute is very
low i.e., about 6 to 10 SMS messages per minute.

Introduction to AT Commands:

AT commands are instructions used to control a modem. AT is the abbreviation of


ATtention. Every command line starts with "AT" or "at". That's the reason, modem
commands are called AT commands. Many of the commands that are used to control wired
dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO
(Return to online data state) are also supported by GSM modems and mobile phones.

DEPARTMENT OF ECE Page 49


[Type the document title]

Besides this common AT command set, GSM modems and mobile phones support
an AT command set that is specific to the GSM technology, which includes SMS-related
commands like AT+CMGS (Send SMS message), AT+CMSS (Send SMS message from
storage), AT+CMGL (List SMS messages) and AT+CMGR (Read SMS messages).

It should be noted that the starting "AT" is the prefix that informs the modem about
the start of a command line. It is not part of the AT command name. For example, D is the
actual AT command name in ATD and +CMGS is the actual AT command name in
AT+CMGS.

Some of the tasks that can be done using AT commands with a GSM modem or mobile
phone are listed below:

I. Get basic information about the mobile phone or GSM modem. For example, name
of manufacturer (AT+CGMI), model number (AT+CGMM), IMEI number
(International Mobile Equipment Identity) (AT+CGSN) and software version
(AT+CGMR).
II. Get basic information about the subscriber. For example, MSISDN (AT+CNUM)
and IMSI number (International Mobile Subscriber Identity) (AT+CIMI).
III. Get the current status of the mobile phone or GSM/GPRS modem. For example,
mobile phone activity status (AT+CPAS), mobile network registration status
(AT+CREG), radio signal strength (AT+CSQ), battery charge level and battery
charging status (AT+CBC).
IV. Establish a data connection or voice connection to a remote modem (ATD, ATA,
etc).
V. Send and receive fax (ATD, ATA, AT+F*).
VI. Send (AT+CMGS, AT+CMSS), read (AT+CMGR, AT+CMGL), write
(AT+CMGW) or delete (AT+CMGD) SMS messages and obtain notifications of
newly received SMS messages (AT+CNMI).
VII. Read (AT+CPBR), write (AT+CPBW) or search (AT+CPBF) phonebook entries.

DEPARTMENT OF ECE Page 50


[Type the document title]

VIII. Perform security-related tasks, such as opening or closing facility locks


(AT+CLCK), checking whether a facility is locked (AT+CLCK) and changing
passwords(AT+CPWD).
(Facility lock examples: SIM lock [a password must be given to the SIM card every
time the mobile phone is switched on] and PH-SIM lock [a certain SIM card is
associated with the mobile phone. To use other SIM cards with the mobile phone, a
password must be entered.])
IX. Control the presentation of result codes / error messages of AT commands. For
example, the user can control whether to enable certain error messages
(AT+CMEE) and whether error messages should be displayed in numeric format or
verbose format (AT+CMEE=1 or AT+CMEE=2).
X. Get or change the configurations of the mobile phone or GSM/GPRS modem. For
example, change the GSM network (AT+COPS), bearer service type (AT+CBST),
radio link protocol parameters (AT+CRLP), SMS center address (AT+CSCA) and
storage of SMS messages (AT+CPMS).
XI. Save and restore configurations of the mobile phone or GSM/GPRS modem. For
example, save (AT+CSAS) and restore (AT+CRES) settings related to SMS
messaging such as the SMS center address.

It should be noted that the mobile phone manufacturers usually do not implement all
AT commands, command parameters and parameter values in their mobile phones. Also,
the behavior of the implemented AT commands may be different from that defined in the
standard. In general, GSM modems, designed for wireless applications, have better support
of AT commands than ordinary mobile phones.

Basic concepts of SMS technology

1. Validity Period of an SMS Message

An SMS message is stored temporarily in the SMS center if the recipient mobile
phone is offline. It is possible to specify the period after which the SMS message will be

DEPARTMENT OF ECE Page 51


[Type the document title]

deleted from the SMS center so that the SMS message will not be forwarded to the
recipient mobile phone when it becomes online. This period is called the validity period. A
mobile phone should have a menu option that can be used to set the validity period. After
setting it, the mobile phone will include the validity period in the outbound SMS messages
automatically.

2. Message Status Reports

Sometimes the user may want to know whether an SMS message has reached the
recipient mobile phone successfully. To get this information, you need to set a flag in the
SMS message to notify the SMS center that a status report is required about the delivery of
this SMS message. The status report is sent to the user mobile in the form of an SMS
message.

A mobile phone should have a menu option that can be used to set whether the
status report feature is on or off. After setting it, the mobile phone will set the
corresponding flag in the outbound SMS messages for you automatically. The status report
feature is turned off by default on most mobile phones and GSM modems.

3. Message Submission Reports

After leaving the mobile phone, an SMS message goes to the SMS center. When it
reaches the SMS center, the SMS center will send back a message submission report to the
mobile phone to inform whether there are any errors or failures (e.g. incorrect SMS
message format, busy SMS center, etc). If there is no error or failure, the SMS center sends
back a positive submission report to the mobile phone. Otherwise it sends back a negative
submission report to the mobile phone. The mobile phone may then notify the user that the
message submission was failed and what caused the failure.

If the mobile phone does not receive the message submission report after a period of
time, it concludes that the message submission report has been lost. The mobile phone may

DEPARTMENT OF ECE Page 52


[Type the document title]

then send the SMS message again to the SMS center. A flag will be set in the new SMS
message to inform the SMS center that this SMS message has been sent before. If the
previous message submission was successful, the SMS center will ignore the new SMS
message but send back a message submission report to the mobile phone. This mechanism
prevents the sending of the same SMS message to the recipient multiple times.

Sometimes the message submission report mechanism is not used and the
acknowledgement of message submission is done in a lower layer.

4 .Message Delivery Reports

After receiving an SMS message, the recipient mobile phone will send back a
message delivery report to the SMS center to inform whether there are any errors or failures
(example causes: unsupported SMS message format, not enough storage space, etc). This
process is transparent to the mobile user. If there is no error or failure, the recipient mobile
phone sends back a positive delivery report to the SMS center. Otherwise it sends back a
negative delivery report to the SMS center.

If the sender requested a status report earlier, the SMS center sends a status report to
the sender when it receives the message delivery report from the recipient. If the SMS
center does not receive the message delivery report after a period of time, it concludes that
the message delivery report has been lost. The SMS center then ends the SMS message to
the recipient for the second time.

Sometimes the message delivery report mechanism is not used and the
acknowledgement of message delivery is done in a lower layer

Operating principles
All objects with a temperature above absolute zero emit heat energy in the form of
radiation. Usually this radiation isn't visible to the human eye because it radiates at infrared
wavelengths, but it can be detected by electronic devices designed for such a purpose.

DEPARTMENT OF ECE Page 53


[Type the document title]

The term passive in this instance refers to the fact that PIR devices do not generate
or radiate energy for detection purposes. They work entirely by detecting infrared
radiation (radiant heat) emitted by or reflected from objects.

Infrared radiation enters through the front of the sensor, known as the 'sensor face'. At the
core of a PIR sensor is a solid state sensor or set of sensors, made
from pyroelectricmaterials—materials which generate energy when exposed to heat.
Typically, the sensors are approximately 1/4 inch square (40 mm2), and take the form of
a thin film. Materials commonly used in PIR sensors include gallium
nitride (GaN), caesium nitrate (CsNO3), polyvinyl fluorides, derivatives of phenylpyridine,
and cobalt phthalocyanine. The sensor is often manufactured as part of an integrated circuit.

PIR-based motion detector:

A PIR motion detector used to control an outdoor, automatic light.

DEPARTMENT OF ECE Page 54


[Type the document title]

A PIR-based motion detector is used to sense movement of people, animals, or other


objects. They are commonly used in burglar alarms and automatically-
activated lighting systems. They are commonly called simply "PIR", or sometimes "PID",
for "passive infrared detector".

Operation:

An individual PIR sensor detects changes in the amount of infrared radiation


impinging upon it, which varies depending on the temperature and surface characteristics of
the objects in front of the sensor.human passes in front of the background, such as a wall,
the temperature at that point in the sensor's field of view will rise from room
temperature to body temperature, and then back again. The sensor converts the resulting
change in the incoming infrared radiation into a change in the output voltage, and this
triggers the detection. Objects of similar temperature but different surface characteristics
may also have a different infrared emission pattern, and thus moving them with respect to
the background may trigger the detector as well.[3]

PIRs come in many configurations for a wide variety of applications. The most
common models have numerous Fresnel lenses or mirror segments, an effective range of
about ten meters (thirty feet), and a field of view less than 180 degrees. Models with wider
fields of view, including 360 degrees, are available—typically designed to mount on a
ceiling. Some larger PIRs are made with single segment mirrors and can sense changes in
infrared energy over thirty meters (one hundred feet) away from the PIR. There are also
PIRs designed with reversible orientation mirrors which allow either broad coverage (110°
wide) or very narrow "curtain" coverage, or with individually selectable segments to
"shape" the coverage.

Differential detection:

Pairs of sensor elements may be wired as opposite inputs to a differential amplifier.


In such a configuration, the PIR measurements cancel each other so that the average

DEPARTMENT OF ECE Page 55


[Type the document title]

temperature of the field of view is removed from the electrical signal; an increase of IR
energy across the entire sensor is self-cancelling and will not trigger the device. This allows
the device to resist false indications of change in the event of being exposed to brief flashes
of light or field-wide illumination. (Continuous high energy exposure may still be able to
saturate the sensor materials and render the sensor unable to register further information.)
At the same time, this differential arrangement minimizes common-mode interference,
allowing the device to resist triggering due to nearby electric fields. However, a differential
pair of sensors cannot measure temperature in this configuration, and therefore is only
useful for motion detection.

Practical Implementation:

When a PIR sensor is configured in a differential mode, it specifically becomes


applicable as a motion detector device. In this mode when a human movement is detected
within the "line of sight" of the PIR sensor, a pair of complementary pulses are processed at
the output pin of the PIR sensor. In order to implement this output signal for a practical
triggering of a load such as a relay or a data logger, or an alarm, the differential signal is
rectified using a bridge rectifier and fed to a transistorized relay driver circuit. The contacts
of this relay close and open in response to the signals from the PIR, activating the attached
load across its contacts, acknowledging the detection of a human being within the
predetermined restricted area.

Product design:

The PIR sensor is typically mounted on a printed circuit board containing the
necessary electronics required to interpret the signals from the sensor itself. The complete
assembly is usually contained within a housing, mounted in a location where the sensor can
cover area to be monitored.

DEPARTMENT OF ECE Page 56


[Type the document title]

The housing will usually have a plastic "window" through which the infrared energy
can enter. Despite often being only translucent to visible light, infrared energy is able to
reach the sensor through the window because the plastic used is transparent to infrared
radiation. The plastic window reduces the chance of foreign objects (dust, insects, etc.)
from obscuring the sensor's field of view, damaging the mechanism, and/or causing false
alarms. The window may be used as a filter, to limit the wavelengths to 8-14 micrometres,
which is closest to the infrared radiation emitted by humans. It may also serve as a focusing
mechanism; see below.

Focusing

Different mechanisms can be used to focus the distant infrared energy onto the sensor
surface.

Lenses

The plastic window covering may have multiple facets molded into it, to focus the infrared
energy onto the sensor. Each individual facet is a Fresnel lens.

Multi-Fresnel lens type of PIR

DEPARTMENT OF ECE Page 57


[Type the document title]

PIR front cover only, with point light source behind, to show individual lenses.

PIR with front cover removed, showing location of pyroelectric sensor (green arrow).

Mirrors

Some PIRs are manufactured with internal, segmented parabolic mirrors to focus
the infrared energy. Where mirrors are used, the plastic window cover generally has no
Fresnel lenses molded into it.

Segmented mirror type of PIR

Typical residential/commercial PID using an internal segmented mirror for focusing.

DEPARTMENT OF ECE Page 58


[Type the document title]

Cover removed. Segmented mirror at bottom with PC (printed circuit) board above it.

Printed circuit board removed to show segmented mirror.

Segmented parabolic mirror removed from housing.

Rear of circuit board which faces mirror when in place. Pyroelectric sensor indicated by
green arrow.

Security applications

DEPARTMENT OF ECE Page 59


[Type the document title]

When used as part of a security system, the electronics in the PIR typically control a
small relay. This relay completes the circuit across a pair of electrical contacts connected to
a detection input zone of the burglar alarm control panel. The system is usually designed
such that if no motion is being detected, the relay contact is closed—a 'normally closed'
(NC) relay. If motion is detected, the relay will open the circuit, triggering the alarm; or, if
a wire is disconnected, the alarm will also operate.

Placement

Manufacturers recommend careful placement of their products to prevent false


alarms (i.e., any detection not caused by an intruder).They suggest mounting the PIRs in
such a way that the PIR cannot "see" out of a window. Although the wavelength of infrared
radiation to which the chips are sensitive does not penetrate glass very well, a strong
infrared source (such as from a vehicle headlight or sunlight) can overload the sensor and
cause a false alarm. A person moving on the other side of the glass would not be "seen" by
the PID. That may be good for a window facing a public sidewalk, or bad for a window in
an interior partition.

It is also recommended that the PIR not be placed in such a position that
an HVAC vent would blow hot or cold air onto the surface of the plastic which covers the
housing's window. Although air has very low emissivity (emits very small amounts of
infrared energy), the air blowing on the plastic window cover could change the plastic's
temperature enough to trigger a false alarm.Sensors are also often designed to "ignore"
domestic pets, such as dogs or cats, by setting a higher sensitivity threshold, or by ensuring
that the floor of the room remains out of focus.

Since PIR sensors have ranges of up to 10 meters (30 feet), a single detector placed
near the entrance is typically all that is necessary for rooms with only a single entrance.
PIR-based security systems are also viable in outdoor security and motion-sensitive
lighting; one advantage is their low power draw, which allows them to be solar-powered.

DEPARTMENT OF ECE Page 60


[Type the document title]

CHAPTER 4

SOFTWARE DESCRIPTION

Arduino has been used in thousands of different projects and applications. The
Arduino software is easy-to-use for beginners, yet flexible enough for advanced users. It
runs on Mac, Windows, and Linux. Teachers and students use it to build low cost scientific
instruments, to prove chemistry and physics principles, or to get started with programming
and robotics. Designers and architects build interactive prototypes, musicians and artists
use it for installations and to experiment with new musical instruments. Makers, of course,
use it to build many of the projects exhibited at the Maker Faire, for example. Arduino is a
key tool to learn new things. Anyone - children, hobbyists, artists, programmers - can start
tinkering just following the step by step instructions of a kit, or sharing ideas online with
other members of the Arduino community.

There are many other microcontrollers and microcontroller platforms available for
physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's
Handyboard, and many others offer similar functionality. All of these tools take the messy
details of microcontroller programming and wrap it up in an easy-to-use package. Arduino
also simplifies the process of working with microcontrollers, but it offers some advantage
for teachers, students, and interested amateurs over other systems:

i. Inexpensive - Arduino boards are relatively inexpensive compared to other


microcontroller platforms. The least expensive version of the Arduino module can
be assembled by hand, and even the pre-assembled Arduino modules cost less than
$50
ii. Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX,
and Linux operating systems. Most microcontroller systems are limited to
Windows.
iii. Simple, clear programming environment - The Arduino Software (IDE) is easy-to-
use for beginners, yet flexible enough for advanced users to take advantage of as

DEPARTMENT OF ECE Page 61


[Type the document title]

well. For teachers, it's conveniently based on the Processing programming


environment, so students learning to program in that environment will be familiar
with how the Arduino IDE works.
IV. Open source and extensible software - The Arduino software is published as open
source tools, available for extension by experienced programmers. The language can
be expanded through C++ libraries, and people wanting to understand the technical
details can make the leap from Arduino to the AVR C programming language on
which it's based. Similarly, you can add AVR-C code directly into your Arduino
programs if you want to.
V. Open source and extensible hardware - The plans of the Arduino boards are
published under a Creative Commons license, so experienced circuit designers can
make their own version of the module, extending it and improving it. Even relatively
inexperienced users can build the breadboard version of the module in order to
understand how it works and save money.

CODE:
#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>
String apiKey ="RGM5R9JW16DBCSUM"; // Enter your Write API key
from ThingSpeak
const char *ssid = "SRI INDU HUB"; // replace with your wifi ssid and
wpa2 key
const char *pass = "shubsriindu";
const char* server = "api.thingspeak.com";
// Configure software serial port
SoftwareSerial SIM900(D7,D8);//8-gsmtx,7-rx
String textMessage;
WiFiClient client;

DEPARTMENT OF ECE Page 62


[Type the document title]

// defining the pins


const int irpin = D1;
void setup() {
int buzzer=D2;
pinMode(buzzer,OUTPUT);
pinMode(irpin, INPUT); // Sets the gasin as an Input
Serial.begin(19200);
Serial.println("Connecting to ");
Serial.println(ssid)
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("AT+CIFSR\r\n");
delay(1000);
SIM900.begin(19200);
SIM900.print("AT+CMGF=1\r");
delay(100);
// Set module to send SMS data to serial out upon receipt
SIM900.print("AT+CNMI=2,2,0,0,0\r");

DEPARTMENT OF ECE Page 63


[Type the document title]

delay(100);
}
void loop() {
int a=digitalRead(irpin);
// Prints the gas values on the Serial Monitor
if(a>0)
{
textMessage = "OBJECT DETECTED";
digitalWrite(D2,HIGH);
sendSMS(textMessage);
thingspeak();
}
Serial.println(a);
delay(2000);

}
void sendSMS(String message){
// AT command to set SIM900 to SMS mode
SIM900.print("AT+CMGF=1\r");
delay(100);

// REPLACE THE X's WITH THE RECIPIENT'S MOBILE NUMBER


// USE INTERNATIONAL FORMAT CODE FOR MOBILE NUMBERS
SIM900.println("AT + CMGS = \"+919177803232\"");
delay(100);

DEPARTMENT OF ECE Page 64


[Type the document title]

// Send the SMS


SIM900.println(message);
delay(100);

// End AT command with a ^Z, ASCII code 26


SIM900.println((char)26);
delay(100);
SIM900.println();
// Give module time to send SMS
delay(500);
}

void thingspeak()
{
int irpin=digitalRead(D1);
if (client.connect(server,80)) // "184.106.153.149" or api.thingspeak.com
{
String postStr = apiKey;
postStr +="&field1=";
postStr += String(irpin);
postStr += "\r\n\r\n";

client.print("POST /update HTTP/1.1\n");


client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");

DEPARTMENT OF ECE Page 65


[Type the document title]

client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n");
client.print("Content-Type: application/x-www-form-
urlencoded\n");
client.print("Content-Length: ");
client.print(postStr.length());
client.print("\n\n");
client.print(postStr);
Serial.println("Sensor: ");
Serial.println(irpin);
}
client.stop();

Serial.println("Waiting...");

// thingspeak needs minimum 15 sec delay between updates, i've set it to 30


seconds
delay(10000);
}

DEPARTMENT OF ECE Page 66


[Type the document title]

CHAPTER 5
CONCLUSION

By this project, it will be a great help indeed to rescuers in detection of human


beings at the disaster sites. This is also user-friendly, economical and efficient device using
software programming interface for detection. This proposed system will be a combination
of a stationary and a mobile robot system especially for disaster affected chaotic areas.
Many lives can be saved by using this autonomous vehicle during an earthquake disaster in
a short duration which becomes time consuming and unaffected if done manually. This
vehicle can be improved by using high range sensors and high capacity motors. Some more
sensors like mobile phone detector, metal detector etc. can be implemented to make this
vehicle more effective.

FUTURE SCOPE:

Human detection is to provide more security for the users to protect their belongings
from robbers. The robot can move in all the directions automatically without controlling it,
which makes the system more effective to use. As the system can move, it covers lot of
distance that reduces the use of many sensors or many robots.When the Robot finds a
human it can notify the users by producing continuous beeps.

The Robot can be modified further by attaching a visual camera where the image of
the intruder can be notified. If the robot is attached with SONAR (Sound Navigation And
Ranging) it can determine the distance between the human and can detect the IR image of
the object.

DEPARTMENT OF ECE Page 67


[Type the document title]

REFERENCES:
[1] Fahed Awad, Rufaida Shamroukh “Human Detection by Robotic Urban Search
and Rescue Using Image Processing and Neural Networks” International Journal of
Intelligence Science, 2014, PP. 4, 39-53.

[2] Chris Cappello, Chad Olsen, Mike Auen “Remote Operated and Controlled
Hexapod (ROACH) Robot, Rescue Robot League Competition Atlanta, Georgia,
USA May 7 – 10, 2005.

[3] R. Fuksis, M. Greitans, E. Hermanis “Motion Analysis and Remote Control


System using Pyroelectric Infrared Sensors” IEEE, 2008. No. 6(86), PP. 69-72.

[4] Amerada, T., Yams, T., Igarashit, H., & Matsunos, F. “Development of the
Snake-like Rescue Robot KOHGA” IEEE, 2004, PP. 5081- 5086.

[5] Sandeep Bhatia, Ajay Mudgil and Amita Soni “Alive Human Detection Using
an Autonomous Mobile Rescue Robot”, Department of Electrical And Electronics,
PEC University of Technology, Chandigarh, India Vol. 02, July 2010.

DEPARTMENT OF ECE Page 68

Potrebbero piacerti anche