Home - Blog

What is a PIR sensor- A Complete User Guide and Examples

What is a PIR sensor? Passive infrared sensors are common in many types of security systems. Our article will elucidate infrared radiation in motion detection, among other critical insights of PIR sensors

What is a PIR sensor?

Fig 1:Motion detector keypad infrared alarm

Fig 1:Motion detector keypad infrared alarm

They are infrared motion sensors that detect movement in the device’s detection range. Hence, these types of motion sensors are common in security alarms. Also, they are helpful in the common types of automatic lighting applications. 

Among the primary advantages of the sensor, types include the following:

  • They are easy to use and don’t easily wear out.
  • Also, most have a wide lens range and consume low power.
  • Thirdly, they are inexpensive and easy to interface with.
  • Lastly, they are small in size and thus portable. 

How PIRs Work?

Fig 2: Motion sensor on an open protected area.

Fig 2: Motion sensor on an open protected area.

PIRs are pyroelectric sensors capable of detecting a particular amount of infrared radiation. Note that almost all objects emit some radiation. Thus, PIRs use this property to identify the presence of an object. 

A PIR sensor in motion sensors has two opposite slots. When in inactive mode, the two slots detect the same heat energy. Usually, this is the ambient temperature of the walls/surrounding room. However, the two slots experience a  positive differential change when an animal passes, thus detecting the object’s presence. 

What is a PIR sensor: Range of Different PIR Sensors

Motion infrared detector connected to the main alarm board.

Fig 3: Motion infrared detector connected to the main alarm board.

  1. Indoor passive infrared and indoor curtain-type

These detect an object from 25cm to 20m.

  1. Outdoor passive infrared and outdoor passive infrared curtain detectors

Are motion detectors for objects from 10m to 150m. 

How do PIRs work with Arduino and Raspberry Pi?

Adjustable infrared pyroelectric, PIR module Motion Sensor

Fig 4: Adjustable infrared pyroelectric, PIR module Motion Sensor. 

PIR-based motion detectors are compatible with Arduino and Rasberry Pi. The following is the procedure for setting up a simple passive motion sensor project with Arduino. 

Components

A Breadboard

Arduino Uno

PIR Sensor

Procedure

  1. You’ll need to connect terminal 2 of the Arduino UNO to the V(output pin) terminal of the PIR Sensor. Also, make sure you connect a 5V  voltage source to the PIR sensor and ground the GND port.
  2. Next, open the Arduino IDE software and create a new sketch file by choosing ‘New.’ 
  3. Thirdly, enter the following code:
Arduino Code.

Figure 5: Arduino Code.

  1. Also, if necessary, adjust the sensor sensitivity and delay time using the two resistors on the sensor board. 
  2. Next, make some motion near the sensor. If it detects some movement, the Arduino will respond by sending a signal via the serial port indicating the presence of motion.
  3. In this instance, the PIR sensor will delay for a short period. Essentially, this is to identify if there’s a new motion. If there isn’t, the Arduino indicates that the motion has ended. 

Comparison of PIR Motion Sensor Series

Conclusion

As you have seen, the PIR sensor works similarly to microwave in motion detection applications. Also, in a nutshell, above are the insights of an active motion sensor. However, if you still have questions about the working of this electronic sensor, talk to us anytime. 

Avatar photo
Hommer Zhao
Hi, I am Hommer, the founder of WellPCB. So far, we have more than 4,000 customers worldwide. If you have any questions, you can feel free to contact me. I really appreciate any help you can provide.

Services