Introduction: Arduino Based PIR Motion Sensor

About: hIOTron is an IoT Based company that offers IoT Platforms, IoT Solutions, IoT Training.

With the help of this project, you can control the high state and the sensitivity of PIR.

Supplies

Arduino Uno

PIR Motion Sensor

Buzzer

Software Tool

Arduino IDE

Step 1: PIR Sensor Module

PIR sensor module is utilized for motion detection. It is frequently referred to used "PIR", "Pyroelectric", "Passive Infrared" and "IR Motion" sensor. The module has an on-board pyroelectric sensor, conditioning circuitry and a dome-shaped Fresnel lens. It is utilized to sense the movement of people, animals or other objects. They are generally utilized in burglar alarms and automatically-activated lighting systems.

Step 2: About the Project

PIR Sensor basically is an electronic sensor that regulates infrared (IR) light radiating from objects in its field of view.

These sensors also allow you to sense motion and is mostly utilized to discover whether a human has moved in its range. You will require 5 jumper wires to combine everything, all of these wires should have male-female connectors. You can set the frequency to 3000 Hz because as most alarms use this frequency. The PIR sensor is basically a movement sensor so whenever it recognizes movements, it sets OUT to HIGH, the user can also control the time of this HIGH state and the sensitivity of your sensor with the 2 potentiometers. This project produces beep sounds when any movements are recognized. We can easily modify the time of the beep by changing the delay time at the end of for loop.

IoT Training Online will help you to create more such projects based on Arduino as well as on other IoT platforms to build Industrial IoT Solutions.

Step 3: Circuit Diagram

Step 4: Run a Program

bool isToneOn = false;

int frequency = 3000;

void setup() {

//here is our PIR sensor

pinMode(2, INPUT);

//here is our buzzer

pinMode(3, OUTPUT);

}

void loop() {

//when PIR sensor gives us HIGH it means that it detects movement

if(digitalRead(2) == HIGH){

//we will turn on alarm for 15 seconds

//we are using tone() so we can control frequency of our beep sound

//to turn tone off we have to use noTone()

//if you want to change frequency of tone you can do it in the variable

//on the top of the code

for(int a = 0; a < 30; a++){

if(isToneOn){

noTone(3);

isToneOn = false;

}else{

//3 means our pin where buzzer is connected

tone(3, frequency);

//we have to change this variable to true, we have to know

//when to turn buzzer on and when to turn it on

isToneOn = true; }

//delay 0.5 second, you can change this value so it will

//beep slower or faster

delay(500);

}

}

}