Arduino With PIR Sensor for motion detector

Arduino With PIR Sensor for motion detector

The PIR sensor allows sensing the movement. the sensor is used in many applications like automatic light on and off. In this post, we are going to share how to connect Arduino with PIR sensor. PIR sensors mostly used to detect motion. read the article carefully to learn the project we shared all the detail step by step and if you have any query you can ask us in the comment section. this sensor work on the same principle which we used in Connect potentiometer with Arduino. here we are going to use the same code only we have to calibrate the sensor according to our requirement. that’s why we are sharing the basic with you if you learn the basic once you can make the project by itself. Arduino With PIR Sensor

Hey guys, Welcome back to Techatronic. We are Shahid and Adnan Electronics engineer and we are here to learn you the basic electronics and Embedded with the different microcontroller. we always share our project with you with all the details so you can learn. our motive is to aware the students of the technology.

What is PIR Sensor?

PIR stands for Passive infrared sensor. or it is known as an IR motion sensor. the sensor allows detecting the motion of any person. There are two slots in the PIR sensor. both the slots are made up of a special type of material both the slots sensitive to IR. and there is a lense used at the top of the sensor that doesn’t make more into the sensor. we see that the two openings can ‘see’ out past some distance (fundamentally the affectability of the sensor). At the point when the sensor is inactive, the two openings recognize a similar measure of IR, the encompassing sum emanated from the room or dividers or outside. Arduino PIR sensor project reacts with the LED notification.  When a human body or we can say a warm body like a human or animal passes by, it intercepts one-half of the PIR sensor first, which makes a positive differential change. When the body leaves the sensing area, the reverse phenomena happens, whereby the sensor generates an opposite differential change. These change pulses are what is detected when a human body passes.

How does the Arduino with PIR sensor Works?

Arduino connects with the sensor after uploading the code. Arduino reacts according to the sensor input. when any motion detects in the covered area of the sensor there is a light that will turn on. There are two lights we used one is green and another is red. when the sensor is on the green light is on. and when it detects any motion the red light will be turn on. PIR sensor senses the motion by a warm body differential changes. and send this information to the Arduino from the Arduino input pin. now Arduino compares the value with the database and according to the condition sends the instruction to the LED.PIR sensor interface with Arduino is pretty simple. there are three pins in the sensor. one is VCC another is ground and one output. where we get high or low. there is an ic inbuilt with the sensor which makes the analog differential output to the digital.

Components used:-

  • Arduino Uno
  • PIR sensor
  • LED’S
  • Jumper wire
  • Breadboard

PIR motion sensor Arduino circuit diagram

arduino with pir sensor circuit diagram

Note:- PIR sensor doesn’t work with nonliving things.

Now we are going to share the code

Motion sensor Arduino Code:-

 int val = 0 ;  
 void setup()  
 pinMode(4,INPUT); // pir sensor output pin connected  
 pinMode(7,OUTPUT); // Green led pin  
 pinMode(8,OUTPUT); // Red led pin  
 pinMode(9,OUTPUT); // Buzzer pin  
 void loop()   
 val = digitalRead(4); // pir sensor output pin connected  
 Serial.println(val); // see the value in serial monitor in Arduino IDE  
 if(val == 0 )  
 digitalWrite(7,HIGH);  // Green led on  
 digitalWrite(8,LOW);  // Red led off  
 digitalWrite(9,HIGH); // Buzzer on  
 digitalWrite(7,LOW);  // Green led off  
 digitalWrite(8,HIGH); // Red led on  
 digitalWrite(9,LOW); // Buzzer off  

Upload the given code to the Arduino and Make a circuit diagram properly. all the best.

Leave a Reply