Materials Required:
PIR Sensor ModuleArduino UNO (any version)
LED
Buzzer
Breadboard
Connecting Wires
330 ohm resistor
PIR sensor:
The PIR sensor stands for Passive Infrared sensor. It is a low cost sensor which can detect the presence of Human beings or animals. There are two important materials present in the sensor one is the pyroelectric crystal which can detect the heat signatures from a living organism (humans/animals) and the other is a Fresnel lenses which can widen the range of the sensor. Also the PIR sensor modules provide us some options to adjust the working of the sensor as shown in below imageThe two potentiometers (orange color) are used to control the sensitivity and trigger on time of the sensor. Basically the Dout pin of the sensor is present in between the Vcc and Gnd pins. The module works on 3.3V but can be powered with 5V as well. On the top left corner it also has a trigger pin setup which can be used to make the module work in two different modes. One is the “H” mode and the other is the “I” mode.
In “H” mode the output pin Dout will go high (3.3V) when a person is detected within range and goes low after a particular time (time is set by potentiometer). In this mode the output pin will go high irrespective of whether the person is still present inside the range or has left the area. We are using our module in “H” mode in our project.
Circuit Diagram and Explanation:
The circuit Diagram for arduino motion detector project by interfacing Arduino with PIR module and blinking an LED/Buzzer is shown in the below image
Code
void setup () {
pinMode (2, INPUT); // Pin 2 as INPUT
pinMode (3, OUTPUT); // PIN 3 as OUTPUT
}
void loop () {
if (digitalRead (2) == HIGH)
{
digitalWrite (3, HIGH); // turn the LED / Buzz ON
delay (100); // wait for 100 msecond
digitalWrite (3, LOW); // turn the LED / buzz OFF
delay (100); // wait for 100 msecond
}
}
No comments