PIR Sensors (Passive Infrared) are the standard sensors used for motion detection. They offer a wide field of view and are easy to configure, but offer only HIGH/LOW output and are not overly accurate.
Functional Parts in the Project:
- Arduino Uno – https://store.arduino.cc/usa/arduino-uno-rev3
- PIR Sensor (HC-SR501) – https://amzn.to/2Yv3Lnu
- 560 Piece Jumper Wire Kit – https://amzn.to/2MsCLjL
#define pirSensor 8
int reading;
void setup() {
pinMode(pirSensor, INPUT);
Serial.begin(9600);
}
void loop() {
reading = digitalRead(pirSensor);
if (reading == HIGH) {
Serial.println("Motion");
} else {
Serial.println("0");
}
}
Be the first to comment