# Web based home hvac control



## Red Squirrel (Jun 29, 2009)

This is something I've been setting up on and off lately and I'm at a point where it's almost done. Basically I've always wanted to have the ability to control the heat from a simple web page that I create, as well as have a back end I can fully customize so I can code all sorts of advanced features as I please. 

So I found this relay board at http://www.canakit.com which was the perfect candidate for what I wanted to do:

Can also see a sensor in the little bag. The board can handle 6 sensors, which I ended up buying afterwards, figured may as well use it to it's full capacity. 











After some brain storming on how to physically connect everything, I decided to go with a DIN rail. It will basically act as a "patch panel" for non standard data/electrical connectivity to my server rack. The sensors as well as the tstat wire will cross connect there, and into the control board. This ensures there is a disconnect should I need to move/change the control board. The board connects to a small 1U server via USB, but it's basically a virtual serial connection. 

The app just loops and takes readings, and then depending on the settings in the database and those readings it will turn relays on/off accordingly to control the furnace, fan and in the future, AC. 

Here you can see the DIN rail installed with a few connectors. 











The scheduling app:











Programs:











The main page:











I have not started to wire up the house yet, but I will probably start on that this week. With my new job, I have more time off, which is awesome. 

For now the app is fairly basic, but over time I will add in more features. One thing I do want to eventually add is the ability to predict how long it will take to heat up from a certain temp to a certain temp when it's a certain temp ouside. That way when I make a program where I want it to be 20 at a certain time, it will actually know to start the furnace ahead of time.

Also rather than setting the temp to a single number, I set it to a range. In some circumstances, such as when I'm away from home or in bed, it makes sense to set larger ranges. This lets increases the cycle times so there's less short cycling. 

But really the nice thing will be the ability to set and see the temp from any wifi connected device. I will also be allowing this through my firewall in some secure way so I can access it from work. Let's say I decide not to go home for lunch, or go later, I can then override the temp. 

There's a few phantom issues that sometimes happen with the control board, so I really got to watch for those and test the hell out of it before I go live, as a relay stuck on or off due to the app being stuck in some kind of loop, could be a disaster. Once I can deep this system safe with no hiccups, then I'll do the final connections and make it go live. Right now it will only be to control the heat, but I'll probably code in the AC mode and it will be ready for if ever I do get AC.


----------



## Ironlight (Apr 13, 2011)

This is really interesting. I've been looking at WiFi thermostats which I think do much of the same thing with respect to day-to-day programming and remote access. However the ability ot write your own code to looks like a big plus for this approach.


----------



## maranello055 (Mar 1, 2012)

Good job!

If you want an easier way... 

Nest.com

has a Wifi Thermostat built by Apple engineers... I just got mine and it works awesomely from my iphone!


----------



## Trucon01 (Jan 10, 2012)

A few months ago I got one of those Filtrete WiFi thermostats from Home Depot for around 100.00. I absolutely love it. You have an account online where you can customize your settings plus there is an iPhone app so you can control it anywhere. I would buy it for any house I own!!


----------



## Red Squirrel (Jun 29, 2009)

Started pulling wire today. Also decided to change up a bit the way I run wire around the house. Instead of just hanging in screw eyes and tie wraping any new cabling on the existing cabling that's passed through the screw eye (normally only one can fit) I decided that I will run a metal wire in the screw eye, pass the first wire into the screw eye, but use velcro straps to hold additional wires. The metal wire also acts as something to strap wire to between joists to prevent hang. So I did that today as well. 

Wired the first sensor into the thermostat, so it's more or less hidden. I decided to make the sensor part itself stick out on the outside, for a more accurate temp reading. The thermostat will remain as a backup and be wired in parallel for the heat only.










After I took that pic I realized I wired it wrong, The orange and brown/white wires are mixed up. Mostly mentioning this in case I come back and look at this in the future.... lol. I just made my own "standard" that I will follow for each sensor. Will make future troubleshooting easier. The sensors have 3 wires, so I just assigned each one to a color. 


And here's some runs (some of those are existing Ethernet runs). 











Crawlspace data run, the one going to the far end is actually existing Ethernet, the one going behind the light is for the sensor. 










A run to the outside sensor. I will leave it coiled up at the end till summer. I don't really want to work outside in this weather, and I doubt any glue/cement I use would cure properly anyway. My plan is to have a small pipe go outside and have a down elbow with a cap and a couple holes in it. The sensor will reside at the tip of the pipe and the rest will be filled with insulation and caulked in. Will provide weather proofing for the sensor. I specifically chose a north wall which should provide an accurate reading. Most of these sensors are just for extra informational readings, more than anything. Though they will be used in some logic as I improve the control application. 










Din rail with the terminal blocks. They are all labeled to make it easy to identify each conductor. 










Hoping to more or less finish this up tomorrow, if not, next week. I'm off tomorrow but then start work again the next day. I still have one more wire run to do for the upstairs sensor. I bought a LED wallmount light which I'll be using to mask the sensor into, and the light itself may come in handy in the event of a power outage or what not.


----------



## Red Squirrel (Jun 29, 2009)

Wow, so ran into a huge issue related to code which was really messed as it only crapped out after a server reboot, but after a couple days of stress, madness, and me going insane, I managed to get it going. Basically there's this code I have to run which sets some kind of global flag which makes it work properly. 

I have some cleanup and other final tweaks to do, but overall it's done. In the summer I will install the outside sensor as well. We're in the middle of a heat wave now so it wont get much use until we return back to normal winter temps, but after fighting with this issue I'm better off leaving it in test mode for a day or two anyway. 


This is how the web front end looks like now. I may be tweaking this further. I'd like to add some ajax and other interactivity.


----------



## Red Squirrel (Jun 29, 2009)

Some more pics:









Mounted control board and soldered in all the wires. Idealy I would have loved to make it terminal blocks instead but never even thought of ordering some direct mount ones when I did my order for the other stuff. I will try to find a piece of transparent plastic to use as the cover. 









Can now control furnace with my playbook or any wifi device










I thought this was rather genius...











Conveniently this is a great location for an emergency light, or just a light to look inside the closet beside it. 










Server room sensor (this "room" is basically my basement at this point)










Return duct sensor










Supply duct sensor










Top view of rack where the control board sits on a shelf and the DIN rail is mounted on top. The actual server is closer to the middle and not shown, it's a little 1U SuperMicro server.


----------



## Ravenworks (Oct 31, 2010)

Dude,I thought I was a geek,you should post this @ ARS.

I know you can buy this stuff off the shelf but where's the sense of accomplishment?
Nice play.


----------



## cdnNick (May 28, 2011)

maranello055 said:


> Good job!
> 
> If you want an easier way...
> 
> ...


Like most new and interesting technology it's not available in Canada.

This is hardcore, do you have a goal in mind for how much you are hoping to cut your energy bill by?


----------



## Red Squirrel (Jun 29, 2009)

Yeah that's the thing, stuff is much harder to get here. Even stuff like the DIN stuff I had to order from the states, and yesterday I got a surprise customs bill. :/ The nest sounds cool, but it still does not do what I want. I want to set the schedule not let it learn, as it changes day to day. 

So after looking at a few solutions I realized it would be more fun and effective to build my own. I'm on my lunch now and heading back to work soon, I just turned it up in live mode. I'll be monitoring it from work. I'll then be off for 2 days to give me a chance to continue monitoring it and tweaking as needed.


----------



## Thadius856 (Jun 2, 2011)

Fun! Been planning a 22-port Cat6 install for almost a year now. Just haven't started because I hadn't decided which rack and panels I want (and where to put them).

Only one thing I wanted to ask: the cabling you ran through the HVAC is plenum-grade, right?


----------



## Ironlight (Apr 13, 2011)

There is absolutely no good reason to use plenum rated cable in this application. None of his wiring even runs through a dead air space.


----------



## Thadius856 (Jun 2, 2011)

Are the duct sensors simply taped to the outside of the ducts? I initially thought the tape covered a hole where the cabling entered the duct, where it was installed, hence the plenum grade question.

Otherwise, riser grade seems sufficient.


----------



## Red Squirrel (Jun 29, 2009)

Yeah it's riser grade, When I bought the cabling a couple years back I wanted to go plenum but could not justify the price, but the ability to be able to run through a duct if I have to would be nice. In this case the sensor is right where the tape is. I used a knockout bit, made a small hole, covered the sensor in silicone so it does not make contact with the duct or tape and short out and shoved it in and then taped over. The silicone is good to around 200C. 

The system has been running for over 24 hours and it's running great. I did not wake up to a freezing or boiling house this morning, the schedules kicked in at proper times and all is good. I'm off today so it kicked on the day off schedule and keeping the house warmer than if I'd be at work.


----------



## Thadius856 (Jun 2, 2011)

Very nice! I have only a single zone/thermostat my house, and I'd love to control multiple zones this way, but I can't think of a way to get one of those zone control devices into my attic.

Keep it up.


----------



## Red Squirrel (Jun 29, 2009)

Finally added the outside temp sensor. This is a project I did in Winter so I did not want to start punching holes through my house when it's 30 below and I doubt the caulk would cure properly. Finally added it today. Made a small hole, put in a piece of pex, passed the sensor through, and caulked the hell out of it at both ends, it's curing now. Hopefully it wont leak. D: Next storm I'll have to keep a close eye, but think I should be fine. I've installed a dryer vent before and it does not leak.  Caulk and proper hole angle is key.



Now I get an actual reading on the last entry. Yet another way to check the weather without needing to go outside. Because who would want to do that. 

Also another sign Winter is coming, it's 9pm and it's already dark out. I was pretty much racing against the clock finalizing the outside portion. 

I may in the future add an outside intake with a damper that opens/closes based on the outside temp, and what it's set at. So when I get AC, say I set the temp to 20 but it's night time so it's 15 outside, then it wont run the compressor, it will just open the damper. Same idea with the furnace, if it happens to be a hot day then it wont run. For now it's nothing more than a convenience of getting a real time temp... and pretty graphs in Pandora. Yeah I know, I'm a geek.


----------

