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

Lab Assignment 4 of iot

The document outlines a lab assignment for developing an intrusion detection system using an Arduino and a PIR motion sensor. It includes a list of required components, circuit connections, and Arduino code for detecting motion and triggering an alarm. The system is designed to monitor an area for intrusions and provide visual or auditory alerts when motion is detected.

Uploaded by

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

Lab Assignment 4 of iot

The document outlines a lab assignment for developing an intrusion detection system using an Arduino and a PIR motion sensor. It includes a list of required components, circuit connections, and Arduino code for detecting motion and triggering an alarm. The system is designed to monitor an area for intrusions and provide visual or auditory alerts when motion is detected.

Uploaded by

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

Madhav Institute Of Technology And Science

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

SESSION- January-May(2024)
Lab assignment 4 of IOT

Submitted to Submitted by
Dr. Devesh Kumar Lal Sahil Karkhur
0901CD211046
Develop an intrusion detection system through motion
sensors.
.
Components Needed:
Arduino board (e.g., Arduino Uno)
PIR motion sensor module
Buzzer or LED for alarm indication
Breadboard
Jumper wires

Circuit Connection:
Connect the VCC pin of the PIR sensor to the 5V pin of the Arduino.
Connect the GND pin of the PIR sensor to the GND pin of the Arduino.
Connect the OUT pin of the PIR sensor to a digital pin (e.g., pin 2) of the Arduino.
Connect the positive terminal of the buzzer or LED to a digital pin (e.g., pin 3) of the Arduino.
Connect the negative terminal of the buzzer or LED to the GND pin of the Arduino.
// Define the pins
const int pirPin = 2; // PIR sensor output pin
const int alarmPin = 3; // Buzzer or LED pin

void setup() {
pinMode(pirPin, INPUT);
pinMode(alarmPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
.
int pirState = digitalRead(pirPin); // Read PIR sensor
state

if (pirState == HIGH) {
// Motion detected
Serial.println("Intrusion detected!");
digitalWrite(alarmPin, HIGH); // Turn on the alarm
delay(1000); // Delay for 1 second
digitalWrite(alarmPin, LOW); // Turn off the alarm
}
Explanation:

In the setup() function, we set the PIR sensor pin as an input and the alarm pin as an output.
In the loop() function, we continuously monitor the state of the PIR sensor using digitalRead(pirPin).
If motion is detected (i.e., the PIR sensor output is HIGH), we print a message to the serial monitor
and trigger the alarm by setting the alarm pin HIGH for a brief period.
We include a small delay after triggering the alarm to prevent rapid consecutive triggers due to
continuous motion detection.
Deployment:

Upload the Arduino code to the Arduino board.


Place the motion sensor in the area you want to monitor for intrusions.
Connect the buzzer or LED to the Arduino for alarm indication.
Power the Arduino using a suitable power source.
Operation:

When motion is detected by the PIR sensor, the buzzer or LED will be activated briefly, indicating an
intrusion.
You can adjust the sensitivity and detection range of the motion sensor if needed.
Monitor the serial output for intrusion detection messages.

You might also like