Magnetic Door Alarm System
A simple security device
Author: Băluțoiu Ana-Maria
GitHub Project Link: https://github.com/UPB-FILS-MA/project-arshiii16
Description
The magnetic door alarm is a simple security device that alerts you when a door is opened. It works by using a Hall Effect sensor to detect the presence of a magnet (usually attached to the door) and triggers an alarm (such as a buzzer) when the magnetic field changes (i.e., when the door opens). The alarm serves as a warning or deterrent against unauthorized access.
Motivation
I chose this project because it is straightforward and doesn’t require complex components or intricate circuitry. The Hall Effect sensor, 555 timer IC, and a few other basic components are affordable and readily available. Also, I think everybody wants to know when someone opens the doors around the house, whether it’s for security reasons or just to keep track of household activity. This alarm serves that purpose efficiently. Finally, it’s a great way to learn about basic electronics, sensors, and timers.
Architecture
Here’s a description of the system components and their interactions:
- Hall Effect Sensor: The Hall Effect sensor is the input component that detects changes in magnetic fields. When a magnet (such as the door magnet) approaches or moves away from the sensor, it generates a signal. The sensor’s output is a digital signal (high or low) indicating whether the door is open or closed.
- Raspberry Pi Pico (Microcontroller): The Raspberry Pi Pico serves as the central processing unit (CPU) for the system. It reads the output from the Hall Effect sensor. Based on the sensor input, the Pico decides whether to trigger the alarm or keep it silent. The Pico can also control other components, such as the buzzer and LED.
- Alarm Logic: The Pico runs a simple program (written in Rust) that monitors the Hall Effect sensor. If the sensor detects the door opening (magnet moving away), the Pico activates the alarm. If the sensor detects the door closing (magnet approaching), the Pico deactivates the alarm. The alarm logic ensures that the system responds appropriately to door movements.
- Buzzer and LED: The buzzer and LED are output components. When the alarm is triggered (door opens), the Pico activates the buzzer to produce an audible sound. Simultaneously, the LED lights up to provide a visual indication of the alarm state. When the door closes, the Pico turns off the buzzer and LED. Connections: The Hall Effect sensor connects to a GPIO pin on the Pico. The buzzer and LED connect to other GPIO pins. The Pico’s Rust program reads the sensor input, controls the buzzer and LED, and manages the alarm state.
Log
Week 6 - 12 May
Hardware Design: I selected necessary components, including the Hall Effect sensor, a 555 timer IC, a buzzer, resistors, two LEDs, a capacitor, a transistor. Circuit Design: Created a circuit diagram connecting the components.
Week 7 - 19 May
Software Setup: Opened KiCad and created a new project. Component Placement: Added components from the hardware design to the schematic and connected them according to the circuit diagram.
Week 20 - 26 May
Hardware
The magnetic door alarm project uses the following hardware components:
- Hall Effect Sensor (3144): Detects the presence of a magnet (door open).
- 555 Timer IC: Generates an adjustable alarm tone.
- Buzzer: Produces the alarm sound.
- LED: Provides visual indication.
- Transistor (BC547): Controls the 555 timer.
- Magnet: Attached to the door frame.
- Reed Switch: Mounted on the door itself.
- Raspberry Pi: It will serve as the brain of this project, allowing the user to control the alarm system, read sensor data, and execute the alarm logic. These components work together to create a simple yet effective door alarm system.
Schematics
This is the Kicad Schematic: Here are some photos of the hardware:
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico W | The microcontroller | 35 RON |
LED 5 mm | Provides visual indication. | 0.39 RON |
Hall Effect Sensor (3144) | Detects the presence of a magnet(door open). | 3.21 RON |
555 Timer IC | Generates an adjustable alarm tone. | 2.41 RON |
Buzzer | Produces the alarm sound. | 3.33 RON |
Transistor (BC547) | Controls the 555 timer. | 1.68 RON |
Reed Switch | Mounted on the door itself. | 1.49 RON |
10uF Capacitor (C1) | Connected to pin 2 of the 555 timer. | 4.41 RON |
50k Potentiometer (RV1) | Adjusts the alarm frequency. | 1.49 RON |
Software
Library | Description | Usage |
---|---|---|
rppal | Raspberry Pi Peripheral Access Library | Provides an interface for accessing various Raspberry Pi peripherals |
panic-halt | panic handler that halts the program | Used to handle panics gracefully |