Subscribe To Our List

We help electronics hobbyists to create projects related to Micro-controllers. Join our newsletter to get access to new projects first.
Email address
Secure and Spam free...

In this tutorial, you will learn about the HC-SR01 PIR Motion sensor Arduino interfacing. We will connect the PIR motion sensor and the buzzer with the Arduino in a way that whenever any body will come near the sensor, then the buzzer will start to beep until the body will be in the range of the sensor.

HC-SR01 PIR Motion Sensor

PIR stands for passive infra-red. The HC-SR01 motion sensor is the passive sensor which means that it uses the energy given by the other objects which comes near it. It does not uses its own energy for detecting purposes.

Working Principle

PIR Motion sensor consists of a pyroelectric sensor which is the main part of this module. The pyroelectric sensor generates energy when exposed to heat. The Fresnel lens placed on the pyroelectric sensor focuses the infrared signals on the pyroelectric sensor and increases the sensitivity of the motion sensor.

inside PIR Motion sensor

The human or animal body emits the heat energy in the form of infrared radiation. So whenever a human or animal body comes near the sensor, the sensor will detect the movement and will generate energy (Output pin will go high).

PIR Motion Sensor working

HC-SR01 PIR Motion Sensor Pinout

On the back side, the sensor has three pins; GND, OUT, VCC. The OUT pins will go HIGH whenever the sensor will detect a movement. The VCC and GND pins are for powering the module

The two potentiometers are for selecting the sensitivity and the delay time. The sensitivity can be increased up to 7m and the delay time can be set from 0.3s to 5 mins.

Then there is a Micro Power PIR Motion Detector IC which makes the output pin HIGH whenever the sensor detects a motion.

Then there are three pins for selecting the trigger mode. The repeatable trigger mode will keep the output HIGH until the object will be in sensor range. The unrepeatable trigger mode will keep the output HIGH until the delay time is over.PIR motion sensor pinout

Components required for this Tutorial

  • Arduino Uno
  • HC-SR01 PIR Motion sensor
  • Buzzer
  • Connecting wires

Circuit Diagram

The motion sensor has just three pins; connect the left pin to GND of Arduino, center pin to pin 2 of Arduino and the right pin to 5V pin of Arduino.

Then connect the positive wire of buzzer to pin 11 of Arduino and the negative wire to GND of Arduino.

I have set the sensitivity and the delay time too minimum (Potentiometers moved to left) and have selected the repeatable trigger mode.

PIR motion sensor Arduino interfacing

Code

After uploading the code, wait for about a minute so that the sensor can warm up. Then put your hand in front of the sensor and the senor will start to beep. The sensor will keep on beeping until the hand will be in the range of sensor because the sensor is in the repeatable trigger mode. If you want the sensor to stop beeping after the delay time of sensor, then use the non-repeatable trigger mode.

int OUT_pin = 2;
int buzzer_pin = 11;

void setup() {
pinMode(OUT_pin, INPUT); //Pin 2 as INPUT
pinMode(buzzer_pin, OUTPUT); //PIN 11 as OUTPUT
}

void loop() {
if (digitalRead(OUT_pin) == HIGH)
{
digitalWrite(buzzer_pin, HIGH); // turn the Buzzer ON
delay(100); // wait for 100 milli second
digitalWrite(buzzer_pin, LOW); // turn the Buzzer OFF
delay(100); // wait for 100 milli second
}
}

Video

If you have any questions, feel free to ask us in the comment section.

JOIN OUR NEWSLETTER
We help electronics hobbyists to create projects related to Micro-controllers. Join our newsletter to get access to new projects first.
We hate spam. Your email address will not be sold or shared with anyone else.

Leave a Reply

Your email address will not be published.

Subscribe To Our List

We help electronics hobbyists to create projects related to Micro-controllers. Join our newsletter to get access to new projects first.
Email address
Secure and Spam free...
Skip to toolbar