Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Importance and Utility of PIR+Motion+Sensor
The PIR (Passive Infrared) Motion Sensor is a commonly used sensor in various applications, including security systems, home automation, and robotics. It detects movement by sensing changes in infrared radiation emitted by living beings or objects in its field of view. This sensor is highly useful for detecting human presence, triggering alarms, activating lights, and controlling other devices based on motion.
Project: Motion-Activated LED Light
In this example project, we will create a motion-activated LED light using an Arduino board and a PIR motion sensor. The objective is to turn on an LED when motion is detected and turn it off after a certain period of inactivity. This project can be used to automate lighting in areas where motion detection is desired, such as hallways, staircases, or closets.
List of Components:
You can find these components at [link to purchase].
Examples:
Before writing the code, let's wire the components as follows:
int pirPin = 2; // PIR motion sensor output pin
int ledPin = 13; // LED pin
void setup() {
pinMode(pirPin, INPUT); // Set PIR pin as input
pinMode(ledPin, OUTPUT); // Set LED pin as output
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int motion = digitalRead(pirPin); // Read PIR sensor output
if (motion == HIGH) { // Motion detected
digitalWrite(ledPin, HIGH); // Turn on LED
Serial.println("Motion detected!");
} else { // No motion
digitalWrite(ledPin, LOW); // Turn off LED
Serial.println("No motion detected.");
}
delay(100); // Delay for stability
}
By expanding on this project, you can create a simple home security system. For example, you can add a buzzer or send a notification to your smartphone when motion is detected. Additionally, you can connect the Arduino to a relay module to control other devices, such as turning on lights or activating a camera.