

A Passive Infrared (PIR) motion sensor detects motion by measuring changes in infrared radiation, typically emitted by warm bodies. It is a low-cost, low-power device widely used in motion detection applications. PIR sensors are commonly found in security systems, automatic lighting, and energy-saving devices. They are ideal for detecting human or animal movement within a specific range.








| Pin Name | Description |
|---|---|
| VCC | Power supply input (4.5V to 20V DC) |
| GND | Ground connection |
| OUT | Digital output signal |
Below is an example of how to connect and use a PIR motion sensor with an Arduino UNO to control an LED.
// PIR Motion Sensor with Arduino Example
// This code turns on an LED when motion is detected by the PIR sensor.
#define PIR_PIN 2 // Define the pin connected to the PIR sensor's OUT pin
#define LED_PIN 13 // Define the pin connected to the LED
void setup() {
pinMode(PIR_PIN, INPUT); // Set PIR sensor pin as input
pinMode(LED_PIN, OUTPUT); // Set LED pin as output
Serial.begin(9600); // Initialize serial communication for debugging
}
void loop() {
int motionDetected = digitalRead(PIR_PIN); // Read the PIR sensor output
if (motionDetected == HIGH) { // If motion is detected
digitalWrite(LED_PIN, HIGH); // Turn on the LED
Serial.println("Motion detected!"); // Print message to serial monitor
} else {
digitalWrite(LED_PIN, LOW); // Turn off the LED
Serial.println("No motion."); // Print message to serial monitor
}
delay(100); // Small delay to stabilize readings
}
False Triggers:
No Detection:
Output Signal Stuck High/Low:
Q: Can the detection range be adjusted?
Q: How long does the output signal stay high after motion is detected?
Q: Can I use a PIR sensor outdoors?
Q: What is the difference between retriggering and non-retriggering modes?