There are a number of weaknesses in the security system. I'll list them here, along with the enhancements that will address those weaknesses. Then I'll briefly talk about some alternative architectures that you can build instead of the one I described in this tutorial. First, the weaknesses and fixes....

  • It won't work if the power is cut. Maybe the intruders are smart and cut the power to the building/apartment/office before they break in. Solution: LiPo batteries on each Feather ESP8266 so the sensors will continue working even without USB power. Also, a big 12v battery with an inverter and 5v output connectors to run the wireless access point and MQTT broker server even without mains power (I use a DuraCell AGM 1300 Amp PowerPack Pro).
  • It won't work if the Internet connection is cut. The intruders might be unusually clever and cut both the power and the Internet. Solution: the Raspberry Pi and WiFi will be running from the PowerPack Pro, but the alarms need to get to Adafruit.IO. The solution to that is to fall back to a FONA 800L breakout board. To do this, we'd have to modify the Python program to ping adafruit.com prior to making the connection. If the ping doesn't work, the program can fire up the FONA board and connect to Adafruit.IO that way.
  • Adafruit.IO may be down. Solution: use a backup cloud-based message queue, such as Amazon Web Services (AWS) SQS. This will allow us to test for a successful topic publication and, if it failed, connect to AWS and publish to an alternative queue. This would also require some added expense (though not much) and additional complexity in the program and IFTTT recipes.
  • The intruders might put a very strong magnet outside the door/window close to the switch so they can open the door or window without triggering the alarm. Solution: put Raspberry Pi cameras near the points of ingress and program them to detect motion. I haven't actually tried this myself, but I've seen tutorials online that describe how to do this. It would be fairly straightforward to program the additional Raspberry Pis to send alarms to Adafruit.IO if they detect motion, but the door/window sensors haven't been triggered. This would also allow us to take pictures of the intruders that we can give to the police.
  • Security systems are supposed to have cameras. Solution: add some cameras, as noted above.
  • It would be good to have smoke and carbon monoxide detectors. I agree! Solution: use MQ- series gas sensors to detect smoke and carbon monoxide. Power them from an independent 5v supply and monitor them with a Raspberry Pi. This will require connecting the MQ sensors through an ADS1115 16-bit ADC (Adafruit Product ID 1085) to convert the output voltage from the analog MQ sensors to a digital signal the Raspberry Pi can read.

Finally, here are some alternative design ideas.

Instead of using a Feather ESP8266 for each sensor like I designed, you can save a little money by hardwiring 16 sensors at a time through a signal multiplexer board (these are available from various providers online). This will allow you to run wired connections to each door/window switch and read them directly from the Raspberry Pi via an ADC. I personally wouldn't do this because I hate running long strands of wire all over.

Skip the Raspberry Pi running the MQTT broker and security program. You can do this by doing more clever Lua programming than I've done and keeping track of the sensor state in the ESP8266 itself. Then it can connect directly to Adafruit.IO (I think - haven't tried this myself) to send an alarm when necessary. The IFTTT process would be exactly the same. I didn't do it this way because I'm only now teaching myself Lua and I don't think my Lua skills are up to the task yet.

Let me know if you have other ideas!

Next: the appendix - how to re-flash your ESP8266

This guide was first published on Jun 23, 2016. It was last updated on May 27, 2016.

This page (Alternative Designs and Enhancements) was last updated on Jun 02, 2016.

Text editor powered by tinymce.