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

Door Alarm System

The Importance and Utility of Door Alarm Systems

Door alarm systems are essential for maintaining security and safety in various settings, such as homes, offices, and commercial buildings. These systems provide an effective way to monitor and protect entry points, alerting individuals to any unauthorized access or potential threats. By implementing a door alarm system, you can enhance the overall security of your premises and have peace of mind knowing that your property is well-protected.

Project: Creating a Door Alarm System

In this project, we will create a simple yet effective door alarm system using an Arduino board and a few components. The main objective of this project is to detect the opening and closing of a door and trigger an alarm whenever unauthorized access is detected. The system will be able to monitor the status of the door in real-time and provide immediate alerts when necessary.

List of Components:

  1. Arduino Uno - 1x
  2. Reed Switch - 1x
  3. Buzzer - 1x
  4. LED - 1x
  5. Resistor (220 ohms) - 1x
  6. Jumper Wires - As required

Note: You can purchase these components from various online platforms or local electronics stores.

Examples:

Example 1: Door Status Monitoring

const int reedSwitchPin = 2;
const int buzzerPin = 3;
const int ledPin = 4;

void setup() {
  pinMode(reedSwitchPin, INPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  int doorStatus = digitalRead(reedSwitchPin);

  if (doorStatus == HIGH) {
    digitalWrite(buzzerPin, HIGH);
    digitalWrite(ledPin, HIGH);
    delay(500);
    digitalWrite(buzzerPin, LOW);
    digitalWrite(ledPin, LOW);
    delay(500);
  }
}

Explanation:

  • We define the necessary pins for the reed switch, buzzer, and LED.
  • In the setup function, we set the pinMode for each pin.
  • The loop function continuously checks the status of the reed switch.
  • If the reed switch status is HIGH (door is open), the buzzer and LED are turned on for 500 milliseconds and then turned off for another 500 milliseconds.

Example 2: Adding Delayed Alarm Activation

const int reedSwitchPin = 2;
const int buzzerPin = 3;
const int ledPin = 4;

void setup() {
  pinMode(reedSwitchPin, INPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  int doorStatus = digitalRead(reedSwitchPin);

  if (doorStatus == HIGH) {
    delay(5000); // Delay for 5 seconds before activating the alarm
    int newDoorStatus = digitalRead(reedSwitchPin);

    if (newDoorStatus == HIGH) {
      digitalWrite(buzzerPin, HIGH);
      digitalWrite(ledPin, HIGH);
      delay(500);
      digitalWrite(buzzerPin, LOW);
      digitalWrite(ledPin, LOW);
      delay(500);
    }
  }
}

Explanation:

  • This example adds a delay of 5 seconds before activating the alarm.
  • After the initial door status check, the program waits for 5 seconds.
  • If the door is still open after the delay, the alarm is triggered as before.

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.