March 3, 2014

A couple of posts ago I showed off how I made the lights in my room turn on and off with a sonic screwdriver universal remote. Since then I’ve been building on the same project. So far I’ve cobbled together something that might be similar to a very early day Jarvis (Tony Stark’s personal AI assistant). Okay when I say basic I pretty much mean it. Right now I only have control over my lights, thermostat, and my media center. It’s all controlled from one central interface: a Transformer Prime Android tablet that I’ve velcroed to the wall. Since right now it is so basic and doesn’t do everything I would like it to, I have named it Woodhouse.

EDIT: The GitHub repo should be updated now to the latest version.

At the core of this, just like the sonic screwdriver lights, is a Raspberry Pi model B. Plugged into it is a custom board I made with point to point soldering. If I had to do it over again, I would most likely etch my own PCB, but hey it works for now. On the board is a DS18B20 temperature sensor, two relays, a pin header for the remote for the lights, and a pin header for power. Coming off of the header for power is a female 4 pin molex connector. The molex connector was a perfect choice for this board as it gives me the 5v I need to power the Raspberry Pi and the 12v to drive the relays.



This is an early version of the board. In the middle there is a 7805 voltage regulator that I used to step down the original 12V input to 5V for the Raspberry Pi. Unfortunately it gives off a lot of heat. So much in fact that the temperature sensor thought it was 90 degrees inside.



A more complete board plugged into the Raspberry Pi with a floppy drive cable.

I built in the thermostat functionality because one day I woke up and my bedroom was something like 55 degrees. It turns out that my Honeywell programmable thermostat stopped functioning correctly. We had another downstairs, so I replaced it. For some reason it still didn’t work. I looked up online how I could temporarily call for heat from the furnace and it seems that on most thermostat bases you can bridge the C and Rh points. In this case C is for common and Rh is 24V AC for heat. Some furnaces have two stages of heating to save on energy. Anyway, bridging the two points kicked the furnace on and my room started to warm up.

At this point I was pretty fed up with the normal programmable thermostats and I decided to see what would happen if I hooked up a relay to bridge the two points for me. It worked great. I knew what I had to do then, and that was to hook it up to my Raspberry Pi. I ordered my temperature sensor and within a day I had a working thermostat. I could SSH into the Pi and set the temperature manually and adjust how much the temperature could drop before the furnace would kick on. It was pretty rudimentary, but it beat having to hotwire the furnace.

I was pretty happy for a while until I decided to revisit the project and improve on it. At first I thought it would just be cool to have an interface that I could pull up on my computer or phone and toggle my lights and set the temperature, but then I had the idea of building in a line chart that would show the temperature over 24 hours. It was really basic, but it worked. Then I had the idea of taking an old Android cell phone I had and mounting it on the wall in place of the old thermostat. Again, it worked but it felt much too small.

Cleaning up my room one day I found my old Asus Transformer Prime. It had been collecting dust. For those that don’t know, the Transformer Prime was pretty much a flop. Locked bootloaders plus terrible flash storage plagued it early in life for speed. By the time Asus allowed you to unlock the device the Tegra 3 chipset was ancient and using the tablet was just a nightmare. It was okay for web browsing though and since I’ve done a lot of web development in the past I decided to build an interface using HTML/CSS/jQuery and PHP.


The picture above is the interface I ended up with. It shows the weather, current temperature of my room and furnace status, and it shows what is currently playing on my media center. A tap of the Mini Cooper’s headlight activates the lights. If you tap on the temperature of the room, it brings up the thermostat settings.


Here’s a video if it in action, albeit a very very early version

I tried to give it that Android Holo look and I think it turned out well for being done with just HTML and CSS. The whole interface is AJAX so there’s no screen flashing or reloading of the page to refresh the data. It works really well and I’m really happy with how it turned out.

All in all it works really great. There’s a few hiccups in the interface I need to work out, but it’s been extremely stable. All for about $50. Take that Nest. Okay I used a pretty expensive tablet also, but that’s just a minor detail as you can use anything that has a web browser.

Now concerning the tablet I’ve got a couple of other things going on. The web browser is a custom made kiosk browser made using a full screen WebView. The tablet is running KitKat so the WebView is using the latest version of the Chrome browser so all the HTML5 inputs work as they should. I have an app running in the background that removes the bottom bar that has the virtual back and home buttons, and then I have another app called GYF Side Launcher that allows me to go into another app without rebooting. There is also an app running to keep the tablet from locking so I can always see the status of the interface.

Finally I have an app running called Open Mic+. This runs in the background and lets me use voice control without the annoyance of hitting a button. It’s always listening and can listen to a specific hotword to activate Google+. You can also give it hotwords to activate Tasker tasks. This allows me to be anywhere in the room and say “Lights!” to toggle the lights. It needs a bit of work and a better microphone to pick up some parts of the room, but it works much better than I thought it would.

So that’s basically the setup I have now. I plan on adding back in the IR receiver so I can control various aspects through both my Logitech Harmony and my sonic screwdriver. I will probably add some IR blasting functionality too so I can control my TV using voice commands and such.

I’ve released some early code which mainly consists of bash scripts on my GitHub so feel free to check that out. I imagine I’ll commit the rest of the code sometime this week. Unfortunately the biggest mistake I have with any version control is I get so wrapped up in a project I don’t commit as I go.

If you have any other cool features you think I should add, feel free to leave it in the comments. I’ve given some thought into adding some Fit Bit functionality but that’s a bit down the road. And yes, I will end up adding back in the most important feature

GitHub Repo


  • Pingback: Woodhouse Controls Your House, Avoids Danger Zone

  • Pingback: Woodhouse Controls Your House, Avoids Danger Zone | Hack The Planet

  • Stan

    I just started on a similar project for my house. Im just starting with sensory input for now, like indoor outdoor/temperature and level of heating oil in my tank, electricity usage, etc.
    Do you provide hysteresis for you temperature control so the furnace does not short cycle?
    Also, you might want to check out websockets introduced in html 5, it’s better than ajax for this sort of thing. It provides for full duplex, real time streaming and token exchange on a separate port (other than 80). I use the jWebsockets package, which includes a websocket server and javascript client libraries, and many demo examples.

    • pathartl

      Wow, those are some pretty good ideas. I plan on adding an outdoor temperature when summer rolls around here and it starts warming up. This way I can do some comparisons from outside temp to inside temp and have it be a little bit more dynamic than just setting the temp. I don’t have any hysteresis in place other than the allowed temperature drop. After studying up on how the Nest works, I think I have figured out how to make my system a bit better and predictive.

      I’ll have to look into web sockets. I never tried anything like it or AJAX before and jQuery just ended up being too easy. This will definitely be an ongoing project and there is room for improvement.

  • http://elecurls.tripod.com/ Ted

    How about a schematic for this simple setup.

    • pathartl

      I don’t have a schematic at the moment, but I could throw one together tonight. The basic code is available at the GitHub repo at the bottom of the post and I’m planning on committing the latest code tonight.

  • http://elecurls.tripod.com/ Ted

    Also, how about the code for all of this

  • Pingback: Raspberry Pi at the Center of Home Control System @Raspberry_Pi #piday #raspberrypi « adafruit industries blog