Close
0%
0%

Arduino based PIR Motion sensor

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

Similar projects worth following
In this project, we have described how you can control the high state and the sensitivity of PIR.

About 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.

  • 1 × Arduino Uno
  • 1 × PIR Motion sensor
  • 1 × Buzzer

  • 1
    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);
    }
    }
    }

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates