This project is submitted for

Description

The goal of the sci-fi grade home automation system is to address a couple things I don't like about existing systems:

Commercial systems tend to focus on three things: lights, cameras and thermostats. There's nothing wrong with that, but it is a very small scope compared to what modern technology can do. I usually don't need to see a real-time video of my apartment wall, and outlet switches are only moderately convenient, not life-changing.

I decided to make something inspired by Corning's "A Day made of Glass" videos. That system focused on displaying interesting information, and it was awesome. Existing systems don't do that, for reasons I don't really understand.

The other problem I wanted to address was the cost. In addition to being overpriced, commercial systems tend to do as much as possible to lock you into their platform. This system combats both problems by being open-source and being designed from the ground up to integrate with multiple low-cost platforms.

Details

The system can be broken down into several large sections, which are detailed in the design document below:

The central server talks with the nodes either over Wi-Fi or off-the-shelf RF interfaces. Most of the core software runs here. It contains:

A web interface and database (really an ASP.NET page with a static dictionary, but it works the same way)

A windows service that mediates all of the various communications

Speech recognition using SAPI and some microphones hidden behind the couch

It talks to two Arduinos over USB. Those handle the outlet switches, RF, and living room blinds.

An AutoHotkey (I know, right?) script that triggers the morning and evening routines.

Other nodes are the TVs, a couple old androids running the unity app, and a spark core that deals with detecting the switch state.

The system communicates with our Fitbits over the API (for getting sleep data, health data, and other user vitals).

Components

1×
Arduino Mega
I'm using the Seeduino model, but it really doesn't matter. It acts as the base station

1×
RF Receiver (per base station and blind minder)
I used https://www.sparkfun.com/products/10533. If you want meshing, you need one of these for each node that you want to be able to re-transmit as well

1×
IR Detector (per IR node)
These are cheap and can be trivially attached to any node with an arduino and a transmitter. I used a bunch because they come in packs of ten

Project Logs

After I accidentally left my laundry to rot in the washing machine one too many times, I decided to permanently fix the problem with a Spark Core. I rigged it to cheap door sensors (http://www.amazon.com/Wireless-Doors-Windows-Security-System/dp/B00CDCIP00) on the washer and dryer doors, and used some simple code to figure out which one is being loaded at any given time.

The code for the core is at the end of this post (it's so short, I'm not even sure I'm adding it to the GitHub). I'm not sharing the server-side code because practically the entire thing is access tokens, and I don't want to bother sanitizing it. Spark provides a pretty dead-simple JSON api though, so it shouldn't be hard to work out how the thing translates the variables into something usable as an email.

Things to note:

Those sensors are incredibly delicate. They're essentially just two almost-touching wires and a magnet to pull them together. If you touch them, prepare to spend the next half-hour or so re-calibrating them. That's also why the code has different conditions for the two sensors (they give completely different readings, almost like completely distinct models of sensors). I recommend polling each sensor a few dozen times in each state to figure out what its readings will be.

The sensors are compatible with the 5V output of the core, which stops you from having to worry about the internal batteries. I de-soldered the speaker and replaced it with a wire between the signal pin (the one going to the blob IC in the center of the board) and the core. I removed the can-looking thing (oscillator?) that was between the PCB and the speaker, as it made the signal harder to read from the core.

I added a bunch of new features, and finally got around to writing an update:

Voice recognition moved from SAPI to Amazon Echo. This was done with a Chrome extension that attaches to the Echo management page's WebSockets connection and forwards all relevant commands on to the home automation server. The code for that should be up on Github soon. The only drawback of this is that the voice says "I didn't understand that" as the lights are turning off. It does require an instance of Chrome that is constantly running, but that's fine to have on the server.

Echo is easily the best voice recognition platform I've ever seen. It's reliable at 20 ft (assuming you don't put it on top of something that's vibrating), and really quick. Much better than SAPI, which makes a lot of sense given the age difference and compute power being thrown at the problem.

I also mounted old Androids to two of the walls in the apartment, which allows easier control with the app. Between Pebble and Echo though, I'm using them less and less. I think that, with another Echo, the voice commands could replace the rest of the interface except for relatively rare circumstances.

Finally, I've started work on a device that will tell me if there's laundry waiting in the washer (I often forget and have to re-run the load a few times to get rid of the smell). I'm using some off-the-shelf magnetic door sensors hooked up to a spark core, but I'm running into trouble interpreting the alarm audio. I'll have more info on how do do that once my new scope probes come in. The code is more or less done though, so once that's fixed I should start getting push notifications on my phone (maybe even played through the Echo).

As a bonus, I added Pebble integration with the Pebble Tasker app. This is pretty straightforward, it just has tasks set up to CURL the relevant API endpoints mapped to the Pebble's buttons. I plan to link my old Pebble (with the infamous screen sync problem) to one of the panels in the apartment to get a non-backlit control surface for the bedroom, but I haven't gotten around to that yet. The goal with that is to replace the hard buttons with touch switches built into the bedside table.

All in all, the system is becoming much more usable, and I'm starting to think about ways of integrating sensors into the mix. Currently, everything is driven off of user input, but that's obviously not ideal.

In preparation for the final submission deadline tonight, I wanted to talk about some of the most recent changes I've made to the platform:

First: I have re-factored the database to pass results back either as a simple string or as JSON, instead of as javascript. This made the code across the board much more legible, and let me make the daemon a lot more sophisticated without a ton of text parsing

Second: I added TCP bulbs and the blind minder into the final build. The TCP integration is described in the GitHub repository, and the blind minder is in the build log.

Third: I created an AutoHotkey script to run a proper good morning and good evening routine (along with some new dashboards to go with them). That should also be in the repo.

Fourth: I cleaned up the interface look and feel to fit more with the modern aesthetic of the rest of the apartment. The Tron nods are more subtle now (except for in the mobile app), but I think the system looks better for it.

As far as future development goes, I have a bunch of ideas for things to do:

First and foremost: more control surfaces are a must. I have some old droids to re-purpose into light switches using the app, and another spark core is on the way for an outlet switch in the bedroom

Second, I would like to clean up the 3-D printed parts with some sanding and re-forging so they look a bit more solid. Right now they look very printed, mostly because they were all done on a mostly-stock Printrbot Simple with lousy calibration, and barely touched up afterwards.

Third, I would like to look into more systems to talk to. The Phillips Hue seems like a good candidate, and maybe some more traditional (X10, etc) systems would be good fits as well.

Finally, I want to experiment with more information sources than Reddit and Fitbit. Taking some leaves out of the "A Day Made Of Glass" playbook, calendars, messaging, and other more social data streams could be integrated smoothly to add an extra personal touch.

I've been quiet on this for a while, but I have decided to enter this into the Hackaday Prize pool, with some significant refinements. My new goals are:

Replace the laggy light-switch with a touch-panel powered by a Spark Core

Add more dashboards

Tie in with some Wi-Fi bulbs to automate the lights I couldn't touch last time

Add more context sensitivity

Make the blinds open and close from the system

Finally make a freaking video

So far, I have made one major improvement, and that is to create a page that grabs data from reddit and posts it on my tv for a morning briefing (still have a minor character encoding bug in the news feed, but whatever):

The system works, and just in time. I'm sure I will continue to expand this at a later date, and there are definitely a couple areas that need some work. That said, I think the core concept is good, and is useful as a design philosophy for systems like this.

The basic idea that drove the entire project was that the integration of many systems could create something useful, and I think that has been shown to be true. The wake-up routine is useful, and shows important sleep data. The light switches allow the system to be accessed in an intuitive way, but also allow the living room lights to be turned off from bed if forgotten.

The interface was deigned from the ground up to look like something out of Tron, and I think I succeeded in that respect. The voice commands are more Iron-Man, but I'll let that slide for convenience's sake.

Notes:

It wasn't specified in the project logs anywhere, but the sonic screwdriver worked as expected with the replacement switch. The only tricky part was that I needed to configure another Arduino to blast the signals to train the thing because, although it has a USB input, you can't actually program over that, it's just for power. Just keep that in mind if you want to do that.

A 3D printer isn't strictly necessary for this project, but it helped to make the enclosures look more like I wanted them (Tron-like). If I did it again, I would likely try to use natural PLA in a second extruder to get the trademark circuit lines in the parts, but, alas, I didn't have one.

It's unfortunate that configuring the Android app is so difficult, but that's how it had to be for the look I was going for. Procedurally drawing that based on a line drawing was going to be too much work, so I took the shortcut of just drawing it out in Inkscape/Filter Forge by hand.

In this entire project, the hardest part was getting those SparkFun RF transponders to work properly. I ordered antennae specifically designed for 315 MHz, but they didn't make too much of a difference. The packets eventually get through, but the packet loss rate is crazy (easily 75%). That is a good argument for upping the cost of the system by a bit and going with standard Wi-Fi or Bluetooth, but that has its own set of problems. Suggestions on this point are more than welcome.

Future improvements

Opening the blinds as part of the wake-up routine (The machinery for this is more or less in place, but needs a bit of extra logic to make it work)

Making coffee in the mornings (I would have put this in for release 1, but if I broke the coffee machine I would whither and die, and nobody wants to clean that up)

Bugs:

There is a 1-5 second delay between flipping a light switch and seeing the result.

The integrated switches rely on detecting power from a wall socket through a wall wart, which, when combined with the packet loss from the cheap RF kit, causes an unacceptable delay (especially when turning the light off, as you have to wait for the wall wart to turn off completely). The solutions I see are increasing the power of the transmitter and switching to a faster way of detecting outlet current.

Also, I haven't forgotten about the bonus hacks (though neither of them are as cool as the 6-monitor mount). I'll put those up later today (Can't get good pictures of the lights when it's light out).

Special thanks to my girlfriend. Her suggestion on how to improve the system, as well as her keen eye for deign, made this system look a thousand times better than it would have (she would be listed as a contributor, but she doesn't have an account here). Also, she should be nominated for sainthood for not killing me after the fiftieth time I broke the lights.

Also, thank you Colabot. Without your collaboration, I could not submit this project without roping in my already-swamped girlfriend.

After much laziness, here is all of the code for this project in one easy GitHub Repository. it's likely that I missed some things, but I'll be going back and checking that soon. Right now, I'm working on the system that opens the blinds in the morning.

The sonic screwdriver is on backorder, and I am still designing the enclosures for the various electrical bits (and putting the finishing touches on my new PrinrBot so I can fab them), but I'd like to take the time to talk about the timed RF blaster I'm using to turn the TV on and off for the FitBit display:

It uses the PWM output of the Arduino for relatively close measurement of time, and the IRRemote library for communication with the RF I/O. It has a simple interface. When it sees an IR input at the input, it keeps it in memory and plays it back every day at the same time. It's very simple, but produces exactly the effect it needs to, and without any significant time commitment. As with everything else, code will be put in the GitHub repo as soon as I get around to it.

After some CSS hackery, I came up with the following display for the FitBit data (Names obscured with red boxes for anonymity). The page is built with ASP.NET, and uses no special plugins (though it has not been tested on anything but chrome, as I am planning on sending it to the TV with Google Cast).

The data is pulled using the method I detailed in the last box, and displayed using basic HTML/CSS. The source code will be uploaded to the GitHub repo when I'm done removing our usernames and passwords from it.

This layout is designed for two people with FitBits sleeping on the same bed and sharing a screen. For alternative situations, additional columns can be added or removed relatively easily.

A while ago, I wanted a way to mount 6 monitors, and, being a college student, wanted to do it with scraps. Below is what I came up with. The cable holds the whiteboard in a curved shape at the top, while angle brackets do the same at the bottom. The monitors themselves are attached with screws in the back. The final result is not unlike a certain $700 one on Amazon, but cost me half of a $6 sheet of whiteboard and some scraps.

Become a Hackaday.io Member

The GitHub link on the left should work. I need to revamp the TCP connector (I switched it over to their cloud system because they removed the web interface, but it causes delay and occasional lost commands), but the rest of it should work (I haven't had too many problems with it).

Thanks for all of the comments, skulls, etc. It's flattering to get this much traffic all of a sudden.

In no particular order:
The wifi bulbs are there because I wanted to use the existing electrical system, so I needed something really compact to go into the hall light sockets (I'm going to try to get some of my deposit back, so no messing with the writing). It also ended up being dimmable, so I use one in the bedroom for sunrise simulation before my alarm clock goes off. The server interfaces with the lighting controller, so it still presents to the user as an integrated web page and app.

I didn't integrate with x10 or many other commercial systems because I didn't have a huge toy budget at the time, and the sockets that do the bulk of the work came out to about five bucks each.

I picked Windows as the server just because I had a win8 media machine already running, and I speak asp.net.

I actually scrapped the voice control because it was not reliable at all. Looking into interfacing with the Amazon echo (instead of sapi) when I eventually get one of those.

There actually is a video on the side bar. I might post an update when I get more features in, but I've gotten distracted by game development and haven't done much work on this since I posted the last one. Just added some more el wire in the bedroom, tablets in the walls for easy access, and that sunrise thing.

Great work; I think it is especially unique that Windows platform is used for anything like that - ping Microsoft for a case study :) In all seriousness I did not see any x10 integration? Is that in the works. Those devices are super cheap and very handy. Also Xbee? Dallas 1 wire? I second the You Tube idea -- yes do make or even start a channel to post video updates as the system evolves. In summary -- great work!

I apologize for the unforgivably slow progress on the video front. There was a sudden surge of interest in my game on Greenlight (hit #6) and I had to manage that. I'll do what I can to get a video out in the next couple weeks.