Interfacing PIR Motion Sensor With Arduino .

In this project, we will learn about pir sensor and how it can be used as motion sensor through Arduino PIR sensor tutorial. Going through this project, you can understand how the PIR sensor works and how to hook up a PIR sensor for Arduino.

We have created a project using Arduino, PIR sensor and GSM module called GSM based home security system using Arduino. If you understand how an PIR sensor works, you can do many such interesting projects and even more complex ones.

Overview

A PIER sensor or a passive infrared sensor is an electronic device that measures infrared (IR) light emitted by objects in its observable area. The word ‘passive’ in pir sensor indicates that the sensor does not actually emit any infrared light but passively detects it which is emitted by objects around it.

Every object, its surface temperature is greater than absolute zero i.e.,-2730C emits heat in the form of infrared radiation. Human beings cannot see this radiation because radiations are in infrared wavelengths.

But PIR sensors detect these radiations and turn them into proper electrical signals.

PIR Sensor

A PIR sensor looks like the one shown in the image below. To connect to external devices, it has only three Pins, namely VCC, Digital Out (Data) and GND.

At the top of the sensor board, there is a special type of lens called fresnel lens that covers the actual pyroelectric sensor. The work of fresal lenses is to focus all infrared radiation on pyroelectric sensors.

If you look at the back of the PIR sensor board, the entire circuitry is kept there. The brain of pir sensor module is BISS0001 PIR Motion Detector IC. Near this IC, we have two powerful meters, one to adjust sensitivity and the other to adjust the time of delay.

Using sensitivity adjusted, you can control the range of the viewing area and in our sensors, it is up to 7 meters. Using delay time adjust, you can control the duration for which digital out will remain high when the moving object is detected.

How PIR Sensor works?

PIR sensors are complex compared to most other sensors. Pir Motion sensor may look simple When everything you have to do is applied, the high signal is checked on the digital out pin of the sensor whenever the motion is detected.

But, internally, a lot is going on and the input and output of the sensor is dependent on many variables.

The actual PIR sensor, which is covered with a lens, has two slots and these two slots are made of IR sensitive materials. In the normal situation where there is no movement in front of the sensor, both slots in the sensor detect the same amount of infrared radiation.

When there is movement in front of sensors, such as humans or cats, their radiation is interpreted by one of the first slots and the difference between the two slots becomes positive.

As the person goes away, the second slot detects radiation and the difference output will be negative. A proposal is explored on the basis of these production pulses.

Arduino PIR Sensor: PIR Motion Sensor using Arduino

Let’s create a small motion sensor or motion detector project using arduino and PIR sensors. In this project, the PIR sensor detects any movement in front of it and indicates arduino. Whenever any movement is detected, Arduino will activate an alarm as a buzzer.

This circuit does not implement a key design, but how to interface a PIR sensor for Arduino and how to use data from PIR sensors and how to run loads such as relays, GSM modules, buzzers etc. , gives an idea about it.

Circuit Diagram

Components Required

  • Arduino UNO
  • PIR Sensor
  • 5V Buzzer
  • Breadboard
  • Connecting Wires
  • Power Supply
  • Led Bulb

The design of pir motion sensor using Arduino is very simple. The motion sensor module has three pins: VCC, Digital Out and GND. Connect VCC pin to +5V and GND pin to GND respectively. The digital out pin of pir sensor was followed by Arduino’s Digital I/2. Connect to O Pin 8.

As we need to indicate motion detection by sensor, connect a buzzer to Arduino’s Pin 11.

Code

int buzzer = 11;
int sensor = 8;
int led = 13;
void setup()
{
pinMode(buzzer, OUTPUT);
pinMode(sensor, INPUT);
pinMode(led, OUTPUT);

digitalWrite(buzzer,LOW);
digitalWrite(sensor,LOW);

digitalWrite(led,LOW);

while(millis()<13000)
{
digitalWrite(led,HIGH);
delay(50);
digitalWrite(led,LOW);
delay(50);
}
digitalWrite(led,HIGH);

}

void loop()
{
if(digitalRead(sensor)==HIGH)
{
digitalWrite(buzzer,HIGH);
delay(3000);
digitalWrite(buzzer,LOW);
while(digitalRead(sensor)==HIGH);
}

}

Related posts

Leave a Comment