This project was to build a simple garage security system to alert of intruder access to the garage by notification over Wifi.
Parts list
Wemos D1 mini & mini protoboard
The esp8266 is the workhorse of any project - it monitors the sensors and sends notifications over Wifi. I used the Arduino system with Platformio for development.
For the small amount of circuitry required one of these tiny protoboards:
![D1 mini protoboard](/images/mini protoboard.jpg)
Magnetic contacts
You can either get contacts that attach on the door and frame, or ones that fit flush inside the door/door frame. The flush ones look better, but take a bit more time to install (drilling / chiselling required), and require the door and frame are both wood.
![Magnetic contact patio door](/images/magnetic contact patio door.jpg) ![Magnetic contact slim flush](/images/magnetic contact slim flush.jpg)
Weather proof box
To stop the spiders having a field day on the D1 mini it’s worth protecting it in a box. A bargain at £1.02.
![Box](/images/junction box ip55.jpg)
Alarm cabling
To connect the sensors I used 6-core cabling, only using 2 of the cores.
![Alarm cable](/images/alarm cable.jpg)
Other parts
- Cable clips
- Cable ties
- PCB mountable screw terminals
- USB power supply
Cost
Part | Price | Source |
---|---|---|
Wemos D1 mini | ~$3 | aliexpress |
D1 mini protoboard | ~$.40 (5 for $4) | aliexpress |
Door contact | £2.80 | toolstation |
Flush door contact | £1.22 | toolstation |
IP55 box | £1.02 | toolstation |
USB mains plug | £2 |
(Excuse the confusing mix of currencies!)
All in, around £10 is pretty good value for the project.
Tools required
- Drill
- 20mm spade bit (for the flush sensor)
- 3.5mm wood drill bit
- Screwdrivers
- Soldering iron & solder
- Wire cutters
- Wire strippers
Circuit
It’s a very simple circuit - D1/D2 are wired into one side of the contacts, and the other side is grounded. D1/D2 are set as pull-up using the internal esp8266 pull-up resistors.
I didn’t connect the tamper circuit on the sensors, since this doesn’t really add anything security wise.
The code is pretty simple, so I’ve left as an exercise. Mine integrates into my home automation system sending MQTT messages on events, but you could equally call an HTTP url, for example.
I powered it by USB since our garage is wired up with mains, of course if someone breaks in they can just switch off the power to the D1, but hopefully it’ll beat them to sending out a notification of the door sensor being triggered.
Also, MQTT ‘wills’ might be an interesting feature to use here, so if the node is disconnected from Wifi for whatever reason a message fires. Something like a software tamper switch.
Install the sensors
Time for some woodworking!
![Garage flush sensor](/images/garage flush sensor.jpg)
Final result
![Garage final](/images/garage final.jpg)
It works well. There’s plenty of scope to expand - eg add a siren alarm (may need step-up voltage to 12V).