Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Arduino Uno Based PIR Sensor.

Uploaded by

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

Arduino Uno Based PIR Sensor.

Uploaded by

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

IRE 216: Sensor Technology Sessional

Experiment No: 06.


Experiment Name: Study and Observation of Arduino Uno Based PIR Sensor.
Objective:
To study and observe the functionality of a PIR (Passive Infrared) sensor using an Arduino Uno, and to
control an LED based on motion detection.
Theory:
A PIR sensor detects infrared radiation emitted by warm objects, such as humans or animals, within its
range. When a PIR sensor senses motion, it outputs a HIGH signal, which can trigger connected devices
like an LED. In this experiment, the PIR sensor is interfaced with an Arduino Uno to control an LED
turning it on when motion is detected and off when no motion is present.
Required Hardware with Quantity:
1. Arduino Uno - 1
2. PIR Sensor - 1
3. LED - 1
4. Resistor (220Ω) - 1
5. Connecting Wires
Required Software:
• Arduino IDE
Working Procedure:

1. Setup the Hardware:

• Connect the PIR sensor to the Arduino Uno. The VCC pin of the sensor goes to the 5V
pin on the Arduino, GND to GND, and the OUT pin to a digital input pin (e.g., D2) on
the Arduino.
• Connect an LED to another digital pin (e.g., D13) with a 220Ω resistor in series.
• Use jumper wires to make all necessary connections on the breadboard.

2. Write the Code:

• Open the Arduino IDE and write the code to read the digital output from the PIR sensor
and control the LED based on motion detection.
• Upload the code to the Arduino Uno.

3. Test the Setup:

• Power the Arduino Uno using a USB cable or an external power supply.
• Observe the LED and the serial monitor in the Arduino IDE to see the motion detection
readings and the LED status.
IRE 216: Sensor Technology Sessional

Hardware Arrangement Diagram:

Fig 01: Hardware Diagram

Sketch:

// Define pin numbers


int pirPin = 2; // Pin connected to the PIR sensor's output
int ledPin = 13; // Pin connected to the LED (built-in LED on most Arduino boards)
int buzzerPin = 8; // Pin connected to the buzzer
void setup() {
// Initialize the PIR sensor input pin
pinMode(pirPin, INPUT);

// Initialize the LED and buzzer output pins


pinMode(ledPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
// Start serial communication for debugging (optional)
Serial.begin(9600);
}
IRE 216: Sensor Technology Sessional

void loop() {
// Read the PIR sensor's output
int pirState = digitalRead(pirPin);
// Check if motion is detected
if (pirState == HIGH) {
// Motion detected, turn on the LED and buzzer
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(buzzerPin, HIGH);
Serial.println("Motion detected!");
} else {
// No motion, turn off the LED and buzzer
digitalWrite(ledPin, LOW);
digitalWrite(buzzerPin, LOW);
Serial.println("No motion.");
}
// Small delay for stability
delay(1000);
}

Result and Output:


When the PIR sensor detects motion within its range, the LED lights up.

Fig 02: Motion detected, led is high

Otherwise, the LED remains off.


IRE 216: Sensor Technology Sessional

Fig 03: No motion, led is low.


IRE 216: Sensor Technology Sessional

Fig 04: Serial Monitor

Conclusion:
This experiment successfully demonstrates the use of an Arduino Uno and a PIR sensor to detect motion
and control an LED. The PIR sensor outputs a digital signal when motion is detected, which is read by the
Arduino to turn on the LED. This setup can be used in various applications, such as security systems and
automated lighting.

You might also like