Mini Project Doc

97
Mini Project Report on PIR Sensor Based Intrusion Detection System CHAPTER-1 1.INTRODUCTION 1.1 Introduction to the Project This chapter is going to introduce about the physical devices those are microcontroller, embedded systems which are being used by the designers to mould the circuit for the desired output and those are illustrated below. We are implementing our project in Embedded systems. Embedded system means it is the combination of Software and Hardware that is designed with a small computer which performs a specific task. For this project we are writing the code in PIC COMPILER and dumping the program using PIC 2 kit software. We are implementing the circuit diagram using PCB WIZARD and this PCB board is designed using EXPRESS PCB. This project PIR SENSOR BASED INTRUSION DETECTION SYSTEM is an Embedded type project .We knows that embedded system is a fast emerging technology, It is a system which performs a single task using both software and hardware. VITS-Karimnagar 1 B.TECH(ECE)

description

PIR SENSOR

Transcript of Mini Project Doc

Page 1: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

CHAPTER-1

1. INTRODUCTION

1.1 Introduction to the Project

This chapter is going to introduce about the physical devices those are microcontroller,

embedded systems which are being used by the designers to mould the circuit for the

desired output and those are illustrated below.

We are implementing our project in Embedded systems. Embedded system

means it is the combination of Software and Hardware that is designed with a small

computer which performs a specific task.

For this project we are writing the code in PIC COMPILER and dumping the program

using PIC 2 kit software.

We are implementing the circuit diagram using PCB WIZARD and this PCB board is

designed using EXPRESS PCB.

This project PIR SENSOR BASED INTRUSION DETECTION SYSTEM is an

Embedded type project .We knows that embedded system is a fast emerging technology,

It is a system which performs a single task using both software and hardware.

The purpose of this project is to provide a home security system using PIR sensor. This

system facilitates the house owners to monitor their home. This system comprises of a

Microcontroller based monitoring system along with PIR (Passive Infrared) based

presence of human beings (thieves). Whenever an un-authorized entry is done, this

system gives Buzzer alerts to the house owner.

VITS-Karimnagar 1 B.TECH(ECE)

Page 2: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

1.2 Circuit diagram of the project

Figure 1: PIR Sensor Based Intrusion Detection System

VITS-Karimnagar 2 B.TECH(ECE)

Page 3: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

1.3. EMBEDDED SYSTEMS

       An embedded system is a computer system designed to perform one or a few

dedicated functions often with real-time computing constraints. It is embedded as part of

a complete device often including hardware and mechanical parts. By contrast, a general-

purpose computer, such as a personal computer (PC), is designed to be flexible and to

meet a wide range of end-user needs. Embedded systems control many devices in

common use today.

Embedded systems are controlled by one or more main processing cores that are

typically either microcontrollers or digital signal processors (DSP). The key

characteristic, however, is being dedicated to handle a particular task, which may require

very powerful processors. For example, air traffic control systems may usefully be

viewed as embedded, even though they involve mainframe computers and dedicated

regional and national networks between airports and radar sites. (Each radar probably

includes one or more embedded systems of its own.)

Since the embedded system is dedicated to specific tasks, design engineers can optimize

it to reduce the size and cost of the product and increase the reliability and performance.

Some embedded systems are mass-produced, benefiting from economies of scale.

Physically embedded systems range from portable devices such as digital watches and

MP3 players, to large stationary installations like traffic lights, factory controllers, or the

systems controlling nuclear power plants. Complexity varies from low, with a single

microcontroller chip, to very high with multiple units, peripherals and networks mounted

inside a large chassis or enclosure.

In general, "embedded system" is not a strictly definable term, as most systems have

some element of extensibility or programmability. For example, handheld computers

VITS-Karimnagar 3 B.TECH(ECE)

Page 4: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

share some elements with embedded systems such as the operating systems and

microprocessors which power them, but they allow different applications to be loaded

and peripherals to be connected. Moreover, even systems which don't expose

programmability as a primary feature generally need to support software updates. On a

continuum from "general purpose" to "embedded", large application systems will have

subcomponents at most points even if the system as a whole is "designed to perform one

or a few dedicated functions", and is thus appropriate to call "embedded".

Real Time Issues:

Embedded systems frequently control hardware, and must be able to respond to them in

real time. Failure to do so could cause inaccuracy in measurements, or even damage

hardware such as motors. This is made even more difficult by the lack of resources

available. Almost all embedded systems need to be able to prioritize some tasks over

others, and to be able to put off/skip low priority tasks such as UI in favor of high priority

tasks like hardware control.

Need For Embedded Systems:

The uses of embedded systems are virtually limitless, because every day new products

are introduced to the market that utilizes embedded computers in novel ways. In recent

years, hardware such as microprocessors, microcontrollers, and FPGA chips have

become much cheaper. So when implementing a new form of control, it's wiser to just

buy the generic chip and write your own custom software for it. Producing a custom-

made chip to handle a particular task or set of tasks costs far more time and money. Many

embedded computers even come with extensive libraries, so that "writing your own

software" becomes a very trivial task indeed. From an implementation viewpoint, there is

a major difference between a computer and an embedded system. Embedded systems are

often required to provide Real-Time response. The main elements that make embedded

systems unique are its reliability and ease in debugging. 

Debugging:

VITS-Karimnagar 4 B.TECH(ECE)

Page 5: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

   Embedded debugging may be performed at different levels, depending on the facilities

available. From simplest to most sophisticate they can be roughly grouped into the

following areas: Interactive resident debugging, using the simple shell provided by the

embedded operating system (e.g. Forth and Basic) External debugging using logging or

serial port output to trace operation using either a monitor in flash or using a debug server

like the Remedy Debugger which even works for heterogeneous multi core systems.

heterogeneous multi core systems.

An in-circuit debugger (ICD), a hardware device that connects to the microprocessor via

a JTAG or Nexus interface. This allows the operation of the microprocessor to be

controlled externally, but is typically restricted to specific debugging capabilities in the

processor.

An in-circuit emulator replaces the microprocessor with a simulated equivalent,

providing full control over all aspects of the microprocessor.

A complete emulator provides a simulation of all aspects of the hardware, allowing all of

it to be controlled and modified and allowing debugging on a normal PC.

Unless restricted to external debugging, the programmer can typically load and run

software through the tools, view the code running in the processor, and start or stop its

operation. The view of the code may be as assembly code or source-code.

Because an embedded system is often composed of a wide variety of elements, the

debugging strategy may vary. For instance, debugging a software(and microprocessor)

centric embedded system is different from debugging an embedded system where most of

the processing is performed by peripherals (DSP, FPGA, co-processor). An increasing

number of embedded systems today use more than one single processor core. In such a

case, the embedded system design may wish to check the data traffic on the busses

between the processor cores, which requires very low-level debugging, at signal/bus

level, with a logic analyzer, for instance. 

Reliability:

VITS-Karimnagar 5 B.TECH(ECE)

Page 6: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Embedded systems often reside in machines that are expected to run continuously for

years without errors and in some cases recover by them if an error occurs. Therefore the

software is usually developed and tested more carefully than that for personal computers,

and unreliable mechanical moving parts such as disk drives, switches or buttons are

avoided.

Specific reliability issues may include:

The system cannot safely be shut down for repair, or it is too inaccessible to repair.

Examples include space systems, undersea cables, navigational beacons, bore-hole

systems, and automobiles.

The system must be kept running for safety reasons. "Limp modes" are less tolerable.

Often backup s are selected by an operator. Examples include aircraft navigation, reactor

control systems, safety-critical chemical factory controls, train signals, engines on single-

engine aircraft.

The system will lose large amounts of money when shut down: Telephone switches,

factory controls, bridge and elevator controls, funds transfer and market making,

automated sales and service.

Watchdog timer that resets the computer unless the software periodically notifies the

watchdog

Designing with a Trusted Computing Base (TCB) architecture[6] ensures a highly secure

& reliable system environment

An Embedded Hypervisor is able to provide secure encapsulation for any subsystem

component, so that a compromised software component cannot interfere with other

subsystems, or privileged-level system software. This encapsulation keeps faults from

propagating from one subsystem to another, improving reliability. This may also allow a

subsystem to be automatically shut down and restarted on fault detection.

1.3.1. APPLICATIONS OF EMBEDDED SYSTEMS:

VITS-Karimnagar 6 B.TECH(ECE)

Page 7: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Consumer applications:

At home we use a number of embedded systems which include microwave oven, remote

control, vcd players, DVD players, camera etc….

Office automation:

We use systems like fax machine, modem, printer etc…

Industrial automation:

Today a lot of industries are using embedded systems for process control. In industries

we design the embedded systems to perform a specific operation like monitoring

temperature, pressure, humidity ,voltage, current etc.., and basing on these monitored

levels we do control other devices, we can send information to a centralized monitoring

station.

Computer networking:                                

Embedded systems are used as bridges routers etc…

Tele communications:

Cell phones, web cameras etc.

1.3.2. CATEGORIES OF EMBEDDED SYSTEMS

Based on performance, functionality, requirement the embedded systems are divided into

three categories:

1. Stand Alone Embedded systems:

These systems takes the input in the form of electrical signals from transducers or

commands from human beings such as pressing of a button etc.., process them and

produces desired o/p.This entire process of taking input, processing it and giving output

is done in stand alone mode. Such embedded systems comes under stand alone embedded

systems

e.g.: microwave oven, air conditioner etc..,

VITS-Karimnagar 7 B.TECH(ECE)

Page 8: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

2. Real-time embedded systems:

Embedded systems which are used to perform a specific task or operation in a specific

time period those systems are called as real-time embedded systems.

There are two types of real-time embedded systems:

(i)Hard Real-time embedded systems:

These embedded systems follow an absolute dead line time period

i.e.., if the tasking is not done in a particular time period then there is a cause of damage

to the entire equipment

e.g.: consider a system in which we have to open a valve within 30 milliseconds. If this

valve is not opened in 30 ms this may cause damage to the entire equipment. So in such

cases we use embedded systems for doing automatic operations.

(ii)Soft Real Time embedded systems:

These embedded systems follow a relative dead line time period i.e.., if the task is not

done in a particular time that will not cause damage to the equipment.

e.g: Consider a TV remote control system ,if the remote control takes a few milliseconds

delay it will not cause damage either to the TV or to the remote control.

3. Network communication embedded systems:

A wide range network interfacing communication is provided by using embedded

systems.

e.g:

a) consider a web camera that is connected to the computer with internet can be used to

spread communication like sending pictures, images, videos etc.., to another computer

with internet connection through out anywhere in the world.

b)Consider a web camera that is connected at the door lock.Whenever a person comes

near the door, it captures the image of a person and sends to the desktop of your computer

which is connected to internet.

CHAPTER-2

2. DESIGN ANALYSIS

VITS-Karimnagar 8 B.TECH(ECE)

Page 9: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

2.1. Block Diagram

PIR Sensor based Intrusion Detection System

Micro controller

Regulated power supply

CrystalOscillator

Buzzerdriver

PIRsensor

Reset

Buzzer

LED indicator

Fig.2.1: Block Diagram

The main blocks of this project are: 

Micro controller (16F72)

Reset button

Crystal oscillator

Regulated power supply

Led indicator

PIR sensor module

2,2. Schematic Diagram

VITS-Karimnagar 9 B.TECH(ECE)

Page 10: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Fig.2.2: Schematic Diagram

Description:

The above schematic diagram of PIR based energy conservation system explains the

interfacing section of each component with micro controller and PIR sensor module. The

crystal oscillator connected to 9th and 10th pins of micro controller and regulated power

supply is also connected to micro controller and LED’s also connected to micro

controller through resistors

 The detailed explanation of each module interfacing with microcontroller is as follows:

Interfacing crystal oscillator with micro controller:

VITS-Karimnagar 10 B.TECH(ECE)

Page 11: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

 The crystal oscillator and reset button are connected to micro controller. The two pins of

oscillator are connected to the 9th and 10th pins of micro controller; the purpose of

external crystal oscillator is to speed up the execution part of instructions per cycle and

here the crystal oscillator having 20 MHz frequency. The 1st pin of the microcontroller is

referred as MCLR ie.., master clear pin or reset input pin is connected to reset button or

power-on-reset.

LED stands for Light Emitting Diode and these are connected to micro controller through

resistors.   

 

                     

CHAPTER-3

VITS-Karimnagar 11 B.TECH(ECE)

Page 12: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

3. HARDWARE DESCRIPTION

3.1. Regulated Power Supply

The basic circuit diagram of a regulated power supply (DC O/P) with led connected as load is shown in fig:

fig 3.1: Block Diagram of Regulated Power Supply

The components mainly used in above figure are

230V AC Mains

Transformer

Bridge Rectifier(diodes)

Capacitor

Voltage Regulator (IC 7805)

Resistor

LED(Light Emitting Diode)

From the above fig 3.1. TRANSFORMER is the first section of the regulated power

supply. The transformer step up or step down the input line voltage and isolates the

power supply from the power line. The RECTIFIER section converts the alternating

current input signal to a pulsating direct current. For this reason a FILTER section is used

3.2. Rectifiers

VITS-Karimnagar 12 B.TECH(ECE)

Page 13: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

A rectifier is an electrical device that converts alternating current (AC) to direct current

(DC), a process known as rectification. Rectifiers have many uses including as

components of power supplies and as detectors of radio signals. Rectifiers may be made

of solid-state diodes, vacuum tube diodes, mercury arc valves, and other components.

A device that it can perform the opposite function (converting DC to AC) is known

as an inverter. When only one diode is used to rectify AC (by blocking the negative or

positive portion of the waveform), the difference between the term diode and the term

rectifier is merely one of usage, i.e., the term rectifier describes a diode that is being used

to convert AC to DC. Almost all rectifiers comprise a number of diodes in a specific

arrangement for more efficiently converting AC to DC than is possible with only one

diode. Before the development of silicon semiconductor rectifiers, vacuum tube diodes

and copper (I) oxide or selenium rectifier stacks were used.

Half-wave rectification:

In half wave rectification, either the positive or negative half of the AC wave is passed,

while the other half is blocked. Because only one half of the input waveform reaches the

output, it is very inefficient if used for power transfer. Half-wave rectification can be

achieved with a single diode in a one-phase supply, or with three diodes in a three-phase

supply.

Input Out

fig.3.2: Half wave rectifier

VITS-Karimnagar 13 B.TECH(ECE)

Page 14: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

The output DC voltage of a half wave rectifier can be calculated with the following two

ideal equations.

Full wave rectifier:

Full wave rectifier is available in two ways like center-tapped full-wave rectifier and

bridge full-wave rectifier.

The Bridge rectifier is a circuit, which converts an ac voltage to dc voltage using both

half cycles of the input ac voltage. The Bridge rectifier circuit is shown in the figure. The

circuit has four diodes connected to form a bridge. The ac input voltage is applied to the

diagonally opposite ends of the bridge. The load resistance is connected between the

other two ends of the bridge.

For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct, whereas

diodes D2 and D4 remain in the OFF state. The conducting diodes will be in series with

the load resistance RL and hence the load current flows through RL.

For the negative half cycle of the input ac voltage, diodes D2 and D4 conduct whereas,

D1 and D3 remain OFF. The conducting diodes D2 and D4 will be in series with the load

resistance RL and hence the current flows through RL in the same direction as in the

previous half cycle. Thus a bi-directional wave is converted into a unidirectional wave.

VITS-Karimnagar 14 B.TECH(ECE)

Page 15: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Input Output

Fig 3.3: Bridge Rectifier- a full-wave rectifier using 4 diodes

Center Tapped Full wave rectifier:

For single-phase AC, if the transformer is center-tapped, then two diodes back-to-back

(i.e. anodes-to-anode or cathode-to-cathode) can form a full-wave rectifier. Twice as

many windings are required on the transformer secondary to obtain the same output

voltage compared to the bridge rectifier above.

For the positive half cycle of the input ac voltage, diodes D1 will conducts, whereas

diodes D2 is in the OFF state. The conducting diodes D1 will be in series with the load

resistance RL and hence the load current flows through RL.

For the negative half cycle of the input ac voltage, diodes D2 will conduct, whereas

diodes D1 is in the OFF state.

Input Output

Fig 3.4: Center tapped Full-wave rectifier using a transformer and 2 diodes.

VITS-Karimnagar 15 B.TECH(ECE)

Page 16: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

3.3 Battery:

Generally we use the transformer in power supply, but here for easy of

carrying we are using a 9 volts battery that is connect in series with input connection.

Battery is an electronic material which stores the current. so, here we ae using a 9 volts

battery as a input supply.

3.4. Filters

Filtration:

 The process of converting a pulsating direct current to a pure direct current using filters

is called as filtration.

Capacitor Filter:

The simple capacitor filter is the most basic type of power supply filter. The application

of the simple capacitor filter is very limited. It is sometimes used on extremely high-

voltage, low-current power supplies for cathode-ray and similar electron tubes, which

require very little load current from the supply. The capacitor filter is also used where the

power-supply ripple frequency is not critical; this frequency can be relatively high. The

capacitor (C1) shown in figure 4-15 is a simple filter connected across the output of the

rectifier in parallel with the load.

VITS-Karimnagar 16 B.TECH(ECE)

Page 17: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Figure 3.5: - Full-wave rectifier with a capacitor filter

When this filter is used, the RC charge time of the filter capacitor (C1) must be short and

the RC discharge time must be long to eliminate ripple action. In other words, the

capacitor must charge up fast, preferably with no discharge at all. Better filtering also

results when the input frequency is high; therefore, the full-wave rectifier output is easier

to filter than that of the half-wave rectifier because of its higher frequency.

For you to have a better understanding of the effect that filtering has on E avg, a

comparison of a rectifier circuit with a filter and one without a filter is illustrated in views

A and B of figure3.7. The output waveforms in figure 3.7 represent the unfiltered and

filtered outputs of the half-wave rectifier circuit. Current pulses flow through the load

resistance (RL) each time a diode conducts. The dashed line indicates the average value of

output voltage. For the half-wave rectifier, Eavg is less than half (or approximately 0.318)

of the peak output voltage. This value is still much less than that of the applied voltage.

With no capacitor connected across the output of the rectifier circuit, the waveform in

view A gas a large pulsating component (ripple) compared with the average or dc

component. When a capacitor is connected across the output (view B), the average value

of output voltage (Eavg) is increased due to the filtering action of capacitor C1.

UNFILTERED

VITS-Karimnagar 17 B.TECH(ECE)

Page 18: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Figure3.6a. - Half-wave rectifier with and without filtering

FILTERED

Figure 3.6b- Half-wave rectifier with and with filtering

The value of the capacitor is fairly large (several microfarads), thus it presents a

relatively low reactance to the pulsating current and it stores a substantial charge. The

rate of charge for the capacitor is limited only by the resistance of the conducting diode

which is relatively low. Therefore, the RC charge time of the circuit is relatively short.

As a result, when the pulsating voltage is first applied to the circuit, the capacitor charges

rapidly and almost reaches the peak value of the rectified voltage within the first few

cycles. The capacitor attempts to charge to the peak value of the rectified voltage anytime

a diode is conducting, and tends to retain its charge when the rectifier output falls to zero.

(The capacitor cannot discharge immediately.) The capacitor slowly discharges through

the load resistance (RL) during the time the rectifier is no conducting.

The rate of discharge of the capacitor is determined by the value of capacitance and the

value of the load resistance. If the capacitance and load-resistance values are large, the

RC discharge time for the circuit is relatively long.

VITS-Karimnagar 18 B.TECH(ECE)

Page 19: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

A comparison of the waveforms shown in figure 3.7 (view A and view B) illustrates that

the addition of C1 to the circuit results in an increase in the average of the output voltage

(Eavg) and a reduction in the amplitude of the ripple component (Er) which is normally

present across the load resistance.

Now, let's consider a complete cycle of operation using a half-wave rectifier, a capacitive

filter (C1), and a load resistor (RL). As shown in view A of figure 3.8, the capacitive filter

(C1) is assumed to be large enough to ensure a small reactance to the pulsating rectified

current. The resistance of RL is assumed to be much greater than the reactance of C1 at

the input frequency. When the circuit is energized, the diode conducts on the positive half

cycle and current flows through the circuit, allowing C1 to charge. C1 will charge to

approximately the peak value of the input voltage. (The charge is less than the peak value

because of the voltage drop across the diode (D1)). In view A of the figure, the charge on

C1 is indicated by the heavy solid line on the waveform. As illustrated in view B, the

diode cannot conduct on the negative half cycle because the anode of D1 is negative with

respect to the cathode. During this interval, C1 discharges through the load resistor (RL).

The discharge of C1 produces the downward slope as indicated by the solid line on the

waveform in view B. In contrast to the abrupt fall of the applied ac voltage from peak

value to zero, the voltage across C1 (and thus across RL) during the discharge period

gradually decreases until the time of the next half cycle of rectifier operation. Keep in

mind that for good filtering, the filter capacitor should charge up as fast as possible and

discharge as little as possible.

POSITIVE HALF-CYCLE

VITS-Karimnagar 19 B.TECH(ECE)

Page 20: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Figure 3.7a. - Capacitor filter circuit (positive and negative half cycles).

NEGATIVE HALF-CYCLE

Figure 3.7b. - Capacitor filter circuit (positive and negative half cycles).

VITS-Karimnagar 20 B.TECH(ECE)

Page 21: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Since practical values of C1 and RL ensure a more or less gradual decrease of the

discharge voltage, a substantial charge remains on the capacitor at the time of the next

half cycle of operation. As a result, no current can flow through the diode until the rising

ac input voltage at the anode of the diode exceeds the voltage on the charge remaining on

C1. The charge on C1 is the cathode potential of the diode. When the potential on the

anode exceeds the potential on the cathode (the charge on C1), the diode again conducts

and C1 begins to charge to approximately the peak value of the applied voltage.

After the capacitor has charged to its peak value, the diode will cut off and the capacitor

will start to discharge. Since the fall of the ac input voltage on the anode is considerably

more rapid than the decrease on the capacitor voltage, the cathode quickly become more

positive than the anode, and the diode ceases to conduct.

Operation of the simple capacitor filter using a full-wave rectifier is basically the same as

that discussed for the half-wave rectifier. Referring to figure 3.9, you should notice that

because one of the diodes is always conducting on. either alternation, the filter capacitor

charges and discharges during each half cycle. (Note that each diode conducts only for

that portion of time when the peak secondary voltage is greater than the charge across the

capacitor.)

Figure 3.8- Full-wave rectifier (with

capacitor filter).

The ac component is therefore bypassed

(shunted) around the load resistance, and the

entire dc component (or Eavg) flows through

the load resistance. This statement can be

clarified by using the formula for XC in a

half-wave and full-wave rectifier. First, you

must establish some values for the

circuit.

VITS-Karimnagar 21 B.TECH(ECE)

Page 22: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

As you can see from the calculations, by doubling the frequency of the rectifier, you

reduce the impedance of the capacitor by one-half. This allows the ac component to pass

through the capacitor more easily. As a result, a full-wave rectifier output is much easier

VITS-Karimnagar 22 B.TECH(ECE)

Page 23: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

to filter than that of a half-wave rectifier. Remember, the smaller the XC of the filter

capacitor with respect to the load resistance, the better the filtering action. Since

the largest possible capacitor will provide the best filtering.

Remember, also, that the load resistance is an important consideration. If load resistance

is made small, the load current increases, and the average value of output voltage (Eavg)

decreases. The RC discharge time constant is a direct function of the value of the load

resistance; therefore, the rate of capacitor voltage discharge is a direct function of the

current through the load. The greater the load current, the more rapid the discharge of the

capacitor, and the lower the average value of output voltage. For this reason, the simple

capacitive filter is seldom used with rectifier circuits that must supply a relatively large

load current. Using the simple capacitive filter in conjunction with a full-wave or bridge

rectifier provides improved filtering because the increased ripple frequency decreases the

capacitive reactance of the filter capacitor.

3.5. Regulator

Regulation:

          The process of converting a varying voltage to a constant

regulated voltage is called as regulation. For the process of regulation we use voltage

regulators.

Voltage Regulator:

 A voltage regulator (also called a ‘regulator’) with only three terminals appears to be a

simple device, but it is in fact a very complex integrated circuit. It converts a varying

input voltage into a constant ‘regulated’ output voltage. Voltage Regulators are available

in a variety of outputs like 5V, 6V, 9V, 12V and 15V. The LM78XX series of voltage

VITS-Karimnagar 23 B.TECH(ECE)

Page 24: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

regulators are designed for positive input. For applications requiring negative input, the

LM79XX series is used. Using a pair of ‘voltage-divider’ resistors can increase the output

voltage of a regulator circuit.

fig3.9: Regulator

            It is not possible to obtain a voltage lower than the stated rating. You cannot use a

12V regulator to make a 5V power supply. Voltage regulators are very robust. These can

withstand over-current draw due to short circuits and also over-heating. In both cases, the

regulator will cut off before any damage occurs. The only way to destroy a regulator is to

apply reverse voltage to its input. Reverse polarity destroys the regulator almost instantly.

  A resistor is a two-terminal electronic component that produces a voltage across its

terminals that is proportional to the electric current passing through it in accordance with

Ohm's law:

V = IR

Resistors are elements of electrical networks and electronic circuits and are ubiquitous in

most electronic equipment. Practical resistors can be made of various compounds and

films, as well as resistance wire (wire made of a high-resistivity alloy, such as

nickel/chrome).

Variable Voltage Regulator:

The LM117 series of adjustable 3-terminal positive voltage regulators is capable of

supplying in excess of 1.5A over a 1.2V to 37V output range. They are exceptionally

VITS-Karimnagar 24 B.TECH(ECE)

Page 25: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

easy to use and require only two external resistors to set the output voltage. Further, both

line and load regulations are better than standard fixed regulators. Also, the LM117 is

packaged in standard transistor packages, which are easily mounted and handled.

In addition to higher performance than fixed regulators, the LM117 series offers full

overload protection available only in IC's. Included on the chip are current limit, thermal

overload protection and safe area protection. All overload protection circuitry remains

fully functional even if the adjustment terminal is disconnected.

Normally, no capacitors are needed unless the device is situated more than 6 inches from

the input filter capacitors in which case an input bypass is needed. An optional output

capacitor can be added to improve transient response. The adjustment terminal can be

bypassed to achieve very high ripple rejection ratios, which are difficult to achieve with

standard 3-terminal regulators.

Besides replacing fixed regulators, the LM117 is useful in a wide variety of other

applications. Since the regulator is “floating” and sees only the input-to-output

differential voltage, supplies of several hundred volts can be regulated as long as the

maximum input to output differential is not exceeded, i.e., avoid short-circuiting the

output.

Also, it makes an especially simple adjustable switching regulator, a programmable

output regulator, or by connecting a fixed resistor between the adjustment pin and output,

the LM117 can be used as a precision current regulator. Supplies with electronic

shutdown can be achieved by clamping the adjustment terminal to ground, which

programs the output to 1.2V where most loads draw little current.

The primary characteristics of a resistor are the resistance, the tolerance, maximum

working voltage and the power rating. Other characteristics include temperature

coefficient, noise, and inductance. Less well-known is critical resistance, the value below

which power dissipation limits the maximum permitted current flow, and above which

the limit is applied voltage. Critical resistance is determined by the design, materials and

dimensions of the resistor.

VITS-Karimnagar 25 B.TECH(ECE)

Page 26: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Resistors can be made to control the flow of current, to work as Voltage dividers,

to dissipate power and it can shape electrical waves when used in combination of other

components. Basic unit is ohms.

3.6. LED:

LED stands for Light Emitting Diode, which are for flashlights

Working:

The structure of the LED light is completely different than that of the light bulb.

Amazingly, the LED has a simple and strong structure. The beauty of the structure is that

it is designed to be versatile, allowing for assembly into many different shapes. The light-

emitting semiconductor material is what determines the LED's color.

As indicated by its name, the LED is a diode that emits light. A diode is a device that

allows current to flow in only one direction. Almost any two conductive materials will

form a diode when placed in contact with each other. When electricity is passed through

the diode the atoms in one material (within the semiconductor chip) are excited to a

higher energy level. The atoms in that first material have too much energy and need to

release that energy. The energy is then released as the atoms shed electrons to the other

material within the chip. During this energy release light is created. The color of the light

from the LED is a function of the ingredients (materials) and recipes (processes) that

make up the chip.

LED lights have a variety of advantages over other light sources:

High-levels of brightness and intensity

High-efficiency

Low-voltage and current requirements

Low radiated heat

High reliability (resistant to shock and vibration)

No UV Rays

VITS-Karimnagar 26 B.TECH(ECE)

Page 27: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Long source life

Can be easily controlled and programmed

Over the past decade, LED technology has advanced at light speed. In the past, lack of

colors and the low intensity made LED’s useful only as indicator lights. As

manufacturing methods and technology improved, the LED quickly found homes in more

and more applications. These days, the LED is becoming a preferred light source for

many more than simple indicators.

LED light sources are also gaining popularity due to the growing energy conservation

movement. According to the U.S. Department Energy, no other lighting technology

offers as much potential to save energy and enhance the quality of our building

environments.

Types

LEDs are produced in a variety of shapes and sizes. The 5 mm cylindrical package (red,

fifth from the left) is the most common, estimated at 80% of world production. The color

of the plastic lens is often the same as the actual color of light emitted, but not always.

For instance, purple plastic is often used for infrared LEDs, and most blue devices have

VITS-Karimnagar 27 B.TECH(ECE)

Page 28: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

clear housings. There are also LEDs in SMT packages, such as those found on blinkies

and on cell phone keypads (not shown).

The main types of LEDs are miniature, high power devices and custom designs such as

alphanumeric or multi-color.

Miniature LEDs

Different sized LEDs. 8 mm, 5 mm and 3 mm, with a wooden match-stick for scale.

Main article: Miniature light-emitting diode

These are mostly single-die LEDs used as indicators, and they come in various-sizes from

2 mm to 8 mm, through-hole and surface mount packages. They are usually simple in

design, not requiring any separate cooling body. Typical current ratings range from

around 1 mA to above 20 mA. The small scale sets a natural upper boundary on power

consumption due to heat caused by the high current density and need for heat sinking.

High power LEDs

See also: Solid-state lighting and LED lamp

VITS-Karimnagar 28 B.TECH(ECE)

Page 29: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

High power LEDs from Philips Lumileds Lighting Company mounted on a 21 mm star

shaped base metal core PCB

High power LEDs (HPLED) can be driven at currents from hundreds of mA to more than

an ampere, compared with the tens of mA for other LEDs. They produce up to over a

thousand lumens. Since overheating is destructive, the HPLEDs must be mounted on a

heat sink to allow for heat dissipation. If the heat from a HPLED is not removed, the

device will burn out in seconds. A single HPLED can often replace an incandescent bulb

in a flashlight, or be set in an array to form a powerful LED lamp.

There are two basic types of circuits: Series and Parallel?"

When LEDs are placed in a series, the voltage is dispersed between the LEDs, meaning

less voltage goes to each LED. This can be very useful. For example, if a 12 volt adapter

were powering one LED, there'd be 12V going through that LED which is way too much

for any LED to handle and would result in a rather unpleasant burning smell.

However, if you take that same 12V power source and put 4 LEDs in series, there would

be 3V going to each LED and (assuming the LEDs are made to run off 3V) each would

be powered and just dandy. Check out this illustration:

VITS-Karimnagar 29 B.TECH(ECE)

Page 30: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

It's important to notice how the LED’s are positioned: (-) (+), (-) (+), etc. making sure

that the end (-) connects to the (-) wire and the end (+) connects to the (+) wire, if any

LED’s are backwards nothing bad will happen, they just won't turn on.

If three LED’s were in series with a 12V source, each would receive 4V, if six were in

series, each would receive 2V, etc.

Let's say you wanted to power three of your brand new LEDs off a 3V battery pack (two

1.5V AA's in series, make sense?) you found lying around. If you were to series the three

LEDs there'd be 1V going to each (3 Volts / 3 LEDs = 1V for each LED). That's not

enough to power your LEDs! You want them to have the full 3V going to each. Here's

how:

VITS-Karimnagar 30 B.TECH(ECE)

Page 31: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

How this works is that while every LED receives the same amount of voltage, the current

of the source is dispersed between the LEDs. What this means for you is that you have 20

LEDs paralleled off a battery, it's going to drain the battery a lot quicker than if you only

had 2 LEDs in parallel. If you're paralleling off a wall adapter, for instance though, the

source can constantly renew itself so you can essentially parallel as many as you'd like

without fear of draining the wall.

To use resistors in a parallel circuit, say if you'd like each LED above to receive 2.5V

instead of 3V, use an LED calculator (make sure you're in the parallel section) to find the

right ohm age and then stick it somewhere in the circuit!

If you mix colors, say if you paralleled a red (~2.3V) and two blue (~3.5V), the blue

LEDs would not light. Why's this? Because the electricity is going to take the easiest path

it can to complete the circuit and in this scenario the red LED requires less energy,

leaving the two blue un-powered and lonely. To fix this you would need to stick a resistor

onto the leg of each LED to 'equalize' all of the LEDs. Note illustration:

VITS-Karimnagar 31 B.TECH(ECE)

Page 32: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

To find the resistor you'd need for each LED, use the 'Single LED' portion of an LED

calculator, type in the supply voltage, LED's voltage and 20mA for each LED and there

you go. Now each LED will turn on and each will receive it's desired amount of power.

Thanks to Mike Moore’s for pointing this out, "The resistors act like 'shocks' in a car,

they give the power source some 'squish' and let each LED find its happy place (forward

voltage)."

Advantages

Efficiency: LEDs produce more light per watt than incandescent bulbs.

Color: LEDs can emit light of an intended color without the use of color filters

that traditional lighting methods require. This is more efficient and can lower

initial costs.

Size: LEDs can be very small (smaller than 2 mm2) and are easily populated onto

printed circuit boards.

On/Off time: LEDs light up very quickly. A typical red indicator LED will achieve

full brightness in microseconds. LEDs used in communications devices can have

VITS-Karimnagar 32 B.TECH(ECE)

Page 33: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

even faster response times.

Cycling: LEDs are ideal for use in applications that are subject to frequent on-off

cycling, unlike fluorescent lamps that burn out more quickly when cycled

frequently, or HID lamps that require a long time before restarting.

Dimming: LEDs can very easily be dimmed either by Pulse-width modulation or

lowering the forward current.

Cool light: In contrast to most light sources, LEDs radiate very little heat in the

form of IR that can cause damage to sensitive objects or fabrics. Wasted energy

is dispersed as heat through the base of the LED.

Slow failure: LEDs mostly fail by dimming over time, rather than the abrupt

burn-out of incandescent bulbs.

Lifetime: LEDs can have a relatively long useful life. One report estimates 35,000

to 50,000 hours of useful life, though time to complete failure may be longer.

Fluorescent tubes typically are rated at about 10,000 to 15,000 hours, depending

partly on the conditions of use, and incandescent light bulbs at 1,000–2,000

hours.

Shock resistance: LEDs, being solid state components, are difficult to damage

with external shock, unlike fluorescent and incandescent bulbs which are fragile.

Focus: The solid package of the LED can be designed to focus its light.

Incandescent and fluorescent sources often require an external reflector to

collect light and direct it in a usable manner.

Toxicity: LEDs do not contain mercury, unlike fluorescent

3.7. Crystal Oscillator

Now we shall discuss our recommended crystal oscillator circuit, explain each

component in the circuit and provide some guidelines on selecting values for these

components. Finally, we shall give a few precautions to take in order to avoid in-stability

and start-up problems.

VITS-Karimnagar 33 B.TECH(ECE)

Page 34: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Figure 1. Shows the crystal equivalent circuit. R is the effective series resistance , L and

C are the motional inductance and capacitance of the crystal. CP is the shunt capacitance

due to the crystal electrodes. Figure 2 Shows the reactance frequency plot of the crystal.

When a crystal is operating at series resonance it looks purely resistive and the reactance

of the inductor and the capacitor are equal (XL = XC). The series resonance frequency is

given by the equation

VITS-Karimnagar 34 B.TECH(ECE)

Page 35: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

When the crystal is operating in parallel resonant mode it looks inductive. The frequency

of operation in this mode is defined by the load on the crystal. The crystal manufacturer

should specify the load capacitance CL for parallel resonant crystals. In this mode the

frequency of oscillation is given by the equation.

In parallel resonance mode the crystal can be made to oscillate anywhere on the fs - fa

slope of the reactance plot, shown in Figure 2, by varying the load of the crystal. All of

MX-COM’s crystal oscillator circuits recommend using parallel resonant mode crystals.

Figure 3 shows the recommended Crystal oscillator circuit diagram. In this type of setup

the crystal is expected to oscillate in parallel resonant mode. The inverter which is

internal to the chip acts as class AB amplifier and provides approximately 180phase

shift from input to the output and the network formed by the crystal, R1, C1 and C2

provides additional 180phase shift. So the total phase shift around the loop is 360.

This satisfies one of the conditions required to sustain oscillation. The other condition,

for proper startup and sustaining oscillation is the closed loop gain

Should be 1.The resistor Rf around the inverter provides negative feedback and sets the

bias point of the inverter near mid-supply operating the inverter in the high gain linear

region. The value of this resistor is high, usually in the range of a 500K~2M. Some

of MXCOM’s ICs have this resistor internal refer to the external component

specifications in the data sheet of a particular chip.

VITS-Karimnagar 35 B.TECH(ECE)

Page 36: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

The capacitors C1 and C2 form the load capacitance for the crystal. The optimum load

capacitance (CL) for a given crystal is specified by the crystal manufacturer. The

equation to calculate the values of C1 and C2 is

Where CS is the stray capacitance on the printed circuit board, typically a value of 5pf

can be used for calculation purposes. Now C1 and C2 can be selected to satisfy the above

equation. Usually C1 and C2 are selected such that they are approximately equal. Large

values of C1 and/or C2 increases frequency stability but decreases loop gain and may

cause start-up problems.

R1 is the drive limiting resistor, the primary function of this resistor is to limit the output

of the inverter so that the crystal is not over driven. R1 and C1 form a voltage dividing

circuit, the values of these components are chosen in such a way that the output of the

inverter goes close to rail-to-rail and the input to the crystal is 60% of rail-to-rail, usual

VITS-Karimnagar 36 B.TECH(ECE)

Page 37: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

practice is to make resistance of R1 and reactance of C1 equal at the operating frequency,

i.e. R1 XC1. This makes the input to the crystal half that of the inverter output.

Always make sure that the power dissipated by the crystal is with-in the crystal

manufacturer’s specifications. Over-driving the crystal may damage the crystal. Please

refer to the crystal manufacturer’s recommendations.

Ideally the inverter provides 180phase shift, but the inherent

delay of the inverter provides additional phase shift proportional to the delay. In order to

ensure the total phase shift of n360around the loop, the network should provide

180less the phase shift due to the inverter delay. R1 can be varied to accomplish this.

With fixed C1 and C2, the closed loop gain and phase can be altered by varying R1. In

some applications R1 can be ignored if the above two conditions are met.

3.8 Buzzer

Electromagnetic buzzer internal composition:

Waterproof sticker 2.spools 3.coil 4.magnet 5.base 6.pin 7.shell 8.core 9.Sealin glue 10.A

Small metal plates 11.Vibrating membrane 12.Circuit board

Working principle of passive electromagnetic buzzer

The working principle of passive electromagnetic buzzer:

Ac signal through the bypass line in the stent in the stent core package produce a column

of alternating magnetic flux, the alternating magnetic flux and magnetic flux for a

constant stack, so that films of molybdenum to a given

The exchange of signals with the frequency of vibration and sound resonator. Products of

the frequency response and sound pressure curve and the value gap, molybdenum films

inherent vibration frequency (which can be rough refraction. For small film thickness of

molybdenum), Shell (Tune Helmholtz resonance) frequency of the magnetometer

VITS-Karimnagar 37 B.TECH(ECE)

Page 38: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

magnetic wire is directly related to the diameter. Composed of electromagnetic buzzer 

by electromagnetic oscillator, the electromagnetic coil, magnet, vibration, such as the

composition of membrane and shell. Access to power, the audio signal generated by

oscillator current through the electromagnetic coil to generate magnetic fields of

electromagnetic coils. Membrane vibration in the electromagnetic coil and magnet

interaction, the buzzer sound vibration periodically.

Buzzer products

VITS-Karimnagar 38 B.TECH(ECE)

Page 39: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

CHAPTER-4

4. PIC MICROCONTROLLER

4.1. Introduction

The PIC16F72 CMOS FLASH-based 8-bit microcontroller is upward compatible with

PIC16C72/72A and PIC16F872devices. It features 200 ns instruction execution, self

programming, an ICD, 2 Comparators, 5 channels of 8-bit Analog-to-Digital (A/D)

converter, 2 capture/compare/PWM functions, a synchronous serial port that can be

configured as either 3-wire SPI or 2-wire I2C bus, a USART, and a Parallel Slave Port.

High-Performance RISC CPU

High performance RISC CPU

Only 35 single word instructions to learn

All single cycle instructions except for program branches which are two-cycle

Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle

2K x 14 words of Program Memory

128 x 8 bytes of Data Memory (RAM)

Pin out compatible to the PIC16C72/72A and PIC16F872

Interrupt capability

Eight level deep hardware stack

Direct, Indirect and Relative Addressing modes

Peripheral Features

Timer0: 8-bit timer/counter with 8-bit prescaler Timer1: 16-bit timer/counter with prescaler, can be incremented during SLEEP

via external crystal/clock Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler Capture, Compare, PWM (CCP) module

VITS-Karimnagar 39 B.TECH(ECE)

Page 40: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Capture is 16-bit, max resolution is 12.5 ns Compare is 16-bit, max resolution is 200 ns PWM max resolution is 10-bit 8-bit, 5-channel Analog-to-Digital converter Synchronous Serial Port (SSP) with SPI (Master mode) and I2C (Slave) Heat sink/Source Current:25 mA Brown-out detection circuitry for Brown-out Reset (BOR)

CMOS Technology:

Low power, high speed CMOS FLASH technology

Fully static design

Wide operating voltage range: 2.0V to 5.5V

industrial temperature range

Low power consumption:

- < 0.6 mA typical @ 3V, 4 MHz

- 20 μA typical @ 3V, 32 kHz

- < 1 μA typical standby current

Following are the major blocks of PIC Microcontroller.

Program memory (FLASH) is used to storing a written program. Since memory made

in FLASH technology can be programmed and cleared more than once, it makes this

microcontroller suitable for device development.

EEPROM- data memory that needs to be saved when there is no supply. It is usually

used for storing important data that must not be lost if power supply suddenly stops. For

instance, one such data is an assigned temperature in temperature regulators. If during a

loss of power supply this data was lost, we would have to make the adjustment once

again upon return of supply. Thus our device looses on self-reliance.

RAM - Data memory used by a program during its execution. In RAM are stored all

inter-results or temporary data during run-time.

PORTS are physical connections between the microcontroller and the outside world.

PIC16F72 has 22 I/O pins.

VITS-Karimnagar 40 B.TECH(ECE)

Page 41: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

FREE-RUN TIMER is an 8-bit register inside a microcontroller that works

independently of the program. On every fourth clock of the oscillator it increments its

value until it reaches the maximum (255), and then it starts counting over again from

zero. As we know the exact timing between each two increments of the timer contents,

timer can be used for measuring time which is very useful with some devices

4.2. Pin description

PIC16F72 has a total of 28 pins. It is most frequently found in a DIP28 type of case but

can also be found in SMD case which is smaller from a DIP. DIP is an abbreviation for

Dual In Package. SMD is an abbreviation for Surface Mount Devices suggesting that

holes for pins to go through when mounting aren't necessary in soldering this type of a

component.

Figure 4.1: PIC16F72 Microcontroller

Pins on PIC16F72 microcontroller have the following meaning:

There are 28 pins on PIC16F72. Most of them can be used as an IO pin. Others are

already for specific functions. These are the pin functions.

1. MCLR – to reset the PIC

2. RA0 – port A pin 0

VITS-Karimnagar 41 B.TECH(ECE)

Page 42: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

3. RA1 – port A pin 1

4. RA2 – port A pin 2

5. RA3 – port A pin 3

6. RA4 – port A pin 4

7. RA5 – port A pin 5

8. VSS – ground

9. OSC1 – connect to oscillator

10. OSC2 – connect to oscillator

11. RC0 – port C pin 0 VDD – power supply

12. RC1 – port C pin 1

13. RC2 – port C pin 2

14. RC3 – port C pin 3

15. RC4 - port C pin 4

16. RC5 - port C pin 5

17. RC6 - port C pin 6

18. RC7 - port C pin 7

19. VSS - ground

20. VDD – power supply

21. RB0 - port B pin 0

22. RB1 - port B pin 1

23. RB2 - port B pin 2

24. RB3 - port B pin 3

25. RB4 - port B pin 4

26. RB5 - port B pin 5

27. RB6 - port B pin 6

28. RB7 - port B pin 7

By utilizing all of this pin so many application can be done such as:

1. LCD – connect to Port B pin.

2. LED – connect to any pin declared as output.

3. Relay and Motor - connect to any pin declared as output.

VITS-Karimnagar 42 B.TECH(ECE)

Page 43: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

4. External EEPROM – connect to I2C interface pin – RC3 and RC4 (SCL and SDA)

5. LDR, Potentiometer and sensor – connect to analogue input pin such as RA0.

6. GSM modem dial up modem – connect to RC6 and RC7 – the serial communication

interface using RS232 protocol.

For more detail function for each specific pin please refer to the device datasheet from

Microchip.

Ports

Term "port" refers to a group of pins on a microcontroller which can be accessed

simultaneously, or on which we can set the desired combination of zeros and ones, or

read from them an existing status. Physically, port is a register inside a microcontroller

which is connected by wires to the pins of a microcontroller. Ports represent physical

connection of Central Processing Unit with an outside world. Microcontroller uses them

in order to monitor or control other components or devices. Due to functionality, some

pins have twofold roles like PA4/TOCKI for instance, which is in the same time the

fourth bit of port A and an external input for free-run counter. Selection of one of these

two pin functions is done in one of the configuration registers. An illustration of this is

the fifth bit T0CS in OPTION register. By selecting one of the functions the other one is

disabled.

All port pins can be designated as input or output, according to the needs of a device

that's being developed. In order to define a pin as input or output pin, the right

combination of zeros and ones must be written in TRIS register. If the appropriate bit of

TRIS register contains logical "1", then that pin is an input pin, and if the opposite is true,

it's an output pin. Every port has its proper TRIS register. Thus, port A has TRISA, and

port B has TRISB. Pin direction can be changed during the course of work which is

particularly fitting for one-line communication where data flow constantly changes

direction.

VITS-Karimnagar 43 B.TECH(ECE)

Page 44: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

PORTB and TRISB

PORTB has adjoined 8 pins. The appropriate register for data direction is TRISB. Setting

a bit in TRISB register defines the corresponding port pin as input, and resetting a bit in

TRISB register defines the corresponding port pin as output.

Figure 4.2.1: PORTSB And TRISB

VITS-Karimnagar 44 B.TECH(ECE)

Page 45: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Each PORTB pin has a weak internal pull-up resistor (resistor which defines a line to

logic one) which can be activated by resetting the seventh bit RBPU in OPTION register.

These ‘pull-up’ resistors are automatically being turned off when port pin is configured

as an output. When a microcontroller is started, pull-ups are disabled.

Four pins PORTB, RB7:RB4 can cause an interrupt which occurs when their status

changes from logical one into logical zero and opposite. Only pins configured as input

can cause this interrupt to occur (if any RB7:RB4 pin is configured as an output, an

interrupt won't be generated at the change of status.) This interrupt option along with

internal pull-up resistors makes it easier to solve common problems we find in practice

like for instance that of matrix keyboard. If rows on the keyboard are connected to these

pins, each push on a key will then cause an interrupt. A microcontroller will determine

which key is at hand while processing an interrupt It is not recommended to refer to port

B at the same time that interrupt is being processed.

PORTA and TRISA

PORTA has 5 adjoining pins. The corresponding register for data direction is TRISA at

address 85h. Like with port B, setting a bit in TRISA register defines also the

corresponding port pin as input, and clearing a bit in TRISA register defines the

corresponding port pin as output.

It is important to note that PORTA pin RA4 can be input only. On that pin is also situated

an external input for timer TMR0. Whether RA4 will be a standard input or an input for a

counter depends on T0CS bit (TMR0 Clock Source Select bit). This pin enables the timer

TMR0 to increment either from internal oscillator or via external impulses on

RA4/T0CKI pin.

Example shows how pins 0, 1, 2, 3, and 4 are designated input, and pins 5, 6, and 7

output. After this, it is possible to read the pins RA2, RA3, RA4, and to set logical zero

or one to pins RA0 and RA1.

VITS-Karimnagar 45 B.TECH(ECE)

Page 46: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Figure 4.2.2: PORTSA And TRISA

4.3. Central Processing Unit

CPU has a role of connective element between other blocks in the microcontroller. It

coordinates the work of other blocks and executes the user program.

 

VITS-Karimnagar 46 B.TECH(ECE)

Page 47: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

 CISC, RISC

It has already been said that PIC16F72 has RISC architecture. This term is often found in

computer literature, and it needs to be explained here in more detail. Harvard architecture

is a newer concept than von-Neumann. It rose out of the need to speed up the work of a

microcontroller. In Harvard architecture, data bus and address bus are separate. Thus a

greater flow of data is possible through the central processing unit, and of course, a

greater speed of work. Separating a program from data memory makes it further possible

for instructions not to have to be 8-bit words. PIC16F72 uses 14 bits for instructions,

which allows for all instructions to be one-word instructions. It is also typical for Harvard

architecture to have fewer instructions than von-Neumann’s, and to have instructions

usually executed in one cycle.

Microcontrollers with Harvard architecture are also called "RISC microcontrollers".

RISC stands for Reduced Instruction Set Computer. Microcontrollers with von-

Neumann's architecture are called 'CISC microcontrollers'. Title CISC stands for

Complex Instruction Set Computer.

Since PIC16F72 is a RISC microcontroller, that means that it has a reduced set of

instructions, more precisely 35 instructions. (Ex. Intel's and Motorola's microcontrollers

have over hundred instructions) All of these instructions are executed in one cycle except

for jump and branch instructions. According to what its maker says, PIC16F72 usually

reaches results of 2:1 in code compression and 4:1 in speed in relation to other 8-bit

microcontrollers in its class.

VITS-Karimnagar 47 B.TECH(ECE)

Page 48: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Applications

PIC16F72 perfectly fits many uses, from automotive industries and controlling home

appliances to industrial instruments, remote sensors, electrical door locks and safety

devices. It is also ideal for smart cards as well as for battery supplied devices because of

its low consumption.

EEPROM memory makes it easier to apply microcontrollers to devices where permanent

storage of various parameters is needed (codes for transmitters, motor speed, receiver

frequencies, etc.). Low cost, low consumption, easy handling and flexibility make

PIC16F72 applicable even in areas where microcontrollers had not previously been

considered (example: timer functions, interface replacement in larger systems,

coprocessor applications, etc.).

In System Programmability of this chip (along with using only two pins in data transfer)

makes possible the flexibility of a product, after assembling and testing have been

completed. This capability can be used to create assembly-line production, to store

calibration data available only after final testing, or it can be used to improve programs

on finished products.

Clock / instruction cycle

Clock is microcontroller's main starter, and is obtained from an external component

called an "oscillator". If we want to compare a microcontroller with a time clock, our

"clock" would then be a ticking sound we hear from the time clock. In that case,

oscillator could be compared to a spring that is wound so time clock can run. Also, force

used to wind the time clock can be compared to an electrical supply.

Clock from the oscillator enters a microcontroller via OSC1 pin where internal circuit of

a microcontroller divides the clock into four even clocks Q1, Q2, Q3, and Q4 which do

not overlap. These four clocks make up one instruction cycle (also called machine cycle)

during which one instruction is executed.

Execution of instruction starts by calling an instruction that is next in string. Instruction is

called from program memory on every Q1 and is written in instruction register on Q4.

Decoding and execution of instruction are done between the next Q1 and Q4 cycles. On

VITS-Karimnagar 48 B.TECH(ECE)

Page 49: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

the following diagram we can see the relationship between instruction cycle and clock of

the oscillator (OSC1) as well as that of internal clocks Q1-Q4. Program counter (PC)

holds information about the address of the next instruction.

.

Pipelining

Instruction cycle consists of cycles Q1, Q2, Q3 and Q4. Cycles of calling and executing

instructions are connected in such a way that in order to make a call, one instruction cycle

is needed, and one more is needed for decoding and execution. However, due to

pipelining, each instruction is effectively executed in one cycle. If instruction causes a

change on program counter, and PC doesn't point to the following but to some other

address (which can be the case with jumps or with calling subprograms), two cycles are

needed for executing an instruction. This is so because instruction must be processed

again, but this time from the right address. Cycle of calling begins with Q1 clock, by

writing into instruction register (IR). Decoding and executing begins with Q2, Q3 and Q4

clocks.

VITS-Karimnagar 49 B.TECH(ECE)

Page 50: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

4.4. Memory Organization

PIC16F72 has two separate memory blocks, one for data and the other for program.

EEPROM memory with GPR and SFR registers in RAM memory make up the data

block, while FLASH memory makes up the program block.

Program Memory:

Program memory has been carried out in FLASH technology which makes it possible to

program a microcontroller many times before it's installed into a dev9ice, and even after

its installment if eventual changes in program or process parameters should occur. The

size of program memory is 1024 locations with 14 bits width where locations zero and

four are reserved for reset and interrupt vector.

Data Memory:

Data memory consists of EEPROM and RAM memories. EEPROM memory

consists of 256 eight bit locations whose contents are not lost during loosing of power

supply. EEPROM is not directly addressable, but is accessed indirectly through EEADR

and EEDATA registers. As EEPROM memory usually serves for storing important

parameters (for example, of a given temperature in temperature regulators) , there is a

strict procedure for writing in EEPROM which must be followed in order to avoid

accidental writing. RAM memory for data occupies space on a memory map from

location 0x0C to 0x4F which comes to 68 locations. Locations of RAM memory are also

VITS-Karimnagar 50 B.TECH(ECE)

Page 51: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

called GPR registers which is an abbreviation for General Purpose Registers. GPR

registers can be accessed regardless of which bank is selected at the moment. 

4.5. PIC C Compiler

 PIC compiler is software used where the machine language code is written and

compiled. After compilation, the machine source code is converted into hex code which

is to be dumped into the microcontroller for further processing. PIC compiler also

supports C language code.

 It’s important that you know C language for microcontroller which is commonly known

as Embedded C. As we are going to use PIC Compiler, hence we also call it PIC C. The

PCB, PCM, and PCH are separate compilers. PCB is for 12-bit opcodes, PCM is for 14-

bitopcodes, and PCH is for 16-bit opcode PIC microcontrollers. Due to many similarities,

all three compilers are covered in this reference manual. Features and limitations that

apply to only specific microcontrollers are indicated within. These compilers are

specifically designed to meet the unique needs of the PIC microcontroller. This allows

developers to quickly design applications software in a more readable, high-level

language. When compared to a more traditional C compiler, PCB, PCM, and PCH have

some limitations. As an example of the limitations, function recursion is not allowed.

This is due to the fact that the PIC has no stack to push variables onto, and also because

of the way the compilers optimize the code. The compilers can efficiently implement

normal C constructs, input/output operations, and bit twiddling operations. All normal C

data types are supported along with pointers to constant arrays, fixed point decimal, and

arrays of bits.

PIC C is not much different from a normal C program. If you know assembly, writing a C

program is not a crisis. In PIC, we will have a main function, in which all your

application specific work will be defined. In case of embedded C, you do not have any

operating system running in there. So you have to make sure that your program or main

file should never exit. This can be done with the help of simple while (1) or for (;;) loop

as they are going to run infinitely.

VITS-Karimnagar 51 B.TECH(ECE)

Page 52: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

. CHAPTER-5

5. PIR SENSOR

A Passive Infrared sensor (PIR sensor) is an electronic device which measures infrared

light radiating from objects in its field of view. Apparent motion is detected when an

infrared source with one temperature, such as a human, passes in front of an infrared

source with another temperature, such as a wall. All objects emit what is known as black

body radiation. This energy is invisible to the human eye but can be detected by

electronic devices designed for such a purpose. The term 'passive' in this instance means

the PIR does not emit energy of any type but merely accepts incoming infrared radiation.

The most frequent use of the PIR sensor is as an 'area' sensor. Whether it is to detect

'someone moving in the front yard', or 'someone moving in the bathroom', or 'someone

moving through a doorway', or even 'someone opened the beer cooler', it is all technically

the same sensor and logic.

There is a simple electronic device which is sensitive to 'heat', or rather the infrared light

that is emitted by warm or hot objects (like humans).

The 'logic' of the PIR sensor is that it must detect 'significant change' of the normal level

of heat within the 'field' of its view. The circuits that control it must be able to determine

what 'normal' is, and then close a switch when the normal field changes, as when a

human walks in front of it. It must also be able to 'tolerate' slow changes within the field,

and remember that as the new 'normal'. This is so that gradual changes like the sunlight

changes throughout the day don't cause a false alarm. This is a standard behavior of 'PIR'

type sensors. (There's a lot more electronics there than just the black window...)

VITS-Karimnagar 52 B.TECH(ECE)

Page 53: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

We'll notice in all three pictures of PIR type sensors on this page, that they all have some

sort of plastic 'lens' that covers the circuit board and the PIR sensor device. This is a

'Fresnel' lens. It 'pinches' light that passes thru it. If you hold it to your eye, you can see

that there are apparent distinct 'bars' of light as you move it across a scene. Some of these

bars may be vertical, and some may be horizontally oriented.

The lenses that are made for most PIR sensor tend to ‘pinch’ the light such that it is

horizontally sensitive.

This means that the Lens/PIR will be more sensitive to motion of a warm body,

horizontally 'across the field of view'. Please note that this means that these sensors are

most insensitive to warm bodies moving from a 'distance' and directly towards one of

these common devices...!

A motion sensor says:

- All motion sensors send ‘ON’ message when they first see motion.

- Most will also send ‘OFF’ message when motion has not been seen for a set period of

time.

- Some will continue to send ‘ON’ message periodically as long as motion continues.

- Others may only announce the first event, and say nothing again until the area has been

quiet for a set of period.

The PIR sensor itself:

The IR sensor itself is housed in a hermetically sealed metal can to improve

noise/ temperature / humidity immunity. There is a window made of IR-

transmissive material (typically coated silicon since that is very easy to come by) that

protects the sensing element.

Behind the window are the two balanced sensors.

VITS-Karimnagar 53 B.TECH(ECE)

Page 54: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Figure 5.1:Working of PIR sensor

Lenses:

PIR sensors are rather generic and for the most part vary only in price and sensitivity.

Most of the real magic happens with optics. This is a pretty good idea for manufacturing

the PIR sensor and circuitry is fixed and costs a few dollars. The lens costs only a few

cents and can change the breadth, range, sensing pattern very easily.

In the diagram above the lens is just a piece of plastic but that means that the detection

area is just two rectangles. Usually we’d have a detection area that is much larger. To do

that we use a simple lens such as those found in camera: they condenses a large area

(such as a landscape) into a small one (on film or a CCD sensor). For reasons that will be

apparent soon, we would like to make the PIR lenses small and thin and moldable from

cheap plastic, even though it may add distortion. For this reason the sensors are actually

Fresnel lenses (see image below).

VITS-Karimnagar 54 B.TECH(ECE)

Page 55: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

So now we have a much larger range. However, remember that we actually have two

sensors, and more importantly we don’t want two really big sensing-area rectangles, but

rather a scattering of multiple small areas. So that we have to split up the lens into

multiple section, each section of which is a Fresnel lens.

The different faceting and sub-lenses create a range of detection areas, interleaved

with each other. That's why the lens centers in the facets above are 'inconsistent' - every

other one points to a different half of the PIR sensing element

Figure 5.2:Detecting Lens

VITS-Karimnagar 55 B.TECH(ECE)

Page 56: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

5.1. Design

Infrared radiation enters through the front of the sensor, known as the sensor face. At the

core of a PIR is a solid state sensor or set of sensors, made from approximately 1/4 inches

square of natural or artificial pyroelectric materials, usually in the form of a thin film, out

of gallium nitride (GaN), cesium nitrate (CsNO3), polyvinyl fluorides, derivatives of

Phenylpyrazine and cobalt phthalocyanine. (See pyroelectric crystals.) Lithium trantalate

(LiTaO3) is a crystal exhibiting both piezoelectric and pyroelectric properties. The sensor

is often manufactured as part of an integrated circuit and may consist of one (1), two (2)

or four (4) 'pixels' of equal areas of the pyroelectric material. Pairs of the sensor pixels

may be wired as opposite inputs to a differential amplifier. In such a configuration, the

PIR measurements cancel each other so that the average temperature of the field of view

is removed from the electrical signal; an increase of IR energy across the entire sensor is

self-canceling and will not trigger the device. This allows the device to resist false

indications of change in the event of being exposed to flashes of light or field-wide

illumination. (Continuous bright light could still saturate the sensor materials and render

the sensor unable to register further information.) At the same time, this differential

VITS-Karimnagar 56 B.TECH(ECE)

Page 57: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

arrangement minimizes common-mode interference; this allows the device to resist

triggering due to nearby electric fields. However, a differential pair of sensors cannot

measure temperature in that configuration and therefore this configuration is specialized

for motion detectors.

Features: 

Detection range up to 20 feet (6 meters) away 

Single bit output

Jumper selects single or continuous trigger output mode

3-pin SIP header ready for breadboard or through-hole projects

Small size makes it easy to conceal

Compatible with BASIC Stamp, Propeller and many other microcontrollers

Complete with PIR, Motion Detection IC and Fresnel Lens

Simple 3 connections

Dual Element Sensor with Low Noise and High Sensitivity

Supply Voltage: 5V DC

Standard 5V Active High Output pin for connecting to microcontroller directly

Module Dimensions: 25mm Length, 32mmWidth, 18mm Height

Application Ideas

Alarm Systems

Holiday animated Props

Motion-activated lighting

Key Specifications: Power requirements: 3.3 to 5 VDC Communication: single bit high/low output Dimensions: 1.27 x 0.96 x 1.0 in (32.2 x 24.3 x 25.4 mm) Operating temp range: +32 to +121 °F (0 to +50 °C).

5.2. PIR Motion Sensor Module

VITS-Karimnagar 57 B.TECH(ECE)

Page 58: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Compact and complete, easy to use Passive Infrared (PIR) Sensor Module for human

body detection. Incorporating a Fresnel lens and motion detection circuit, suitable for a

wide range of supply voltages and with low current drain. High sensitivity and low noise.

Output is a standard 5V active high output signal.

Module provides an optimized circuit that will detect motion up to 6 meters away and can

be used in burglar alarms and access control systems. Inexpensive and easy to use, it's

ideal for alarm systems, motion-activated lighting, holiday props, and robotics

applications.

The Output can be connected to microcontroller pin directly to monitor signal or a

connected to transistor to drive DC loads like a bell, buzzer, siren, relay, opto-coupler

(e.g. PC817, MOC3021), etc. The PIR sensor and Fresnel lens are fitted onto the the

PCB. This enables the board to be mounted inside a case with the detecting lens

protruding outwards.

Fig5.3: PIR sensor

Theory of Operation:

Pyroelectric devices, such as the PIR sensor, have elements made of a crystalline material

that generates an electric charge when exposed to infrared radiation. The changes in the

amount of infrared striking the element change the voltages generated, which are

measured by an on-board amplifier. The device contains a special filter called a Fresnel

lens, which focuses the infrared signals onto the element. As the ambient infrared signals

change rapidly, the on-board amplifier trips the output to indicate motion.

VITS-Karimnagar 58 B.TECH(ECE)

Page 59: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

The PIR (Passive Infra-Red) Sensor is a pyroelectric device that detects motion by

measuring changes in the infrared (heat) levels emitted by surrounding objects. This

motion can be detected by checking for a sudden change in the surrounding IR patterns.

When motion is detected the PIR sensor outputs a high signal on its output pin. This logic

signal can be read by a microcontroller or used to drive a transistor to switch a higher

current load.

Startup

The PIR Sensor requires a ‘warm-up’ time in order to function properly. This is due to

the settling time involved in ‘learning’ its environment. This could be anywhere from 10-

60 seconds. After this warm up time, sensor will be ready to use.

Range of Operation:

The PIR Sensor has a range of approximately 20 feet(6 meters). This can vary

with environmental conditions. The sensor is designed to adjust to slowly changing

conditions that would happen normally as the day progresses and the environmental

conditions change, but respond by making its output high when sudden changes occur,

such as when there is motion.

VITS-Karimnagar 59 B.TECH(ECE)

Page 60: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Figure 5.4:PIR Sensor range operation

This device is designed for indoor use. Operation outside or in extreme temperatures may

affect stability negatively.

Due to the high sensitivity of PIR sensor device, it is not recommended to use the module

in the following or similar condition.

A) In rapid environmental changes & strong shock or vibration.

B) In a place where there are obstructing material (eg. glass) through which IR

Cannot pass within detection area.

VITS-Karimnagar 60 B.TECH(ECE)

Page 61: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

C) Exposed to direct sunlight or direct wind from a heater or air condition

VITS-Karimnagar 61 B.TECH(ECE)

Page 62: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

CHAPTER-6

6. Result: In this chapter we will be discuss about the accuracy of the all components

and. performance will be clearly understood.

VITS-Karimnagar 62 B.TECH(ECE)

INPUT

PARAMETER

FUNCTIONALITY OUTPUT INTERMEDIATE

COMPONENTS

1 POWER SUPPLY CONVERTS 230V

AC TO 5V DC BY

RECTIFICATION

AND FILTERING

+5V TRANSFORMER,REC

TIFIER,

CAPACITOR

FILTER,REGULATOR

2 PIR SENSOR CHECKS FOR

THE PRESENCE

OF IR RAYS

‘1’ IF

PIR

SENSOR

DETECTS

IR RAYS

ELSE ‘0’

3 MICROCONTROLL

ER

USED FOR

INTERFACING

ALL OTHER

COMPONENTS

GIVING SUPPLY

TO ALL OTHER

COMPONENTS

5V PORTS

4 BUZZER IT PRODUCES

BEEP SOUND

5V BUZZER DRIVER

5 CRYSTAL

OSCILLATOR

IT GIVES THE

CLOCK PULSES

0-20MHZ CRYSTAL

Page 63: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

Whenever a person comes nearer to PIR sensor, the sensor will detect PIR rays emitted

from a human body.The output of PIR sensor is digital ‘1’,which is given as input to the

PIC microcontroller. The microcontroller will then send an instruction to the buzzer to

alert. Thus the presence of human being can be detected by the buzzer alert.

Applications

It helps the owner of the house to monitor his home.

It can be used in banks, offices to know the entry of an unauthorized person.

We have a idea to develop this system in future by interfacing a GPS to the system so

that one can get a message to the mobile when a stranger enters into home.Also by

interfacing a cam we can also get a picture of the stranger when we are out of home.

6.1 Conclusion:

We can conclude that the project PIR sensor based intrusion detection system has been

successfully designed and tested. Integrating switches of all the hardware components

used have developed it. Presence of every module has been reasoned out and placed

carefully thus contributing to the best working of the unit. Secondly using highly

advanced IC’s and with the help of growing technology the project has been successfully

implemented.Enhancement in science and technology has made the world fully

atomized .This project provides cent percent security by giving a buzzer sound whenever

it detects IR rays from human beings.

6.2 Future Scope:

We have a idea to develop this system in future by interfacing a GPS to the system so

that one can get a message to the mobile when a stranger enters into home. Also by

interfacing a cam we can also get a picture of the stranger when we are out of home.

VITS-Karimnagar 63 B.TECH(ECE)

Page 64: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

CHAPTER-7

References/Bibliography:

Books referred:

1. Raj kamal –Microcontrollers Architecture, Programming, Interfacing and System

Design.

2. Mazidi and Mazidi –Embedded Systems.

3. PCB Design Tutorial –David.L.Jones.

4. PIC Microcontroller Manual – Microchip.

5. Pyroelectric Sensor Module- Murata.

6. Embedded C –Michael.J.Pont.

WEBSITES:

The sites which were used while doing this project: 

1. www.wikipedia.com

2. www.allaboutcircuits.com

3. www.microchip.com

4. www.howstuffworks.com  

VITS-Karimnagar 64 B.TECH(ECE)

Page 65: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

APPENDIX

Program Code: 

The program code which is dumped in the microcontroller of our project is shown below. 

 #include <16F72.h>

#include <PIR.c>

#use delay (clock=20000000)

Void main ()

{

output_high (PIN_C4);

delay_ms (1000);

output_low (PIN_C4);

delay_ms (1000);

output_high (PIN_C4);

delay_ms (1000);

output_low (PIN_C4);

VITS-Karimnagar 65 B.TECH(ECE)

Page 66: Mini Project Doc

Mini Project Report on PIR Sensor Based Intrusion Detection System

while(1)

{

if(input(PIN_A0)) //PIR Sensor

{

delay_ms(300);

if(input(PIN_A0)) //PIR Sensor

{

output_high(PIN_C7);

output_high(PIN_C4);

delay_ms(3000);

}

}

else

{

output_low(PIN_C7);

output_low(PIN_C4);

}

}

}

VITS-Karimnagar 66 B.TECH(ECE)