This has certainly taken the longest out of everything in my room to develop and so I continually add to it when I think of new ideas...

The designs started on a breadboard with a simple tactile button and some LED's.
Now the project has migrated into a more permanent enclosure in a project box which sits outside my room next to my door.

Brief Summary

Perhaps the most significant part of my automation system is the security suite that I have built. What stated as an LED that turns on when my door is opened has now tuned into a fully functioning alarm that takes pictures, makes noises and even emails me! Accompanying this is the RFID card reader and a key switch for dead-locking the system.



Everything is controlled and detected through the Raspberry Pi's GPIO Pins with a combination of the built in SPI and I2C interfaces as well as standard GPIO inputs and outputs. Below is the most recent 'pinout' of the Pi which shows everything that is currently connected.

Pi GPIO Pinout

Being somewhat organized I have made some custom jumper wires to go from the Pi to box outside my room so that I can easily plug and unplug connections as required. This is achieved through the use an Ethernet cable as well as a telephone (power) wire. All of these run round underneath my carpet to the door of my room and give me a total of 18 wires to use. The Ethernet cable was bought as a spool of 50m (150ft) so that I could just cut it to the required length and solder some terminals on the end. I am currently in the process of crimping RJ45 Jacks to the ends of the cables so that the system can be more modular and I can connect/disconnect everything more easily.

The main circuitry

As you can see, some of the wiring is still quite messy however throughout the process of making everything more modular it should clear up a bit and be more elegant to see! All of the hardware is in a 'box' of my bookshelf which is in the corner of my room meaning that it allows pretty easy access for when I need to add more to the system or more often than not fix something that I have broken. Usually I will only have the server running when I am at home unless I am showing what it can do to someone else and I need remote access to it. Although I do have the full security system that can alert me whenever someone comes in, it is more of a proof of concept and a demonstration that I am in fact able to build such systems.

Most of the programming that I do is in Python as it was one of the first languages that I learned (Self Taught) as well as it being very widely supported on the Raspberry Pi. Other languages include bash for some of the system files that are running the background, some C/C# for the Arduino side of things. For the web side of my server I have used a combination of the usual HTML (5), CSS JavaScript (Mostly JQuery), PHP and MySQL. This allows me to do most of what I would like to do and when I find that there is something that I can't quite do yet I simply Google it and learn! This is perhaps the greatest benefit of what I have made in my room. By having a Linux-based server with real-world connectivity through it's GPIO pins, when I think of a new project to design, build and test I am able to just start coding 99% of the time as everything is already set up for me!

So onto the Security System and how it works... Outside my room a project box is mounted on an old speaker stand and this houses all of the circuitry for for RFID reader and the I2C IO expander. This is connected to the Pi, as mentioned before, with the use of an Ethernet cable and a telephone cable too.

Security Control Panel

There is a program that is constantly running in the background to check the status of the door (Is it opened or closed), checking if there is an RFID card being swiped, if the system is armed or not, if the system is paused or not etc. This program is mostly made up of interrupts, functions and methods and really needs to be tidied up soon as I add more and more too it. None-the-less the code works well and the program starts just after the system boots meaning that it is always running. In addition to this it will not play any sounds however if the time is after 23:00 as this would just get annoying after a while and usually the system is off at this point anyway.

How It Works

Coming Soon...

Click Here to Show Code

As you can see the program is quite long for what it is actually doing, coming in at just over 400 lines of code, however it ended up this long as I tried to make it as modular as possible for the ease of debugging when things go wrong and for adding to/updating its features in the future. As I tend to add small parts to the program I occasionally have to go through the entirety of the code to clean up any global variables and unused lines that I have been too lazy to remove before. The program does work however and only tends to crash if the RFID reader is not connected for some reason or if the Pi cannot communicate with the I2C IO expander. In the future I intend to simply wrap all of the code that could go wrong in "Try" and "Except" blocks so that if something doesn't work then there can be contingency plans in place so that it can keep running without too much interference or disruption.

Check back soon for more updates....

Last Updated: 28/01/2019 @ 14:41:07