Overview
In this project, we’ll build a PIR motion sensor system with an Arduino. When motion is detected, the LED will turn on.
SR602
The SR602 PIR sensor is a small, low-power motion detector module often used in hobbyist and DIY electronics projects. It is based on Passive Infrared (PIR) technology, meaning it detects motion by sensing changes in infrared radiation emitted by objects, such as humans or animals.
Key Features
- Operating Voltage: 3.3V to 9V (commonly used at 3.3V or 5V).
- Detection Range: Typically 3 to 7 meters, adjustable with a resistor.
- Output: Digital signal (HIGH when motion is detected, LOW otherwise).
- Detection Angle: Around 100°.
- Quiescent Current: Very low, typically < 20 µA, making it suitable for battery-powered applications.
- Time Delay: Fixed to approximately 2 seconds.
- Compact Size: Ideal for space-constrained projects.
Pinout
- VCC: Power input (3.3v - 5v).
- OUT: Digital output (motion detected = HIGH, no motion = LOW).
- GND: Ground.
Wiring
Using the SR602 PIR sensor with an Arduino is a simple and effective way to create a motion detection system. Below is a step-by-step guide for wiring, programming, and running your Arduino with the SR602 PIR sensor.
1. Wiring the SR602 to Arduino
Connection Diagram:
SR602 PIR Sensor | Arduino |
---|---|
VCC | 5V |
OUT | GPIO 3 |
GND | GND |
Arduino Code
The Arduino will read the digital signal from the SR602 sensor’s OUT pin to determine whether motion is detected.
Code Explained
The SR602’s OUT pin outputs HIGH when motion is detected and LOW (0V) when no motion is detected. The Arduino reads this signal through the digitalRead() function.
If motion is detected, the onboard LED (GPIO 22) turns on, and a message is printed to the Serial Monitor.
Testing the Setup
- Upload the code to the Arduino using the Arduino IDE.
- Open the Serial Monitor (Ctrl + Shift + M) and set the baud rate to 9600.
- Move your hand or body within the sensor’s range (approximately 3-7 meters), and observe the serial output or LED.
- The SR602 has a fixed time delay of about 2 seconds; once motion is detected, the output remains HIGH for 2 seconds before resetting to LOW.
Tips
If you experience noise in the output, add a small ceramic capacitor (e.g., 0.1 µF) between VCC and GND near the sensor to stabilize power.****