PIR sensors are everywhere because it is almost impossible to visualize without them every day in modern life. These sensors are less costly, very simple to utilize, and consistent, so applicable in door openings, security alarms, vending machines, automatic lighting switches, lift lobbies, and many more. Since these sensors are designed with many benefits they have been used in different electronic projects related to Raspberry Pi & Arduino. All these readily available resources, it has really helped beginners to learn about the passive infrared sensor. So this article discusses an overview of a PIR sensor – working with applications.
What is PIR Sensor?
PIR sensor definition is; a sensor that is used to measure infrared light radiating from objects like the human body or animals. In PIR sensor, the term PIR stands for “passive infrared sensor”. PIR sensors can detect the movement of an animal or human within a fixed range. Generally, all objects at above zero temperatures produce heat energy in the IR radiation form. So if the object is hotter then it emits more radiation. So this kind of radiation is not observable to the human eye as it is emitted at IR wavelengths. So PIR sensor is particularly designed for detecting such infrared radiation levels. These sensors are most frequently utilized in motion detectors, security alarms & automatic lighting-based applications.
Pin Configuration
The typical PIR sensor pin configuration is shown below which includes three pins where each pin and its functionality are discussed below.
Pin1 (VCC): This is a source terminal of the device which is connected to the 5V DC supply.
Pin2 (OUT): This is the o/p pin of the sensor.
Pin3 (GND): This is a ground pin.
Working Principle
A PIR sensor includes two main parts like pyroelectric sensor and fresnel lens. In the following diagram, the sensor is a round metal including a rectangular crystal within the center. A fresnel lens is a special lens that focuses the IR signals on the pyroelectric sensor. Here, the pyroelectric sensor is capable of detecting different infrared radiation levels.
The Pyroelectric Sensor
This sensor has a window including two rectangular slots & is made of a coated silicon material that simply allows IR radiation to flow. After this window, there are two separate IR sensor electrodes where one electrode is responsible for generating the positive output & the other electrode is responsible for generating the negative output.
Whenever there is no movement in the region of the sensor, then both slots can detect a similar amount of IR radiation which results in a zero o/p signal. Although, when a human body or an animal moves in the region of the sensor, first it interrupts half of the sensor. So it causes a positive differential change between the two halves. Once the human body interrupts the other half of the sensor then the opposite happens & the sensor generates a negative differential change. So by reading this change within voltage, then motion is detected.
Fresnel Lens
The Fresnel lens in the sensor increases the sensor’s field & range of view of the sensor. It is lightweight, slim & outstanding light gathering capacity which will make it very useful for making this sensor small in size and also powerful.
Whenever a person enters the detecting range, then the sensor light will get the IR wave automatically from the human body, the IR wave will be detected & the light will be turned ON. Once the human body moves away from the detecting region, then IR waves are not obtained & the lights are turned off automatically. So this type of sensor light devoid of any switch is generally known as PIR motion sensor light. If the person does not leave the detecting region, the sensor switch will be turned on continuously. Once a person leaves the detecting region, then the delay will turn off the switch automatically.
Specifications & Features
The features and specifications of the PIR sensor include the following.
- The recommended input voltage supply is +5V.
- The output voltage is 3.3V.
- It can differentiate between the movement of an object & human.
- Operating modes are repeatable & Non- Repeatable.
- The current drain is <60uA.
- The detection angle is <140°
- The detection distance is 3 to 7m.
- Blockade time by default is 2.5s.
- Working temperature ranges from -20-+80°C.
- Low power utilization – 65mA.
PIR Sensor Types
There are two types of PIR sensors which include the following.
Thermal Infrared Sensor
Thermal Infrared sensor or Pyroelectric Infrared sensor uses heat energy source like Infrared to detect the objects. These types of sensors are slow in their responsiveness & detection time.
Quantum Infrared Sensor
This sensor detects photons that depend on the wavelength. These photons are very responsive than those detecting heat. These types of sensors are very fast in their responsiveness & detection time but need frequent cooling for exact measurement.
PIR Sensor Circuit Diagram
PIR sensor is generally used in security-based designs & because of its low cost & robust operation; this sensor can also be used to design simple security circuits. Here, the motion detector circuit is designed with a PIR sensor & a Relay to switch ON the bulb once the sensor detects the motion of humans.
The required components to build this motion detector circuit mainly include a 5V relay, PIR sensor, BC547 Transistor, 1KΩ resistor, 1N4007 diode, 9V battery, and electric bulb. Give the connections as per the circuit shown below.
Working
This circuit is designed with a few basic and easily obtainable electronic components. In this circuit, the PIR sensor plays a key role. This PIR sensor includes three terminals as discussed above & it provides logical output once detects the motion of humans.
The output pin of this sensor is connected to the base terminal of the BC547 switching transistor. The relay coil is connected to the collector terminal of the transistor & another Relay coil end is simply connected to the +ve supply. In this circuit, the electric bulb is connected with Normally Open (N/O) terminal. Once the Relay is turned on, then the common pin of this will make contact with the N/O pin & after that bulb starts to glow.
This motion detector circuit can be simply used anyplace like front gate or staircase, etc. Once the passive infrared sensor detects the movement of a person then it will activate Relay to make the bulb glow. Thus it can be used in security circuits, stand-alone alarms, or light automation circuits.
PIR Sensor Interfacing with Microcontroller
Interfacing PIR with 8051 microcontrollers is shown below. This sensor detects motion within the room, automatic lighting system, washroom amenities, automatic door within the elevator, etc. The required components for interfacing mainly include a PIR sensor, an 8051 microcontroller, and an LCD module.
PIR sensor function is to detect the human body/animal’s motion. This sensor gets infrared rays from human bodies & generates electrical signals. A PIR sensor includes two slots that are responsive to IR. Once any person enters/leaves the detecting region of these two slots, then it causes positive & negative differential changes in between these slots. So this change is simply detected & utilized to produce a signal.
8051 microcontroller is an 8-bit microcontroller that includes an 8-bit processor. So it works on 8-bit data at a time. This microcontroller is a very popular & frequently used microcontroller. When it is an 8-bit microcontroller, then it has an 8-bit data bus and a 16-bit address bus and also it includes ROM-4 KB with RAM-128 bytes. Please refer to this to know more about the 8051 microcontroller Architecture.
The LCD display is a very significant module used in different circuits and devices. So, these modules are mainly preferred over 7- segments & other multi-segment LEDs. These displays are easily programmable; economical; have no control over displaying special characters and custom characters also. Please refer to this to know more about the LCD
The connections of this interfacing follow as;
The VCC pin of this sensor is connected to 5V.
The GND pin of this sensor is connected to GND.
The output pin of this sensor is connected to the P1.0 pin of the microcontroller.
The RS pin of an LCD is connected to the P2.0 pin of the microcontroller.
The RW pin of an LCD is connected to the P2.1 pin of the microcontroller.
The EN pin of an LCD is connected to the P2.2 pin of the microcontroller.
The EN pin of an LCD is connected to the P2.2 pin of the microcontroller.
The data pin of the LCD is connected to P3.0 – P3.7 of the microcontroller.
Code
#include<reg51.h>
#define lcd P3
sbit PIR=P1^0;
sbit rs=P2^0; //register select
sbit rw=P2^1; //RW
sbit en=P2^2; //enable
void lcd_init();
void cmd(unsigned char);
void dat(unsigned char);
void delay();
void lcd_string(char *s);
void main()
{
lcd_init();
lcd_string(” EmbeTronicX “);
while(1) {
if(PIR == 0) {
cmd(0xc0);
lcd_string(“Intruder Detcted”);
delay();
} else {
cmd(0xc0);
lcd_string(” “);
}
}
}
void lcd_init()
{
cmd(0x38);
cmd(0x0e);
cmd(0x06);
cmd(0x01);
cmd(0x80);
}
void cmd(unsigned char a)
{
lcd=a;
rs=0;
rw=0;
en=1;
delay();
en=0;
}
void dat(unsigned char b)
{
lcd=b;
rs=1;
rw=0;
en=1;
delay();
en=0;
}
void lcd_string(char *s)
{
while(*s) {
dat(*s++);
}
}
void delay()
{
unsigned int i;
for(i=0;i<20000;i++);
}
Once the code is uploaded to the microcontroller then the sensor detects the presence of humans and then LCD will display the detected Intruder. You can also include a buzzer to specify the presence of humans.
Difference b/n PIR Sensor and Motion Sensor
The difference between the PIR sensor and motion sensor includes the following.
PIR Sensor |
Motion Sensor |
A PIR sensor is an electronic device used to measure IR light that is radiating from objects including humans and animals within its field of view. | A motion is an electronic device used to detect as well as measure the movement of nearby objects and people. |
PIR sensor is also called a passive infrared sensor. | The motion sensor is also called a motion detector. |
It is affected by the weather. | It is not affected by weather conditions. |
This sensor has a shorter life as compared to a motion sensor. | This sensor has longer life as compared to the PIR sensor. |
This sensor is used in thermal detecting applications like security & motion detection. | This sensor is used in business & home security systems; however, it can also be used in phones, game consoles, virtual reality systems & paper towel dispensers. |
This sensor has low sensitivity as compared to a motion sensor. | This sensor has much high sensitivity. |
The electricity consumed by this sensor is 0.8 W – 1.0 W. | The electricity consumed by this sensor is 1.1 W – 1.5 W. |
This sensor has a slotted detection zone. | This sensor has a continuous detection zone. |
Advantages
The advantages of the PIR sensor include the following.
- This sensor is safe and conserves energy.
- It doesn’t emit any kind of radiation.
- These sensors detect IR light from several feet away based on the calibration of the device.
- These sensors are compact & can be easily fitted into any electronic device.
- They do not require an exterior power source because they produce electricity when they absorb IR light.
- It detects motion consistently indoors & in a day time otherwise dark.
- As compared to microwave sensors, it consumes less power.
- These are less costly.
Disadvantages
The disadvantages of the PIR sensors include the following.
- These sensors have less sensitivity & coverage as compared to microwave sensors.
- These sensors do not function above 35 degrees Centigrade.
- This sensor efficiently works in line of sight & will have difficulties in the corner areas.
- It is not sensitive to extremely slow movement of objects.
- PIR sensors are not capable of detecting human beings in the summer season.
- These sensors may deactivate even if there is a little movement within occupied floors.
Applications
The applications of PIR sensors include the following.
- PIR sensors are used in lighting controls, HVAC systems, thermostats, digital signage, smart home & IoT, Surveillance systems, IP cameras, automatic door openings, security alarm systems, etc.
- These sensors are used in human detection-based robots, stepper motor control, video conference systems, printers for multi-functioning, vending machines, intrusion alarms, IP cameras, and wake-up switches in LCD panels and displays.
Please refer to the link N76E003AT20 Microcontroller.
Thus, this is brief information on a passive infrared sensor like working, types, features, specifications, interfacing, advantages, disadvantages, and its applications. Here is a question for you, what is an IR sensor?