0% found this document useful (0 votes)
19 views

Experiment 7 - PIR Sensor

pir
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Experiment 7 - PIR Sensor

pir
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Experiment No 7 Student ID

Date Student Name


Motion Detection using PIR Sensor and Arduino Genuino UNO
AIM:
The primary objective of this experiment is to detect the motion of an object using a PIR sensor, turn
an alert via an LED or buzzer, and display the object's motion status on the serial monitor.

Components required:

Software Hardware
Arduino UNO Board
Arduino UNO Cable
Tinkercad PIR Sensor
Arduino IDE (To be installed in Laptop) LED (Red-1)
Buzzer - 1
Resistors – 1 (220Ω each)
Jumper wires
Description:
PIR stands for Passive Infrared Sensor.

 It is called passive sensor because it does not emit the IR rays. It only receives the IR rays.

 PIR sensor allows detecting or sensing the motion.

 It is small, Inexpensive and low power device.

 It is non wearable device for that reason they are commonly found in appliances and gadgets
used in homes or businesses.

 It is having 3 pin structure where , Pin 1 is Vcc (+5v), Pin 2 is Output and Pin 3 is ground  All
pins must be connected with arduino pins.

 PIR sensor can detect animal/human movement in a requirement range.  For Indoor passive
infrared Detection distances range from 25 cm to 20 m  For Outdoor passive infrared, the detection
distance ranges from 10 meters to 150 meters.

 It detects infrared radiation from the environment. Once there is infrared radiation from the human
body particle with temperature, focusing on the optical system causes the device to generate a sudden
electrical signal.
Pre lab:

1. What is the working principle of PIR sensor with Arduino?

Once the sensor detects any motion, Arduino will send a message via the serial port to say
that a motion is detected. The PIR sense motion will delay for certain time to check if there
is a new motion. If there is no motion detected, Arduino will send a new message saying
that the motion has ended.

2. How do you interface a PIR sensor with Arduino?

Connect the Gnd pin of sensor to the ground of Arduino. Vcc pin of the sensor to 5V of
Arduino. And signal / output pin to digital pin 5 of Arduino board. Led connections -
Positive terminal of the led to digital pin 9 of Arduino.

3. What is the main function of PIR sensor?

A passive infrared sensor (PIR sensor) is an electronic sensor that measures infrared (IR)
light radiating from objects in its field of view. They are most often used in PIR-based
motion detectors. PIR sensors are commonly used in security alarms and automatic lighting
applications.

4. What is the range of PIR sensor in Arduino?


The sensor can detect motion in a range from as close as 2 meters up to 7 meters.

In lab:

Program:

int sensorval=0;
void setup()
{
Serial.begin(9600);
pinMode(3, INPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
}

void loop()
{
sensorval=digitalRead(3);
if (sensorval == HIGH)
{
tone(7,800);
digitalWrite(8, HIGH);
Serial.println("Motion of object Detected");

}
else
{
noTone(7);
digitalWrite(8, LOW);
Serial.println("No Motion of object");
}
delay(1000);
}
Connection Diagram:

PROCEDURE:
1. Give the connections to the Arduino board as shown in the connection diagram.
2. Open Arduino IDE in the computer
3. Create new file File_--→ New
4. Type your program and Save it in appropriate location in your computer.
5. Compile your program by clicking Verify option in the menu.
6. Once the program compiled successfully, connect the Arduino board to the computer using
USB cable.
7. After connecting, go to Tools ----→Board ---→ Select Arduino/Genuino Uno option
8. After selecting board, go to Tools ----→Port ---→ Select Arduino Uno COM port 3
(name may appear differently for other computers).
**Note that this port option will be displayed only when board is connected to computer
9. Now upload the program to the Arduino board by clicking Upload option.
10. Once the program uploaded successfully, open serial monitor window in Arduino IDE to
see the value of PIR sensor. When you give motion Infront of sensor, observe the value
changes in serial monitor.
Schematic Diagram:

Result:

Inferences/Analysis:
POST-LAB

PIR Sensor - Arduino UNO – Relay, Bulb & Battery

Code:

int SensorValue;
void setup()
{
pinMode(13, INPUT);
pinMode(3, OUTPUT);
Serial.begin(9600);
}

void loop()
{
SensorValue = digitalRead(13);
Serial.println(SensorValue);
if (SensorValue ==HIGH)
{
digitalWrite(3,HIGH);
}
else
{
digitalWrite(3,LOW);
}

}
Viva Questions:

1. How to interface the PIR Sensor module?

Connect the Gnd pin of sensor to the ground of Arduino. Vcc pin of the sensor to 5V of
Arduino. And signal / output pin to digital pin 5 of Arduino board.

2. What is a PIR sensor and how does it work?


A PIR (Passive Infrared) sensor is a motion detection sensor that detects infrared radiation
emitted by objects in its field of view. It works by detecting changes in infrared radiation
caused by the movement of objects, particularly warm-bodied humans or animals. The sensor
consists of a pyroelectric sensor that generates an electrical signal when it detects variations
in the received infrared radiation.

3. Is that PIR Sensor is Analog Sensor or Digital Sensor?

A PIR (Passive Infrared) sensor is typically a digital sensor. It provides a digital output
signal, typically in the form of a logic high or low, indicating the presence or absence of
motion. The sensor's output is not continuous or analog, but rather discrete and digital in
nature.

RESULT:

You might also like