After we moved into our house in 2009, I decided to get more into automating our home and introducing more automated components than I had in our 2 bedroom apartment before. Technology has moved forward, so over the course of the last 5 years I have built out my home automation system to where it is now.
I initially installed a few “dumb” Insteon switches, early versions which did not communicate their state back, and only received commands. That was OK for a while, but as I started to expand the system to cover every switch in the house, theses switches were discontinued, and their capabilities were fairly limited, so I moved on to current version of the Insteon ToggleLinc switches. The aesthetic matched our existing toggle switches, so I was able to upgrade each switch slowly and keep the look and functionality in place. Eventually every switch in the house was an Insteon smart switch and all the lights were automated.
In our apartment the lock was electronic, but not smart. Since I am an avid runner, I had replaced a regular deadbolt in my apartment for an electronic lock with a keypad. It had a nice feature where it could be configured to auto lock 10 seconds or so after closing the door. I wanted this type of ability in our house, but I also wanted a lock which could be tied into a home automation system. At the time (2010), options were limited, so I settled on MornigLinc deadbolt which had an Insteon module. This allowed me to tie into my home automation system. By adding an Insteon door closure detector I was able to set it up that it would lock the deadbolt 10 seconds after the door was closed.
I wanted to tie the garage sliding door into the home automation system, and luckily there was an Insteon device for that. After the sliding door was automated, I got an idea that wouldn’t it be nice that once you pull into your garage, you could press another button and the door into the house would swing open allowing you to carry your groceries etc. Then once your hands were free you could close the door behind you. I did this with a Skylink DM-150 Swing Door Opener. I wanted to tie into into my home automation system, so I rewired one of the RF remotes which came with it and used a simple on it to trigger open/close commands.
I wanted my outdoor lights to on when it got dark out, but I wanted control — granular control of that. I got an Smartenit EZIO 4 Input/2 Output Relay Controller with an ambient light detector. I also connected my smoke and CO2 detectors into this controller.
Raspberry Pi and Sandy
How does a little 35 dollar computer and a major hurricane connect to my home automation story. Well, I’ll explain. I had been happily going about my home automation with off the shelf hardware with minor customization. I bought one the first Raspberry Pi boards without a real plan of what to do with it — waited a long time for it to arrive, and even when it did, had it laying there for months without a real purpose. It was, neat, but I had really no use for it yet. Then Sandy hit. The power surges killed my X10 relay board, fried my Insteon MorningLinc connector, and fried a few other older X10 devices. That’s when I got the idea to use the Raspberry Pi to drive relays. I started experimenting, and not long after I had came up with a few prototype add-on boards for the Raspberry Pi. An analog chip — which replace the sunlight detector I had been using before. And a relay board to control the front door, and the garage door.
Raspberry Pi security system.
After digging around in my basement I discovered that all the doors in my house and some windows were hard wired to security system which we never activated after moving in. I wanted to get the signals from it into the Pi, and by extension into my home automation system. I needed more inputs — the Pi has some GPIO pins, but all the pins which could be used for something would not allow me the flexibility I needed. Among the many interesting things in the Raspberry Pi are the SPI and the i2c buses. I used the SPI bus to add the analog chip. The i2c bus was my pathway to more expandibility.
Raspberry Pi expansion
After a while it became more apparent that I needed, wanted really, to control other aspects of my home. Drapes, curtains, etc. I expanded to two Raspberry Pi automation boxes, one for upstairs and one for downstairs. Now Somfy compatible blinds were hooked into the Raspberry Pi via more i2c bus expansion chips.
The second board Raspberry Pi board I designed for upstairs was more thought out and was not a combination of multiple expansion boards.
This board has many relays for control, for the electronic geeks among the readers, all relays are opto-isolated, so if anything were to short circuit, only the relay, and a neighboring capacitor are at risk — not the Pi itself, nor the rest of circuit.
Hardware So Far
I’ve been able to connect all the lights, doors, blinds, drapes, safety (C02, and Smoke Detector) to my home automation system. Some of the hardware was of the shelf, some — like the Raspberry Pi circuits were of my own design. Having the hardware is nice, but what is the user facing elements, how do humans interact with a system with hundreds of relatively dumb connected components.
Home Automation Brain
I started writing the brain, in 2009, and five years later, I am still not done — I am not a procrastinator, I just keep adding more and more features. Over the years, the brain has resided on a linux x86 Intel server, then a Windows x86 server, now it resides on a quad core Arm Based low power board, more on that later. The main idea of the brain is that it’s portable, it can run on anything, and must stay in-house. I am not a believer in the cloud or farming out of the brains of my house. The idea of some other entity having access to my bathroom lights freaks me out. I want my home automation system to be mine. I wrote the system as part of a tomcat java server. People hear java, and all the know are the security holes — but java as a service/server is rock solid and is a great platform. It has allowed me to move my system between platforms with little overhead or redesign. Currently the system is able to configure/control lights, Raspberry Pi connected devices, thermostats (more on that later) doors, garage (and other). The system is a logic engine on steroids. It has a web front end (thanks to tomcat being the server). I have coded each device to have certain common principles, and rules. Hence you are able to link devices to create virtual devices and so on. You are able to create triggers based on conditions — light, time, date, state of other devices, heck I even brought in the open weather api, and am now able to trigger behaviors based on the weather outside. If the device is in my system, it can be configured to act and behave based on any other device or a combination of devices in my system. I don’t believe in limits. I started the design of my home automation brain with the idea that — I don’t know what I want my house to do, so I will build in a way to configure anything and everything.
More on Java
The Raspberry Pi boards I use to control everything not related to lights in my house run a very stripped down version of linux and Java. The java server on the Raspberry Pis is fast, resilient, and if not for a few power outages, uptime on those devices can be counted in years.
Home Automation Frond End
A home automation system is only as good as the ability for the user to interact with it. Sure I can open a webpage directly accessing the webserver, but in the day and age of apps — who wants to do that. We’re an android household, so I designed early on, a front end android app, which would not need to change as the brain got smarter — it will download configurations from the brain and present a reasonably easy to use set of screens where the user could interact with various components. The only alterations I’ve had to make to the front end app have been to keep up with Android versions and API changes, the basic structure and connectivity have not been changed since I originally came up with a flexible logical UI 5 years ago. I keep iterating the brain, making it smarter and more capable, the front end App gets the benefit, but doesn’t need to be changed.
When I started this some years ago at my new house, I saw the Bill Gates house as my dream in my mind. I wanted smart screens on walls. So after some effort I convinced my wife to let me mount some inexpensive Android tablets in a few key places in the house. Over the years I’ve upgraded some of them, but the basic idea is I now have 4 10″ android tablets mounted throughout my house — running my home automation app (which runs as a service, hence it has the most up to date state of everything in my home — since it maintains a direct connection to the brain). It also runs an Android clock app — from Android 2.1 — this app has been updated, and removed since it came out, but we still like it — it has a nice screen saver mode, shows the weather, and the time.
This is just an example — this tablet was replaced with a newer version, but that’s the idea. I will cover thermostats in the next post — hint, I am not a Nest fan.