Sie sind auf Seite 1von 38

CHAPTER -I

INRODUCTION

1.1 Introduction :
Night time Intruders Detector ,Counter & displaying is a hardware. system based upon PIR
sensor, Limit Switch Sensor .PIR sensor will detect the objects coming in front of it & it will
show message by switching ON a lights upto the time set by the timer. Limit switch sensor is
used to count the no. of intruders passing from a fixed point. With the help if PIR
sensors ,we will get the signals from a range of distance about entry of intruders & We will
be aware about that before arrival of intruders. The presence of intruder will block the light
between emitter & receiver . So no signal will be received at the receiver & It will show that
someone has entered from that point.

In 2008 the number of devices on the internet exceeded the number of people on the internet.
It is estimated in 2020 there would be over 50 billion devices connected. Internet of Things
(IOT) is starting to support the process connecting real-world to the Internet. Sensors and
microprocessors are recording and transmitting data to the Internet. Rapidly increasing Internet-
connected sensors means that new classes of technical capabilities and applications are being
created. Constant monitoring is deepening the understanding of the internal and external worlds
encountered by humans. High-frequency data processing is developing how humans adapt to
the different kinds of data flows enabled by the IOT.

In this thesis, microcontroller-based embedded system is designed to monitor greenhouse envi


ronmental variables. In addition to monitoring temperature and moisture, the user can control
greenhouse environment through relays. The system was designed using Arduino Due micro
controller and its development environment. Arduino web server monitoring system was pro
grammed using the C programming language. The sensor data is read and processed by Arduino
and it is displayed to the user through the web interface. Website programming is designed with
AJAX, HTML and CSS languages. The main aspects of designing the system were the simple
usability and the low cost of manufacturing. User interface is designed to be used by people
who have no prior computer knowledge.

1
Theoretical background in chapter 2 describes the methods used behind creating embedded
systems. The whole design process is divided to four sections: design model, architecture model,
implementation and testing. System design theory is applied when designing the practical part.
Theory describes the use of the Arduino microcontroller and how it is utilized in the embedded
systems. Practical part of the project is divided into two parts: Hardware and Software. Practical
part describes manufacturing of the green-house monitoring system. The wiring diagram is
explained such a way that someone without practical experience can replicate the process of
creating the system. The source code of the user interface and the system are published in
appendices.

1.2 Objective of project : Objective of the intruders detector & Counter is automation home
security at low cost . The hardware& Components used in this projects a very cheap &
designing process is also simple.

After performing this lab exercise, learner will be able to:

 Program Arduino board to detect movement.

 Interface PIR (Passive Infrared) Sensor with Arduino.

 Measure MAXIMUM amplitude of the captured signal using inbuilt functions of the scope.

To carry out this experiment, you will need:

 TBS1KB - Digital Oscilloscope from Tektronix

 Arduino Duemilanve or Uno board

 Voltage probe (provided with oscilloscope) / BNC cables

 Breadboard and connecting wires

 PIR(Passive Infrared) Sensor

2
 PIR Motion detector module can detect human movement by detecting infrared emitted by

human body.

 PIR motion detector module will output a high or low level or open collector signal when it

detects human movement. So it is widely used on the motion activated lightening,

security system, automatic sensory device and more.

1.3 Applications of Project


1.) It is used to at homes, shops, offices etc. to detect the persons entering there.
2.) It will count also that how many persons have entered.
3.) It will give a signal before the arrival of intruder within a certain range.

3
CHAPTER – II
SYSTEM MODEL & LITERATURE SURVEY

2.1 Introduction:
The hardware of this project is divided into two different parts . 1st part of hardware is used to
detect the intruders and 2nd part is used to count the no. of intruders. PIR sensor is interfaced to
Arduino uno for detection purpose and Limit Switch is used to count the no. of intruders
entered in that particular range .

2.2 Circuit Diagram :


In the circuit diagram shown below ,1st part describes the interfacing of PIR sensor with
Arduino Uno and 2nd part describes the connections of Limit Switch sensor for counting
purpose.

4
Fig.2.1 Interfacing of PIR sensor with Arduino Uno [1]

5
Fig 2.2 Connections of Limit Switch sensor [1]

6
2.3 Literature Survey:
2.3.1 Bluetooth based home security system:
The Bluetooth based home security systems are connected to Arduino Uno with input output
ports using relay. The programming of the Ardunio is done in C language of microcontrollers
and the connection is made using Bluetooth. The password protection is also provided so that
inly authorized people can entered without any objection. Wireless communication is used in
case of Bluetooth based automation .

2.3.2 Wi-Fi based home security system :


Wi-Fi based home automation system mainly consist three modules, the server, the hardware
interface module, and the software package. The figure shows the system model layout. Wi-Fi
technology is used by server, and hardware Interface module to communicate with each other.
The same technology uses to login to the server web based application.

2.3.3 GSM based home security system :


Because of the mobile phone and GSM technology, the GSM based home automation is lure to
research. The SMS based home automation, GPRS based home automation and dual tone multi
frequency(DTMF) based home automation, these options we considered mainly for
communication in GSM.In figure shows the logical diagram the work of A. A lheraish, it shows
how the home sensors and devices interact with the home network and communicates through
GSM and SIM (subscriber identity module). The system use transducer which convert machine
function into electrical signals which goes into microcontroller. The sensors of system convert
the physical qualities like sound, temperature and humidity into some other quantity like
voltage. The microcontroller analysis all signal and convert them into command to understand
by GSM module. Select appropriate communication method among SMS, GPRS and DTFC
based on the command which received GSM module.

7
CHAPTER-III
HARDWARE DESCRIPTION

3.1 Introdcution :
The main components used in this projects are Arduino Uno , PIR sensor and Limit switch. PIR
sensor is used to Detect the intruders and Limit switch is used to count the intruders. Many
other components used such as LCD display, LED bulbs, Resistors ,connecting wires etc are
briefly explained in this section.

3.2 Circuit Diagram :


Circuit diagram is divided into two parts as shown below.
Part 1: It consist of interfacing of PIR sensor with Arduino Uno for detection of intruders.

Fig.3.1 Interfacing of PIR sensor with Arduino Uno [1]

8
Fig 3.2 Connections of Limit Switch sensor [1]
9
3.2.1 List of components: These are given below.
1. PIR sensor
2. Limit Switch
3. Power supply 220 v
4. Relay switch
5. Diodes IN4007
6. Bulb
7. Arduino Uno
8. LCD 16*2
9. Resistors
10.Breadboard
11.Connecting wires

3.2.2 Description of components

3.2.2.1 INTRODUCTION TO ARDUINO UNO :

Electronic devices are becoming compact, flexible and cheap that are capable of doing more
function as compared to their predecessors that happened to cover more space, turned out costly
with the ability to perform fewer functions. Experts always strive to introduce innovation in
automation that requires minimum effort and gives maximum output. The microcontroller was
introduced in the electronics industry with the purpose of making our tasks easy that come with
even a remote connection with automation in any way. Arduino Uno is a very valuable addition
in the electronics that consists of USB interface, 14 digital I/O pins, 6 analog pins, and
Atmega328 microcontroller. It also supports serial communication using Tx and Rx pins. There
are many versions of Arduino boards introduced in the market like Arduino Uno, Arduino Due,
Arduino Leonardo, Arduino Mega, however, most common versions are Arduino Uno and
Arduino Mega. If you are planning to create a project relating to digital electronics, embedded
system, robotics, or IoT, then using Arduino Uno would be the best, easy and most economical
option. It is an open-source platform, means the boards and software are readily available and
anyone can modify and optimize the boards for better functionality. The software used for
Arduino devices is called IDE (Integrated Development Environment) which is free to use and
required some basic skills to learn it. It can be programmed using C and C++ language. Some
10
people get confused between Microcontroller and Arduino. While former is just an on system
40 pin chip that comes with a built-in microprocessor and later is a board that comes with the
microcontroller in the base of the board, boot loader and allows easy access to input-output pins
and makes uploading or burning of the program very easy.

 Arduino Uno is a microcontroller board developed by Arduino.cc which is an open-source


electronics platform mainly based on AVR microcontroller Atmega328.

 First Arduino project was started in Interaction Design Institute Ivrea in 2003 by David
Cuartielles and Massimo Banzi with the intention of providing a cheap and flexible way to
students and professional for controlling a number of devices in the real world. The current
version of Arduino Uno comes with USB interface, 6 analog input pins, 14 I/O digital ports that
are used to connect with external electronic circuits. Out of 14 I/O ports, 6 pins can be use f.

Fig.3.3 [3]

 It allows the designers to control and sense the external electronic devices in the real world.

 This board comes with all the features required to run the controller and can be directly
connected to the computer through USB cable that is used to transfer the code to the controller
11
using IDE (Integrated Development Environment) software, mainly developed to program
Arduino. IDE is equally compatible with Windows, MAC or Linux Systems, however,
Windows is preferable to use. Programming languages like C and C++ are used in IDE.

 Apart from USB, battery or AC to DC adopter can also be used to power the board.

 Arduino Uno boards are quite similar to other boards in Arduino family in terms of use and
functionality, however, Uno boards don’t come with FTDI USB to Serial driver chip.

 There are many versions of Uno boards available, however, Arduino Nano V3 and Arduino Uno
are the most official versions that come with Atmega328 8-bit AVR Atmel
microcontroller where RAM memory is 32KB.

 When nature and functionality of the task go complex, Micro SD card can be added in the
boards to make them store more information.

Features of Arduino Uno Board

 Arduino Uno comes with USB interface i.e. USB port is added on the board to develop serial
communication with the computer.

 At mega328 microcontroller is placed on the board that comes with a number of features like
timers, counters, interrupts, PWM, CPU, I/O pins and based on a 16MHz clock that helps in
producing more frequency and number of instructions per cycle.

Fig.3.4 Atmega 328 Microcontroller [3]

12
It is an open source platform where anyone can modify and optimize the board based on the
number of instructions and task they want to achieve.

 This board comes with a built-in regulation feature which keeps the voltage under control when
the device is connected to the external device.

 Reset pin is added in the board that reset the whole board and takes the running program in the
initial stage. This pin is useful when board hangs up in the middle of the running program;
pushing this pin will clear everything up in the program and starts the program right from the
beginning.

 There are 14 I/O digital and 6 analog pins incorporated in the board that allows the external
connection with any circuit with the board. These pins provide the flexibility and ease of use to
the external devices that can be connected through these pins. There is no hard and fast interface
required to connect the devices to the board. Simply plug the external device into the pins of the
board that are laid out on the board in the form of the header.

 The 6 analog pins are marked as A0 to A5 and come with a resolution of 10bits. These pins
measure from 0 to 5V, however, they can be configured to the high range using analog
Reference() function and AREF pin.

 13KB of flash memory is used to store the number of instructions in the form of code.

 Only 5 V is required to turn the board on, which can be achieved directly using USB port or
external adopter, however, it can support external power source up to 12 V which can be
regulated and limit to 5 V or 3.3 V based on the requirement of the project.

Arduino Uno is based on AVR microcontroller called Atmega328. This controller comes with
2KB SRAM, 32KB of flash memory, 1KB of EEPROM. Arduino Board comes with 14 digital
pins and 6 analog pins. ON-chip ADC is used to sample these pins. A 16 MHz frequency crystal
oscillator is equipped on the board. Following figure shows the pinout of the Arduino Uno
Board.

13
*PIN FUNCTION

There are several I/O digital and analog pins placed on the board which operates at 5V. These
pins come with standard operating ratings ranging between 20mA to 40mA. Internal pull-up
resistors are used in the board that limits the current exceeding from the given operating
conditions. However, too much increase in current makes these resisters useless and damages
the device.

LED. Arduino Uno comes with built-in LED which is connected through pin 13. Providing
HIGH value to the pin will turn it ON and LOW will turn it OFF.

Vin. It is the input voltage provided to the Arduino Board. It is different than 5 V supplied
through a USB port. This pin is used to supply voltage. If a voltage is provided through power
jack, it can be accessed through this pin.

5V. This board comes with the ability to provide voltage regulation. 5V pin is used to provide
output regulated voltage. The board is powered up using three ways i.e. USB, Vin pin of the
board or DC power jack. USB supports voltage around 5V while Vin and Power Jack support a
voltage ranges between 7V to 20V. It is recommended to operate the board on 5V. It is
important to note that, if a voltage is supplied through 5V or 3.3V pins, they result in bypassing
the voltage regulation that can damage the board if voltage surpasses from its limit.

GND. These are ground pins. More than one ground pins are provided on the board which can
be used as per requirement.

Reset. This pin is incorporated on the board which resets the program running on the board.
Instead of physical reset on the board, IDE comes with a feature of resetting the board through
programming.

IOREF. This pin is very useful for providing voltage reference to the board. A shield is used to
read the voltage across this pin which then select the proper power source.

PWM. PWM is provided by 3,5,6,9,10, 11pins. These pins are configured to provided 8-bit
output PWM.

14
SPI. It is known as Serial Peripheral Interface. Four pins 10(SS), 11(MOSI), 12(MISO),
13(SCK) provide SPI communication with the help of SPI library.

AREF. It is called Analog Reference. This pin is used for providing a reference voltage to the
analog inputs.

TWI. It is called Two-wire Interface. TWI communication is accessed through Wire Library. A4
and A5 pins are used for this purpose.

Serial Communication. Serial communication is carried out through two pins called Pin 0 (Rx)
and Pin 1 (Tx).Rx pin is used to receive data while Tx pin is used to transmit data.

External Interrupts. Pin 2 and 3 are used for providing external interrupts. An interrupt is
called by providing LOW or changing value.

Communication and Programming

Arduino Uno comes with an ability of interfacing with other other Arduino boards,
microcontrollers and computer. The Atmega328 placed on the board provides serial
communication using pins like Rx and Tx.

The Atmega16U2 incorporated on the board provides a pathway for serial communication using
USB com drivers. Serial monitor is provided on the IDE software which is used to send or
receive text data from the board. If LEDs placed on the Rx and Tx pins will flash, they indicate
the transmission of data.

Arduino Uno is programmed using Arduino Software which is a cross-platform application


called IDE written in Java. The AVR microcontroller Atmega328 laid out on the base comes
with builtin bootloader that sets you free from using a separate burner to upload the program on
the board.

Arduino Uno comes with a wide range of applications. A larger number of people are using
Arduino boards for developing sensors and instruments that are used in scientific
research. Following are some main applications of the board.

 Embedded System

 Security and Defense System

 Digital Electronics and Robotics

 Parking Lot Counter

 Weighing Machines

 Traffic Light Count Down Timer

15
 Medical Instrument

 Emergency Light for Railways

 Home Automation

 Industrial Automation

3.2.2.2 RESISTORS :

Electrical resistors are very similar—affected by the same three factors. If you make a wire
thinner or longer, it's harder for electrons to wiggle through it. And, as we've already seen, it's
harder for electricity to flow through some materials (insulators) than others (conductors).
Although Georg Ohm is best known for relating voltage, current, and resistance, he also
researched the relationship between resistance and the size and type of material from which a
resistor is made. That led him to another important equation: In simple words, the resistance (R)
of a material increases as its length increases (so longer wires offer more resistance) and increases
as its area decreases (thinner wires offer more resistance). The resistance is also related to the
type of material from which a resistor is made, and that's indicated in this equation by the symbol
ρ, which is called the resistivity, and measured in units of Ωm (ohm meters). Different materials
have very different resistivities: conductors have much lower resistivity than insulators. At room
temperature, aluminium comes in at about 2.8 x 10−8 Ωm, while copper (a better conductor) is
significantly lower at 1.7 −8 Ωm. Silicon (a semiconductor) has a resistivity of about 1000 Ωm
and glass (a good insulator) measures about 1012 Ωm.

Fig.3.5 Resistors [5]

3.2.2.3 PIR SENSORS :

16
An infrared sensor is an electronic instrument that is used to sense certain characteristics of its
surroundings. It does this by either emitting or detecting infrared radiation. Infrared sensors are

Fig.3.6 PIR sensor [5]

also capable of measuring the heat being emitted by an object and detecting motion. Infrared
technology is found not just in industry, but also in every-day life. Televisions, for example,
use an infrared detector to interpret the signals sent from a remote control. Passive Infrared
sensors are used for motion detection systems, and LDR sensors are used for outdoor lighting
systems. The key benefits of infrared sensors include their low power requirements, their
simple circuitry and their portable features.

3.2.2.4 LCD DISPLAY:

17
In Arduino based embedded system design, the Liquid Crystal Display modules play a very
important role. Hence it is very important to learn about how to interface LCD with an
Arduino of 16×2 in embedded.

The display units are very important in communication between the human world and the
machine world. The display unit work on the same principle, it does not depend on the size of
the display it may be big or the small. We are working with the simple displays like 16×1 and
16×2 units. The 16×1 display unit has the 16 characters which present in one line and 16×2
display units have 32 characters which are present in the 2 line. We should know that to display
the each character there are 5×10 pixels. Thus to display one character all the 50 pixels should
be together. In the display, there is a controller which is HD44780 it is used to control the
pixels of characters to display. The 16×2 liquid crystal display contains two horizontal lines and
they are used for compressing the space of 16 display characters. In inbuilt, the LCD has two
registers which are described below.

 Command Register

 Data Register

Command Register: This register is used to insert a special command in the LCD. The
command is a special set of data and it is used to give the internal command to the liquid crystal
display like clear screen, move to line 1 character 1, setting the curser and etc.
Data Register: The data registers are used to enter the line in the LCD.

Fig.3.7 LCD 16*2 [5]


*PIN DISCRIPTION
18
Pin diagram and description of each pin have explained in the following table.
Pin 1- GND
This pin is a ground pin and the LCD is connected to the Ground.
Pin 2-VCC
The VCC pin is used to supply the power to the LCD.
Pin 3-VEE
This pin is used for adjusting the contrast of the LCD by connecting the variable resistor between VCC
and GND.
Pin 4- RS
The RS is known as register select and it selects the Command/Data register. To select th command
register the RS should be equal to zero. To select the Data register the RS should.
Pin 5-R/W
This pin is used to select the operations of Read/Write. To perform the write operations should be equal
to zero. To perform the read operations the R/W should be equal to one.
Pin 6-EN
This is a enable signal pin if the positive pulses are passing through a pin, then the pin read/write pin.
Pin 7 -DB0 to DB7
The pin 7 contains total 8 pins which are used as a Data pin of LCD.
Pin 15-LED +
This pin is connected to VCC and it is used pin 16 to set up the glow of backlight of LCD.
Pin 16-LED –
This pin is connected to Ground and it is used for the pin15 to set up the glow of backlight.

The following circuit diagram shows the liquid crystal display with the Arduino module. From the circuit
diagram, we can observe that the RS pin of the LCD is connected to the pin 12 of the Arduino. The LCD
of R/W pin is connected to the ground. The pin 11 of the Arduino is connected to the enable signal pin
of LCD module. The LCD module & Arduino module are interfaced with the 4-bit mode in this project.
Hence there are four input lines which are DB4 to DB7 of the LCD. This process very simple, it requires
fewer connection cables and also we can utilize the most potential of the LCD module.

19
Fig. 3.8 Interfacing of LCD with Arduino [6]

LCD Interfacing with the Arduino Module:


The digital input lines (DB4-DB7) are interfaced with the Arduino pins from 5-2. To adjust the contrast
of the display here we are using a 10K potentiometer. The current through the back LED light is from
the 560-ohm resistor. The external power jack is provided by the board to the Arduino. Using the PC
through the USB port the Arduino can power. Some parts of the circuit can require the +5V power supply
it is taken from the 5V source on the Arduino board.

20
Fig.3.9 LCD interfacing [6]

21
3.2.2.5 BREADBOARD:
Introduction: A breadboard is a rectangular plastic board with a bunch of tiny holes in it. These holes
let you easily insert electronic components to prototype (meaning to build and test an early version of)
an electronic circuit, like this one with a battery, switch, resistor, and an LED The connections are not
permanent, so it is easy to remove a component if you make a mistake, or just start over and do a new
project. This makes breadboards great for beginners who are new to electronics. You can use breadboards
to make all sorts of fun electronics projects, from different types of robots or an electronic drum set, to
an electronic rain detector to help conserve water in a garden, just to name a few. The connections are
not permanent, so it is easy to remove a component if you make a mistake, or just start over and do a new
project. This makes breadboards great for beginners who are new to electronics. You can use breadboards
to make all sorts of fun electronics projects, from different types of robots or an electronic drum set, to
an electronic rain detector to help conserve water in a garden, just to name a few.

Fig.3.10 Breadboard [6]

3.2.2.6 CONNECTING WIRES :


Connecting wires allows an electrical current to travel from one point on a circuit to another because
electricity needs a medium through which it can move. Most of the connecting wires are made up of
copper or aluminum. Copper is cheap and good conductivity. Instead of the copper, we can also use silver
which has high conductivity but it is too costly to use.

22
Fig.3.11 Connecting Wires [6]

23
3.2.2.7 LEDS:
A light-emitting diode (LED) is a semiconductor light source that emits light when current flows
through it. Electrons in the semiconductor recombine with electron holes, releasing energy in the form
of photons. This effect is called electroluminescence. The color of the light. (corresponding to the energy
of the photons) is determined by the energy required for electrons to cross the band gap of the
semiconductor. White light is obtained by using multiple semiconductors or a layer of light-emitting
phosphor on the semiconductor device. The current in an LED or other diodes rises exponentially with
the applied voltage, so a small change in voltage can cause a large change in current. Current through the
LED must be regulated by an external circuit such as a constant current source to prevent damage. Since
most common power supplies are (nearly) constant-voltage sources, LED fixtures must include a power
converter, or at least a current-limiting resistor. In some applications, the internal resistance of small
batteries is sufficient to keep current within the LED rating.19 An LED will light only when voltage is
applied in the forward direction of the diode. No current flows and no light is emitted if voltage is applied
in the reverse direction. If the reverse voltage exceeds the breakdown voltage, a large current flows and
the LED will be damaged.

Fig.3.12 LEDS [6]

24
3.2.2.8 DIODES:

A diode is an electrical device allowing current to move through it in one direction with far greater ease
than in the other. The most common kind of diode in modern circuit design is the semiconductor diode,
although other diode technologies exist. symbolized in schematic The term “diode” is customarily
reserved for small signal devices, I ≤ 1 A. The term rectifier is used for power devices, I > 1 A.A forward-
biased diode conducts current and drops a small voltage across it, leaving most of the battery voltage
dropped across the lamp. If the battery’s polarity is reversed, the diode becomes reverse-biased, and
drops all of the battery’s voltage leaving none for the lamp. If we consider the diode to be a self-actuating
switch (closed in the forward-bias mode and open in the reverse-bias mode), this behavior makes sense.
The diagram of simple pn-junction diode is shown below.

Fig. 3.12 Diode [6]

25
3.2.3 PROGRAMMING
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int ledPin = 13;
int ledPin = 13;
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status
int counter = 0;
int currentState = 0;
int previousState = 0;
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(pirPin, INPUT); // declare sensor as input
lcd.begin(16, 2);
lcd.setCursor(4, 0);
lcd.print("counter");
}
void loop(){
val = digitalRead(pirPin); // read PIR sensor input value
if (val == HIGH) { // check if the input is HIGH
digitalWrite(ledPin, HIGH); // turn LED ON
if (pirState == LOW) {
// we have just turned on
currentState = 1;
// We only want to print on the output change, not state
pirState = HIGH;
delay(3000);
}
}
else {
digitalWrite(ledPin, LOW); // turn LED OFF

26
if (pirState == HIGH){
// we have just turned of
currentState = 0;
// We only want to print on the output change, not state
pirState = LOW;
}
}
if(currentState != previousState){
if(currentState == 1){
counter = counter + 1;
lcd.setCursor(4,1);
lcd.print(counter);
delay(200);
}
}
}

27
CHAPTER- IV
IMPLEMENTATION

4.1 WORKING:

The circuit and program for this arduino motion detector project is already discussed above. Now, you
can build this circuit on a breadboard by following the schematics given above and upload the program
which could found at the end of this tutorial. Once your connections are done your set-up should look
like something shown below.

Fig. 4.1 interfacing of PIR sensor with Arduino [5]

28
Now, power on the Arduino and wait for about 50-60 seconds for your PIR sensor to calibrate. Do not
be frustrated by the output that you get during this period. After that, try moving in front of the PIR
sensor and you LED/Buzzer should be triggered as shown in the video below.

The beeping/flashing should stop after some time; you can now toy around the output by varying the
potentiometer to change the sensitivity or the low time of the module. Hope you understood the project
and got it working, if you have any trouble in getting this thing work, you can search out through the
comment section or on our forums.

CODE:

void setup() {

pinMode(2, INPUT); //Pin 2 as INPUT

pinMode(3, OUTPUT); //PIN 3 as OUTPUT

void loop() {

if (digitalRead(2) == HIGH)

digitalWrite(3, HIGH); // turn the LED/Buzz ON

delay(100); // wait for 100 msecond

digitalWrite(3, LOW); // turn the LED/Buzz OFF

delay(100); // wait for 100 msecond

29
4.2 PROGRAMMING THE ARDUINO:

The program for Arduino is pretty simple and straight forward. To connect Arduino PIR Sensor, we
have to assign the pin number 2 as input and pin number 3 as output. Then we have to produce a
discontinuous trigger whenever the pin 2 goes high. Each line is explained below.

In the void setup function shown below, we have to declare that the pin 2 connected to PIR output will
be used as input and the pin 3 connected to LED/Buzzer will be used as input.

void setup() {

pinMode(2, INPUT); //Pin 2 as INPUT

pinMode(3, OUTPUT); //PIN 3 as OUTPUT

Then we proceed to the loop() function. As we know the code in here gets executed as long as the MCU
is powered on. So we always check if the Pin 2 has gone high by using the below line inside the loop()
function.

if (digitalRead(2) == HIGH)

If we find that the particular pin has gone high, it means that the PIR module has be triggered. So, now
we has make our output pin (pin 3) to go high. We turn this pin on and off with a delay of 100 milli
second so that we can attain the flashing or buzzing output. The code to do the same is shown below.

void setup() {

pinMode(2, INPUT); //Pin 2 as INPUT

pinMode(3, OUTPUT); //PIN 3 as OUTPUT

30
}

void loop() {

if (digitalRead(2) == HIGH) // check if PIR is triggered.

digitalWrite(3, HIGH); // turn the LED/Buzz ON

delay(100); // wait for 100 msecond

digitalWrite(3, LOW); // turn the LED/Buzz OFF

delay(100); // wait for 100 msecond


}

31
4.3 WORKING PRINCIPLE PIR SENSOR:

First let’s explain the working principle. The module actually consists of a Pyroelectric sensor which
generates energy when exposed to heat.

Fig.4.2 PIR Sensor [6]

That means when a human or animal body will get in the range of the sensor it will detect a movement
because the human or animal body emits heat energy in a form of infrared radiation. That’s where the
name of the sensor comes from, a Passive Infra-Red sensor. And the term “passive” means that sensor is
not using any energy for detecting purposes, it just works by detecting the energy given off by the other
objects.

Fig.4.3 [6]

32
The module also consists a specially designed cover named Fresnel lens, which focuses the infrared
signals onto the pyroelectric sensor.

4.4 THE HC-SR501 PIR SENSOR MODULE:

The module has just three pins, a Ground and a VCC for powering the module and an output pin which
gives high logic level if an object is detected. Also it has two potentiometers. One for adjusting the
sensitivity of the sensor and the other for adjusting the time the output signal stays high when object is
detected. This time can be adjusted from 0.3 seconds up to 5 minutes.

Fig.4.4 [6]

33
The module has three more pins with a jumper between two of them. These pins are for selecting the
trigger modes. The first one is called “non-repeatable trigger” and works like this: when the sensor output
is high and the delay time is over, the output will automatically change from high to low level. The other
mode called “repeatable trigger” will keep the output high all the time until the detected object is present
in sensor’s range.

34
CHAPTER- V
FUTURE SCOPE AND APPLICATION

5.1 FUTURE SCOPE


Future scope of this system is to decrease no. of thefts and provide security to our homes, shops
and banks etc. This system is handy and portable and thus can easily carried form one place to
another. This system brings modernization to the existing system and add up more features to
the system. The circuit is not that complicated and can be easily trouble shooted. We can add the
GSM Module to this system to determine the position of intruder and send SMS to concerned
an authorities.

5.2 APPLICATIONS
1.Used for security purposes both in commercial and domestic areas like indoor and CCTV
cameras.
2. Cheap and easy to implement.
3. It saves energy by activating and deactivating devices such as LEDs etc.
4. Used to avoid accidents in traffic lights and vehicles.
5.This type of motion sensor can be easily employ for sensitive establishment such as
military.

5.3 BENEFITS OR ADVANTAGES OF PIR SENSOR:

Following are the benefits or advantages of PIR sensor:

➨Detects motion reliably in indoors as well as in day or dark.

➨It consumes less energy (0.8W to 1.0W) compare to microwave sensor.

➨They are cheaper compare to microwave sensors.

➨They are good for electrical applications used in smaller and compact premises.

35
5.4 DRAW BACKS OR DISADVANTAGES OF PIR SENSOR

Following are the drawbacks or disadvantages of PIR sensor:

➨They have lower sensitivity and less coverage compare to microwave sensors.

➨It does not operate greater than 35 degree C.

➨It works effectively in LOS (Line of Sight) and will have problems in the corner regions.

➨It is insensitive to very slow motion of the objects.

➨Since PIR sensors sense heat signatures in room, they are not very sensitive if the room itself

is warm. Hence PIR sensors are not able to detect human beings in the summer in some

countries like INDIA.

➨Snoozing is another problem with PIR sensors. PIR sensors may turn off even if there is very

little movement in occupied floors.

➨Thieves may find it easy to fool PIR detection range as they have slotted detection zone and

not continuous one like microwave sensor.

5.5 ADVANTAGES OF ARDUINO TECHNOLOGY:


 It is cheap

 It comes with an open supply hardware feature that permits users to develop their own kit

 The software of the Arduino is well-suited with all kinds of in operation systems like Linux,

Windows, and Macintosh, etc.

36
 It also comes with open supply software system feature that permits tough software system de-

velopers to use the Arduino code to merge with the prevailing programing language libraries and

may be extended and changed.

 For beginners, it is very simple to use.

5.6 CONCLUSIONS

1. Arduboy, a handheld game console based on arduino.

2. Arduino motion control rig.

3. Arduinome, a MIDI controller device that mimics the monomer.

4. Arduinophone, a do-it yourself cell phone.

5. Ardupolit, drone software and hardware.

6. Ardusat, a cubesat based on arduino.

7. Automatic titration system based on arduino and stepper motor.

8. C-STEM, a platform for hands-on integrated learning of computing, science, technology, engi-

neering, and mathematics(C-STEM) with robotics.

9. DC motor control using arduino and H-bridge.

10. Data loggers for scientific research.

11. Gameduino, an arduino shield to create retro 2D video games.

12. Homemade CNC using arduino and DC motors with close loop control by homofaciens.

13. Impedance sensor system to detect bovine milk adulteration.

37
14. Low cost data glove for virtual reality applications.

15. OBDuino, a trip computer that uses the on-board diagnostics interface found in most modern cars.

16. Water quality testing platform.

17. XOD, a visual programming language for arduino.

18. Xoscillo, an open-source oscilloscope.

REFERENCES

1. https://randomnerdtutorials.com/arduino-with-pir-motion-sensor/
2. https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/using-a-pir
3. https://www.tutorialspoint.com/arduino/arduino_pir_sensor.htm
4. https://en.wikipedia.org/wiki/Passive_infrared_sensor
5. http://www.eaton.in/Eaton/ProductsServices/Electrical/ProductsandServices/Automation
6. https://library.automationdirect.com/what-is-a-limit-switch/
7. https://learn.sparkfun.com/tutorials/voltage-current-resistance-and-ohms-law/resistance
8. https://whatis.techtarget.com/definition/resistance

38

Das könnte Ihnen auch gefallen