Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Raspberry Pi 

raspberry pi alarm system

Hey, title pretty much says it all. I'm looking to build a magnetic door alarm with my raspberry pi, that when activated sounds an alarm or some shit. Do you think this would be possible? 🤗
just lurkin thru
Absolutely possible and actually not that difficult. A quick google search on this will show you a few dozen different variations of home security systems. If you want something simple to start with, search for "twitter door". It's a system that tweets every time a door sensor is triggered. You can easily learn from that to figure out how to get different things to happen.
Magnetic switch + resistor to pull it low.
Forsure, Thanks ya'll ill check it out
just lurkin thru
The magnetic sensor is referred to as a "reed switch." Essentially, you have two wires coming from the GPIO to both ends of the reed switch. Easy, one to GND and the other to whatever GPIO you'd like on the Rpi.

To get it work, you do an internal pullup through code on that GPIO so that it goes high and provides a debounced' signal. (Feel free to Googles) When the circuit is complete and is connected to ground, that pin will digitally read 0/False. Otherwise 1/True. Therefore, you have a sensor.

From there is whatever you may imagine. You'll need an amplifier of sorts to get any decent audio from an Rpi. Keep in mind wood swells during the seasons and it can throw off door sensors that use reed switches as they will not be aligned right.
(May 7, 2018 06:59 PM)datguy.dev Wrote:  The magnetic sensor is referred to as a "reed switch." Essentially, you have two wires coming from the GPIO to both ends of the reed switch. Easy, one to GND and the other to whatever GPIO you'd like on the Rpi.

To get it work, you do an internal pullup through code on that GPIO so that it goes high and provides a debounced' signal. (Feel free to Googles) When the circuit is complete and is connected to ground, that pin will digitally read 0/False. Otherwise 1/True. Therefore, you have a sensor.

From there is whatever you may imagine. You'll need an amplifier of sorts to get any decent audio from an Rpi. Keep in mind wood swells during the seasons and it can throw off door sensors that use reed switches as they will not be aligned right.

Thanks for the detailed info, I will buy some parts soon. 👍
just lurkin thru
(May 8, 2018 04:05 PM)SIM-2362224 Wrote:  Thanks for the detailed info, I will buy some parts soon.  👍

Before you buy parts. In my opinion, you may want to go with a hall effect sensor instead of a reed switch. It detects the presence of a magnetic field. Marginally more complicated. But it'll provide you more flexibility and accuracy with readings. You can take it one step further and go analog with the sensor readings. Without an ADC, your in digital-land of 1's and 0's. But analog can provide a range of 0-1024 for example. Like you can say 500 and up is a closed door which makes the alarm more accurate or sophisticated. There are ADC modules for the Rpi that work over i2c; only need two GPIO. You could also use a laser or infared (IR) sensor as well. Good luck!


Possibly Related Threads...
Thread / Author Replies Views Last Post
by vonlukFeb 29, 2024 12:58 PM 0 199 Feb 29, 2024 12:58 PM
Last Post: vonluk
by crashandburn90Dec 22, 2021 06:04 AM 16 1,636 Dec 22, 2021 06:04 AM
Last Post: SIM-5126972
by cslimSep 25, 2019 07:21 AM 5 188 Sep 25, 2019 07:21 AM
Last Post: cslim