Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Create an Arduino-Based Alarm System

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:

  1. Arduino Uno or any compatible board
  2. PIR Motion Sensor
  3. Buzzer
  4. Breadboard and jumper wires
  5. LED (optional, for visual indication)
  6. Resistor (220 ohms for the LED)

Step-by-Step Guide:

  1. Connect the PIR Sensor:

    • Connect the VCC pin of the PIR sensor to the 5V pin on the Arduino.
    • Connect the GND pin of the PIR sensor to the GND pin on the Arduino.
    • Connect the OUT pin of the PIR sensor to digital pin 2 on the Arduino.
  2. Connect the Buzzer:

    • Connect one terminal of the buzzer to digital pin 9 on the Arduino.
    • Connect the other terminal of the buzzer to GND on the Arduino.
  3. Optional: Connect the LED:

    • Connect the anode (longer leg) of the LED to digital pin 13 on the Arduino through a 220-ohm resistor.
    • Connect the cathode (shorter leg) of the LED to GND on the Arduino.
  4. 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
    }
  5. Testing the System:

    • Power your Arduino board.
    • Observe the serial monitor for motion detection messages.
    • When motion is detected by the PIR sensor, the buzzer should sound and the LED should light up.

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.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.