Smart Thermostat Massive Post

The thermostat became my target of smartification almost a year ago. I built a working prototype at the time, but because of the move and it being cold outside for the past few months, I have held off installing it for good. This past weekend, I finally got it on the wall. It does everything a standard home thermostat can do, but it is also integrated into the rest of the home automation system which allows it to be controlled and monitored remotely. It also employs some of the smart features you would see on a nest thermostat.

IMG_20160427_205515.jpg

Control Concept

With my enthusiasm about home automation, I started considering buying a Nest “learning” thermostat. I soon learned that it knows you are in the house based on whether you walked by it or not. To be perfectly honest, that sucks. It isn’t the fault of the device, which can only know what you tell it, and if it’s in an out of the way place, it just won’t learn very well. I knew I could do better.

My original plan was to try to use our cellphone IP addresses to know whether we were home or not. In some preliminary testing, it worked well for my android phone, but not well for Lauren’s iPhone. Over the past few weeks, I have implemented different “modes” for the home automation system. One of these is “Away Mode”. We flip a switch if no one is home, and the house knows we are away. This triggers notifications like “doorbell pressed” and “intrusion alert” if any door is opened and away mode is not turned off within a specified amount of time. To get to the point, if away mode is on, the thermostat knows it can change the setpoint to save energy.

The thermostat has similar functionality to other basic thermostats. You set it to either “heat mode”, “cool mode” or “off”. You can set the fan to either “on” or “auto”. Additionally, you can toggle smart mode, which looks for you to be home or away, or dumb mode, which just keeps the setpoint that you put regardless of where you are. The setpoint has a range between 60 and 85.

The User Interface

The interface was inspired by simply looking at some cool devices Adafruit (great website, btw) had to offer. I saw the neopixel ring and the capacitive touch sensor ring and thought how cool it would be if they fit together. It turns out they fit pretty perfectly, and with the addition of the light up pushbutton in the  middle, I had a very cool looking HMI. I added the LED matrices for display and a PIR sensor for “display auto-off” functionality. I mounted the devices on a piece of acrylic that I cut and sanded to give it a frosted look.

Originally, I bought a wooden box to fit everything in, but it stuck out too much and was very cramped. I recently picked up a larger but shallower plastic box that works a lot better. Until I think of a better attachment method, I am using velcro to keep the front piece on the box.

In openHAB, the setpoint and all the modes can be changed. It also displays the temperature in the house and whether or not the system is currently running.

Putting it All Together

I have made plenty of independent home automation devices over the past year and a half. The thermostat, however, is integrated into the house’s HVAC system. The furnace puts out a standard 24V AC, and I wanted to use this to power the thermostat as well. This meant handling conversion from AC to DC and stepping the voltage down (to around 5V). I was a bit nervous to do this, given a good home furnace is very expensive. I did a lot of research on how to properly implement the circuit. The concept is very simple. If the controller wants to cool the house, it energizes the compressor and fan relays. If the controller wants to heat the house, it energizes the furnace relay. Our furnace actually has 2 stages, which means I have a 2nd stage relay I can enable if its really too cold or it’s taking too long to heat up.

I found a cool website for a DIY android phone thermostat (here). There I found a proven circuit for a DIY thermostat that other people were using. I didn’t use the exact same circuit, but it was good to use as a guide. It made me more confident that I could solder together a working thermostat. As usual, I used a moteino to control everything. I barely had enough I/O to control all of the interface devices and the relays, but that little thing ended up being perfect. I also bought an external DC voltage converter and a backup battery interface to keep the thermostat alive even if power goes out (mainly to remember settings, since obviously the furnace won’t work without power).

IMG_20150703_124904IMG_20150703_151736IMG_20150703_160709

First Attempt

A couple months ago, I tried to install the thermostat while I had a free evening. I ended up tripping the furnace and thinking I fried the whole thing. As it turns out, I only blew a fuse on the control board. After checking the wiring, I realized I had switched the two AC leads. Unfortunately, I had a momentary lapse in judgement and also switched the DC leads that went to the buck converter. Having fried that, I decided to wait until I had some more time to test while the weather was warmer.

Second Attempt

After getting the replacement buck converter (and waiting a couple of months) I reinstalled the thermostat. Miraculously, everything worked. I made a few minor programming changes in the first few days. I added smart mode logic and implemented a 6 cycle per hour limit (to keep the system from running too often). I also optimized the openHAB interface. The system has been running well for a couple of weeks now. I made a video last year showing the unit in action. It still works essentially the same way.

The code for the thermostat can be found here.

 

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