Step 1: Basic


What is a PIR sensor?
PIR or "Passive Infra-Red" sensor is a "Pyroelectric IR Sensor" which generates energy when exposed to heat. Everything emits some low level of radiation, the hotter the object is, the more radiation is emitted. When a human or an animal (with IR radiation wavelength of 9.4µMeter) approaches the sensors range the sensor detects the heat in the form of infrared radiation. The sensor only detects the energy emitted by other objects and don't produce any, that's why the sensor is called a PIR or "Passive Infra-Red" sensor. These sensors are small, cheap, rugged, low-power and very easy to use.

Step 2: Hardware


 For this tutorial we need:
1 x Breadboard
1 x Arduino Nano/UNO (Whatever is handy)
1 x PIR Sensor
1 x LED and a 220 ohm current limiting resistor to test the connectivity
Few connecting cables
A USB cable to upload the code to the Arduino
& General Soldering Equipments

Step 3: Architecture


As we can see the sensor has two sides:
1. Top or the Sensor Side
2. Bottom or the Components Side
The Top consist of a specially designed 'High-Density Polythene' cover called "Fresnel Lens". This lens focuses the infrared rays to the underlying 'Pyroelectric Sensor'. 9.4 µMeter infrared rays can easily pass through the polyethylene cover. The sensors sensitivity range between 6 to 7 meters (20 feet) and the detection angle is 110 degrees x 70 degrees. The actual sensor is inside a sealed metal can. The can basically protects the sensor from noise, temperature and humidity. There is a tiny window made of IR-transmissive material to allow the IR signals to reach the sensor. Behind this window are 'two' balanced PIR sensors. In idle state, both sensors detect the same amount of IR radiation. When a warm body passes by, it first intercepts one of the two sensors, causing a positive differential change between the two halves. And then, when it leaves the sensing area, the reverse happens, and the sensor generates a negative differential change. When the pulse changes or in other words the PIR sensor detects motion, the output pin changes to "digital high" or 3.3V.
The bottom bit consists of a bunch of circuitry. Few of them are of our interest.
- Most PIR sensors have 3-pins VCC, GND and OUT. VCC and GND are to power the module (Operating voltage: DC 5V to 20V). The OUTPUT pin is the one which communicates with the micro-controller by sending digital pulse high (3.3v) when a motion is detected and digital low (0v) when no motion is detected. The pin-outs may vary between modules so always triple-check the pin-outs.
- The BISS0001 or the "Micro Power PIR Motion Detector IC" gets the output from the sensor and after doing some minor processing it produces the digital output.
- The module has two potentiometers one to adjust the sensitivity (which is up to 7m) and the other to adjust the time for which the output signal should stay high when an object is detected (it ranges from 0.3s to 5 mins).
- There are 3 more pins on this module with a jumper between them to select the trigger modes.
> 1st one is called "non-repeatable trigger" - this one goes low as soon as the delay time is over.
> 2nd one is called "repeatable trigger" - it stays high as long as the object is in the proximity and will turn off once the object is gone and the delay is over. I will be using this mode for this project.
If you want to do a quick test before going ahead with this tutorial please follow the steps below.
A testing is also a good idea to test the range and duration of sensing.

Step 4: Connecting Without Arduino


- Connect the VCC to the +5v rail of the breadboard
- Connect the GND to the -ve rail
- Connect the LED along with a 220 ohm resistor to the OUT pin of the sensor
Now, when the sensor detects a motion, the output pin will go "high" and the LED will light up. Move back and forward to find out the sensing the range. Then to test the duration walk in front of the sensor and then walk away and use a stopwatch to find...

Read more »