The PIR motion sensor is ideal to detect movement. PIR stand for “Passive Infrared”. Basically, the PIR motion sensor measures infrared light from objects in its field of view. So, it can detect motion based on changes in infrared light in the environment. It is ideal to detect if a human has moved in or out of the sensor range.
|SENSOR PIN||ARDUINO CONNECTION|
|OUTPUT||Arduino Any Digital Pin|
|5V DC||5V Dc|
PIR Sensor Features
1. Wide range on input voltage varying from 4.V to 12V (+5V recommended)
2. Output voltage is High/Low (3.3V TTL)
3. Can distinguish between object movement and human movement
4. Has to operating modes – Repeatable(H) and Non- Repeatable(H)
5. Cover distance of about 120° and 7 meters
6. Low power consumption of 65mA
7. Operating temperature from -20° to +80° Celsius
How to use PIR Motion Sensor
The PIR sensor stands for Passive Infrared sensor. It is a low cost sensor which can detect the presence of Human beings or animals. This sensor has three output pins Vcc, Output and Ground as shown in the pin diagram above. Since the output pin is 3.3V TTL logic it can be used with any platforms like Arduino, Raspberry, PIC, ARM, 8051.
The module can be powered from voltage 4.5V to 20V but, typically 5V is used. Once the module is powered allow the module to calibrate itself for few minutes, 2 minutes is a well settled time. Then observe the output on the output pin. Before we analyse the output we need to know that there are two operating modes in this sensor such as Repeatable(H) and Non- Repeatable(L) and mode. The Repeatable mode is the default mode.
ALL SENSOR DETAILS:
1. HC-05 – Bluetooth
2. Mpu 6050 accelerometer-gyroscope- -module
PIR Sensor Applications
1. Automatic Street/Garage/Warehouse or Garden Lights.
2. Burglar Alarms.
3. Security cams as motion detectors.
4. Industrial Automation Control.
PIR WITH ARDUINO CIRCUIT DIAREAM
Copy and paste the below given or download from the bottom mentioned link.
* Circuito.io is an automatic generator of schematics and code for off the shelf hardware combinations.
// Include Libraries
// Pin Definitions
#define LEDR_PIN_VIN 5
#define PIR_PIN_SIG 2
// Global variables and defines
// object initialization
// define vars for testing menu
const int timeout = 10000; //define timeout of 10 sec
char menuOption = 0;
// Setup the essentials for your circuit to work. It runs first every time your circuit is powered with electricity.
// Setup Serial which is useful for debugging
// Use the Serial Monitor to view printed messages
while (!Serial) ; // wait for serial port to connect. Needed for native USB
menuOption = menu();
// Main logic of your circuit. It defines the interaction between the components you selected. After setup, it runs over and over again, in an eternal loop.
if(menuOption == ‘1’)
// LED – Basic Red 5mm – Test Code
// The LED will turn on and fade till it is off
for(int i=255 ; i> 0 ; i -= 5)
ledR.dim(i); // 1. Dim Led
delay(15); // 2. waits 5 milliseconds (0.5 sec). Change the value in the brackets (500) for a longer or shorter delay in milliseconds.
ledR.off(); // 3. turns off
else if(menuOption == ‘2’)
// PIR (motion) sensor – Test Code
bool pirVal = pir.read();
Serial.print(F(“Val: “)); Serial.println(pirVal);
if (millis() – time0 > timeout)
menuOption = menu();
// Menu function for selecting the components to be tested
// Follow serial monitor for instrcutions
Serial.println(F(“\nWhich component would you like to test?”));
Serial.println(F(“(1) LED – Basic Red 5mm”));
Serial.println(F(“(2) PIR (motion) sensor”));
Serial.println(F(“(menu) send anything else or press on board reset button\n”));
// Read data from serial monitor if received
char c = Serial.read();
if(c == ‘1’)
Serial.println(F(“Now Testing LED – Basic Red 5mm”));
else if(c == ‘2’)
Serial.println(F(“Now Testing PIR (motion) sensor”));
time0 = millis();
Download Arduino Code Here Pir_with_Arduino Uno code After downloaded extract and open folder then double click Arduino uno code. Then compile and upload the sketch to Arduino Uno Project board.