How To Work With PIR Sensor Using Arduino

Introduction

 
In this article, we are going to see how to work with the PIR  sensor using  Arduino. It has become very easy to detect human and animal movements using PIR sensor. These projects further can be modified to create a security system. 
 
Materials required
  • PIR sensor module
  • Arduino UNO
  • LED
  • Buzzer
  • Breadboard
  • connecting wires
  • 330-ohm resistor
Working
 
The following steps for working the process are given below,
 
Step 1
 
The first step is to create the connection as in the circuit diagram for the Arduino human detector project below.
 
IoT
 
Step 2
 
The second step is the programming of the Arduino board. Download the Arduino IDE software and install it on the computer.
 
Once installed, open the Arduino software and open a new page in the software.
 
IoT
 
Step3
 
Then, connect your Arduino board to the laptop or desktop and click TOOL→ Select BOARD →  then press ARDUINO/GENUINO UNO
 
IoT
 
Set to the board as Arduino Uno.
 
Step4       
 
Again, select TOOL → Select a PORT→ COM3 ARDUINO UNO.
 
IoT
 
Port set the COM3
 
Step5
 
I have given a source code that you can use to create the application, or you can use your own source code.  The Arduino code is using digital pin  3 & 4. I have given the coding for Arduino. First, you will see in the void setup ().  You have to set the pin mode, for the Arduino control to project components.   
 
IoT
 
Next is void loop() command in the Arduino software. I have used the If condition in my Coding. Set pin number 4 as HIGH & I have declared an integer value data.
Digital write sets the pin number to 5. I have used pin 5 as output from Arduino to the buzzer and light. There running process and stop the process of Arduino pin 5 are controlled by PIR sensor. 
 
The source code of Arduino,
  1. void setup() {  
  2.     pinMode(4, INPUT);  
  3.     pinMode(5, OUTPUT);  
  4. }  
  5. void loop() {  
  6.     int data = digitalRead(4);  
  7.     if (data == HIGH) {  
  8.         digitalWrite(5, HIGH);  
  9.         delay(200);  
  10.     } else {  
  11.         digitalWrite(5, LOW);  
  12.     }  
Step 6
 
Compile and upload the code in the Arduino UNO board. You can see the working process of the human detector project.
 
IoT
 

Summary

 
The concepts in this article can be implemented for bank security systems and this will be helpful for IoT beginners. This can be extensively updated in the project. For example, you can add a camera.
 
I hope this article is very interesting and useful. I have more exciting articles coming up.