Making Our House Smarter

IMG_20150405_013926Screenshot_2015-04-05-01-07-47

A few months ago, I came across an instructable explaining how to make a DIY home automation system using arduinos and a raspberry pi (two things I have previously written about). The instructable, which can be found here has morphed into an entire community of people who have created systems in their own homes. In the process, there are several improvements that people have been able to make since the original system was described. Because there are so many people working on this and many of them have questions, a whole forum was created which is dedicated to these sorts of questions and ideas (found here).

how the system works, briefly

(in case you don’t want to dig into the instructable right now)

The system consists of sensor “nodes” that are placed around the house. These can be anything from a door open/close monitoring switch to a smoke detector. Temperature, motion, light, vibration, etc. can all be monitored cheaply. Each node uses an arduino and a wireless transceiver to communicate back to a central server, which is a raspberry pi which also has a wireless transceiver connected to it. When the server receives an update from a node, it passes the information to openHAB, an open source home automation interface. What this means is that any information you send to the server can then be viewed on your computer or your phone from anywhere! The picture at the top is what it looks like on my phone.

There are a lot more details and steps required to get the system working, and there is sufficient information in the links provided to figure out how to get a working system. I won’t go into these details because they are already out there. I will, however, write additional posts describing in detail how each node works and link to my code.

my setup

There was a ton of work and time put into the instructable by , and I have also been working on my setup for months. The general idea is the same as the original, but I have been able to use some other people’s code and some code of my own to improve the system a bit. All of the code I use and have written can be found in my Github repository (here).

improvement 1: raspberry pi gateway

The original system implemented 2 arduinos and a raspberry pi to collect information from each sensor node placed around the house. Github user abouillot was able to create a C based gateway program which eliminated the need for both arduinos (code).

improvement 2: bi-directional handling

Everything up until this point had been uni-directional, meaning that the systems were all just sensors sending info back to the server. There was no handling for sending a signal from openHAB to any of the nodes. There has since been a successful program created to do this, but it involves using the server that involves one arduino. I was able to successfully add bi-directional handling to the raspberry pi code. This means I can flip a switch on my phone and turn on a light or open the garage door. My code can be found here (forked from abouillot’s original gateway code).

improvement 3: using moteinos

The instructable uses arduino clones (arduino compatible devices) and separate RFM69 chips (the wireless transceiver) which involves a lot of soldering of tiny little wires. LowPowerLabs makes a TINY arduino clone that has the RFM chip soldered to it (found here). This removes the need to solder anything but the header pins and reduces the footprint of the node. The picture at the top of the article is a door sensor with a moteino and battery pack. I put the moteino on a small breadboard to make for easy wiring of the switch and power. It is sitting right above a commercial door switch, and the two are about the same size. The only reason mine is bigger is because I am using 4 AA batteries which will last up to 2 years on a charge.

nodes

Right now, I have several nodes working around the house. The front and back doors each have open/close monitors on them. The garage door has an open/close monitor, and also has the ability to be opened remotely. The washer and dryer each have running/stopped status sensors. I have also added a temperature and humidity monitor in Squirtle’s habitat (he’s a box turtle), and water level and temperature sensors in Yoshi’s tank (he’s a red eared slider). Finally I have an Oscar poop detector (he’s a cat). This takes weight readings when he is in the litter box and communicates his weight, as well as the weight he leaves behind.

The nodes can be powered by battery, or they can be plugged into the wall through a 5V dc adapter. I set up a screen in openHAB to monitor the signal strength and power for each node. The ones that don’t have batteries don’t require power monitoring.

additional devices

Besides the arduino sensor nodes that communicate with the openHAB server, I have two additional raspberry Pis that I consider to be a part of the overall home automation system. The first one is placed by Oscar’s food, and takes his picture and tweets it whenever he is over there. The second one does the same thing when Yoshi is on his basking dock. This one also reads the temperature and level of the water and sends it to openHAB. It does TWO THINGS. These will also be given posts of their own as well.

next steps

One of the great things about this project is that it is highly scalable, meaning you can add as many nodes as you want to the system. Not all of my nodes are working perfectly either. Now that I have established sever nodes around the house, I would like to get them all to work very reliably before I begin to implement more of them. I have already purchased some other sensors, but they will have to wait for the time being. Stay tuned for further updates.

you can do it!

When I found this project, I had no experience with wireless transceivers, how they communicate with one another, what openHAB was, how to get a C program working on a raspberry pi, or how to write python code and run it on a raspberry pi. There are probably a bunch of other things that I didn’t know how to do that I can’t think of right now. I have learned so much in doing this project and I urge anyone interested to just give it a try. It is fun, cool and can be very useful as well.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s