In this Arduino Tutorial, we learn how to use this simple PIR sensor module. The passive infrared sensor is a very useful device. The cost of it is very low as well. With less than 2 euros you can add motion detection to your Arduino projects. It is very easy. Continue reading our detailed tutorial and see how to do it.

Intro to the Arduino PIR sensor Tutorial

In this tutorial, we build a simple but very useful project. This project can detect movement of a person in an area. When it detects movement it lights up the LED for a few seconds. Look when I place my hand in front of the sensor the LED lights up. Of course in your project, you can replace this small LED with a big one in order to light a room when motion is detected or sound an alarm, or send an SMS to your cell phone and so on. Let’s now see how to build this project.

Passive infrared sensors allow you to sense motion and are used to detect whether a human has moved in or out of the sensors range. If we remove the lens we can see that PIR sensors use a pyroelectric sensor. This little sensor here which detects infrared radiation that is emitted by objects. The hotter the object the more radiation it emits. The sensor in a motion detector is split into two halves. When one half “reads” more radiation than the other there was movement and we can send a signal out to perform any action we like.

——————–
WHERE TO BUY
——————–

1. PIR sensor: https://educ8s.tv/part/PIRSensor

2. Arduino Uno: https://educ8s.tv/part/ArduinoUno

3. LED: https://educ8s.tv/part/LEDs

4. Wires: https://educ8s.tv/part/Wires

Full disclosure: All of the links above are affiliate links. I get a small percentage of each sale they generate. Thank you for your support!

[adsense]

The PIR sensor module we use today has three pins. This one is Vcc. It is next to the protection diode. Next to it is the output pin and the last pin is Ground. If the module detects movement the output pin goes HIGH. The module also uses two trimpots. This one sets the sensitivity of the sensor and this one sets the time that the output signal stays HIGH when motion is detected. Let’s now connect the module to Arduino. Vcc goes to Arduino 5V. Ground goes to Arduino Ground and output goes to digital pin 9. Of course, you can use any digital pin you like. Next, we connect the LED The positive leg of the LED goes to digital pin 13 and the other one to Ground. Now we are ready to power on our project and see if it is working. We have to wait for about a minute in order to the sensor to stabilize and then we are ready to use it. OK thirty seconds later that PIR sensor has stabilized and as you can see it can detect the movement of my hand. Let’s now go to the computer and see the software side the project.

The Code of the Arduino PIR sensor tutorial

The code to the project is very simple. We don’t even need a library. All we do is to read the output pin of the PIR sensor all the time. If the output signal from the PIR sensor is HIGH we light up the LED else we turn it off. As always you can find the code of the project in the description of the video. That’s how easy it is to connect the PIR sensor to any Arduino project. The low cost of it allow us to use it in many projects. What projects do you want to build with this sensor? Please post your ideas in the comments section below and I will try to build as many as possible.

——————–
CODE
——————–

 

 

 

——————–

SUBSCRIBE ON YOUTUBE

——————–

Never miss a video: Subscribe to educ8s.tv