กลับไปหน้ารวมไฟล์
door-alarm-5f0f27-en.md

The finished project

Interaction and Design

The core concept of this project is a Door Alarm. The system is designed to be placed near a doorframe, where an Ultrasonic Sensor (HC-SR04) continuously monitors the distance to any objects in its path. If someone passes through the door, the sensor detects the change in distance and triggers an alarm.

Components in Detail

  • Ultrasonic Ranging (HC-SR04): The sensor sends out sound waves and measures the "time of flight" for them to return. This is translated into a distance value by the Arduino.
  • Audio Output: A Buzzer is connected to digital pin 9. When the alarm is triggered, the Arduino generates pulses at a specific frequency to create a loud, attention-grabbing sound.
  • Visual Effects: A Green LED is used as a status indicator. It is normally OFF but turns ON when the alarm is active.
  • Arduino Mega 2560: While an Uno could also work, the Mega provides plenty of pins and memory for expanding the project in the future.

Assembly Guide

1. Hardware Connection

Connect the HC-SR04 sensor to pins 2 (Echo) and 3 (Trig). Connect the buzzer to pin 9 and the LED to pin 13. Ensure all ground pins are connected together.

2. Software Calibration

The distance measured by the sensor is compared against a threshold value. You'll need to measure the width of your doorframe and set this value accordingly in the code using an if statement.

3. Enclosure and Mounting

Mount the entire system into a small box and attach it to the side of a doorframe. Make sure the sensor has a clear, unobstructed path across the door.

Security and Implementation

Once the system is powered and calibrated, any movement through the door will be detected within milliseconds, providing an immediate and reliable alarm. You can also experiment with different pulse patterns for the buzzer and LED to make the alarm more effective!

ข้อมูล Frontmatter ดั้งเดิม

title: "Door alarm"
description: "A basic door alarm that turns on a buzzer and led when some \"trips\" the alarm"
author: "eaglestrike66"
category: ""
tags:
  - "audio"
  - "home automation"
views: 1014
likes: 1
price: 1120
difficulty: "Easy"
components:
  - "1x 5 mm LED: Green"
  - "1x Buzzer"
  - "1x Jumper wires (generic)"
  - "1x Solderless Breadboard Half Size"
  - "1x Arduino Mega 2560"
  - "1x Male/Female Jumper Wires"
  - "1x Ultrasonic Sensor - HC-SR04 (Generic)"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles:
  - "https://create.arduino.cc/editor/eaglestrike66/d2a1cde3-1da6-477c-8265-ba60f1043405"
  - "https://create.arduino.cc/editor/eaglestrike66/d2a1cde3-1da6-477c-8265-ba60f1043405"
documentationLinks: []
passwordHash: "00f5a8fa9044796c936c6042e5d784943a8b8118f1698371e9d5d49ece6c126f"
encryptedPayload: "U2FsdGVkX1+SnGWn26bH5lw5Pa2WunG/2XxrgSFugAOqxuMpU883+LxlBomh0ccZJo25GlAQ+XNjcre0jyxULlKiIc4H2hLulEbxsgy8Bj0="
seoDescription: "Build a basic Arduino Door alarm to trigger a Buzzer and LED when tripped. A simple DIY security project for beginners."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/door-alarm-5f0f27_cover.jpg"
lang: "en"