Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Creating an alarm system using Arduino is a practical and educational project that can help you understand the basics of electronics, programming, and security systems. Arduino, an open-source electronics platform, is ideal for building customized alarm systems because of its flexibility and ease of use. In this article, we will guide you through the process of creating a simple alarm system using an Arduino board, a passive infrared (PIR) motion sensor, and a buzzer.
Examples:
Components Needed:
Step-by-Step Guide:
Connect the PIR Sensor:
Connect the Buzzer:
Optional: Connect the LED:
Arduino Code: Upload the following code to your Arduino board. This code reads the PIR sensor's output and triggers the buzzer and LED when motion is detected.
const int pirPin = 2; // PIR sensor output pin
const int buzzerPin = 9; // Buzzer pin
const int ledPin = 13; // LED pin (optional)
void setup() {
pinMode(pirPin, INPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int pirState = digitalRead(pirPin);
if (pirState == HIGH) {
digitalWrite(buzzerPin, HIGH); // Activate buzzer
digitalWrite(ledPin, HIGH); // Turn on LED
Serial.println("Motion detected!");
} else {
digitalWrite(buzzerPin, LOW); // Deactivate buzzer
digitalWrite(ledPin, LOW); // Turn off LED
Serial.println("No motion.");
}
delay(500); // Delay for stability
}
Testing the System:
This simple alarm system can be expanded by adding more sensors, integrating with a GSM module for SMS alerts, or connecting to a Wi-Fi module for remote monitoring.