A little project I've been working on

Red Squirrel

No Lifer
May 24, 2003
70,612
13,816
126
www.anyf.ca
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.

lrg-1219-uk1104relay.JPG



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.

lrg-1224-dinrailinstalled.JPG



The scheduling app:

lrg-1234-p2.jpg



Programs:

lrg-1233-p1.jpg



The main page:

dashboard.jpg



I have not started to wire up the house yet, but I will probably start on that tomorrow or next week, as tomorrow is my last day off for 4 days. 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 outside. 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 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 deem 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.
 

dighn

Lifer
Aug 12, 2001
22,820
4
81
pretty sweet. that looks like a really neat board. how does the web server interface to the board?

i thought about doing something similar using a beaglebone or something.
 

DominionSeraph

Diamond Member
Jul 22, 2009
8,386
32
91
So you wasted your time building this, you're going to waste electricity keeping a server on 24/7, and you're going to waste time logging in to this every day, only to save you from having a standard $10 programmable thermostat and occasionally having to manually set it?

Do you have ADD/OCD?
 

Red Squirrel

No Lifer
May 24, 2003
70,612
13,816
126
www.anyf.ca
pretty sweet. that looks like a really neat board. how does the web server interface to the board?

i thought about doing something similar using a beaglebone or something.

The board is serial so I had to write a "driver" for it. Basically it just sends commands, it's like writing to a file, but I can read too. Took me a while to get that part figured out but turned out easier than I thought. To communicate with the web interface I just use SQL. Basically the polling app just updates the SQL db with info, which is then shown on the main page. The program info is saved to the DB, and the app reads it. So it works both ways.

The board's inputs also support analog/digital type inputs so it can be used for all sorts of other stuff if you are creative. Almost tempting to buy another so I can set various sensors around the house, such as smoke/CO that would trigger a channel on/off.

So you wasted your time building this, you're going to waste electricity keeping a server on 24/7, and you're going to waste time logging in to this every day, only to save you from having a standard $10 programmable thermostat and occasionally having to manually set it?

Do you have ADD/OCD?


I have a programmable thermostat, but it only does weekly/weekend and 4 programs a day. It's ok for the most part, but I just thought it would be fun to do something more advanced, especially because I work shifts now, so I end up constantly changing it. With this interface, I just have to input my schedule once a month, and the rest is automated. Being able to change the temp from bed or the couch or even from work will also be a plus.

The server is always running anyway, it is used for other stuff. It's an Atom based server so it uses under 100w.
 

deadlyapp

Diamond Member
Apr 25, 2004
6,671
744
126
Eventually I'd like to do something like this but with full climate control allowing blinds to be opened or closed depending on the temperature and solar flux, lighting being able to be controlled from anywhere in the house, etc. Basically a computer that fully is integrated into the house. I know they have some commercial solutions that already do this but whats the fun in that.
 

busydude

Diamond Member
Feb 5, 2010
8,793
5
76
You have a hard on for neckbeard? Don't worry though.. I am not judging you. :p
 

DominionSeraph

Diamond Member
Jul 22, 2009
8,386
32
91
Being able to change the temp from bed or the couch or even from work will also be a plus.

See, I find that when I have stupid fiddly things I fiddle with them. There's something to be said for having enough of a hurdle to changing something that you turn your brain off from even considering unless it actively intrudes. If I had my thermostat on remote control, the lights on a remote control dimmer, an infinitely variable overhead fan on remote, my case, CPU, and GPU fans on remote, my graphic equalizer on remote... I'd spend all my time tweaking for "perfection" and never actually get anything done. Keeping things simple allows me to turn off that micromanagement background process and concentrate on what's important.
 

Red Squirrel

No Lifer
May 24, 2003
70,612
13,816
126
www.anyf.ca
You have a hard on for neckbeard? Don't worry though.. I am not judging you. :p

Hahahaha I never made the connection. The server name is from 2001 a space Odyssey. It's the server that controls the ship. So this is the server that controls my home automation stuff (right now just the hvac but possibly more stuff in the future). I'll probably throw nagios on there at some point too and use it for monitoring stuff.
 

brianmanahan

Lifer
Sep 2, 2006
24,627
6,011
136
So you wasted your time building this, you're going to waste electricity keeping a server on 24/7, and you're going to waste time logging in to this every day, only to save you from having a standard $10 programmable thermostat and occasionally having to manually set it?

Do you have ADD/OCD?

at least he does something constructive and cool, unlike people who just watch anime all day
 

Red Squirrel

No Lifer
May 24, 2003
70,612
13,816
126
www.anyf.ca
Pulled all the wire yesterday and today (was off) and now I just need to terminate both ends.

Added one sensor: (it's sticking out on the side, looks like a transistor)

lrg-1243-dsc04225.JPG


The electrical tape is covering the resistor solder joints so the tstat's circuit board does not short out. I figured I'd hide it in here. For upstairs I got one of those battery operated wallmount lights to hide it behind. Will be fairly stealth. :D The old thermostat (shown) will be wired in parallel and be set to like 7 degrees. In the event my system fails, it will pickup. Also acts as a backup if I have server issues. A complex system is neat for all the things it can do, but complexity also adds more chance of failure, so I have to account for that.


lrg-1244-dsc04231.JPG


DIN terminals ready and labeled appropriately.

Looking forward to seeing this system in action, and I wont have to keep messing with the programming on my tstat anymore. I can set all my shift days on a per schedule basis and it will run itself.

I also need to code in an "off" function. I did not do that yet. :p I still have a couple months before I need that anyway, so not really a big issue.
 

rsd

Platinum Member
Dec 30, 2003
2,293
0
76
Did something similar recently but went with a Home Automation package (HomeSeer Pro + my own built pc to control it). I have 2 Z-wave t-stats, multiple lights and dimmers, and door locks controllable from any PC/HTPC (media center plugin) and Phone/tablet. It's pretty fun. Definitely not super cheap though.
 

Red Squirrel

No Lifer
May 24, 2003
70,612
13,816
126
www.anyf.ca
Ok so this is finally done. I ran into an issue which turned out to be some code that has to run at least once per server session that sets some kind of flag which makes it work properly. So I put that code in my program. I had the whole thing working, decided to reboot to make sure it starts properly at startup, then realized of the issue and spent a couple days pulling hair over it. Finally working now and I can reboot the server as much as I like, it will start back up on whatever the current schedule is.


lrg-1271-dsc04269.JPG

Still need to find a piece of plastic as a cover. Will keep an eye out.


lrg-1269-dsc04271.JPG


One of the most visible sensors... well sorta visible...


lrg-1273-dsc04272.JPG

It's a light! It's magnetic so it comes off easily. It's actually in a convenient location for if ever there's a power outage or something, so it serves a purpose and is not just to hide the sensor. I may need to pull the sensor out slightly as I find the reading is off a bit.

lrg-1268-dsc04273.JPG

Server room sensor


lrg-1272-dsc04275.JPG

Return duct sensor


lrg-1267-dsc04276.JPG

Supply duct sensor

lrg-1270-dsc04278.JPG

Top view of rack with DIN rail. (patch panel is on other side)

I still need to do some wire cleanup, ordered some stuff for that. Basically rather than splice the +5v and grnd connections off the supply, I will use jumpers on some din blocks to make a +5v block and ground block, then wire it from there.


hvacctl_frontend.jpg

And finally, the interface


I want to do some more tweaks to the interface to make it more user friendly and nicer. Mostly I want to make it more tablet friendly so rather than have to type in numbers I'll have arrows.

Down the line I'll probably add some reporting features such as graphing temps and what not. That's the nice thing with a custom setup like this, I can do whatever I want with it. I've been running it live for the past few days. My old thermostat is still connected but is turned off. If I use the old thermostat it will still work. Basically which ever one calls for heat will trigger it. So if my system ever craps out at least I can revert to the old thermostat quickly without changing any connections.
 

gorcorps

aka Brandon
Jul 18, 2004
30,741
456
126
It's a light! It's magnetic so it comes off easily. It's actually in a convenient location for if ever there's a power outage or something, so it serves a purpose and is not just to hide the sensor. I may need to pull the sensor out slightly as I find the reading is off a bit.

Is the reading consistently off? If you're already happy with how it's set up it should be relatively easy to put in an adjustment (+/- a number) to make it right.
 

Red Squirrel

No Lifer
May 24, 2003
70,612
13,816
126
www.anyf.ca
Is the reading consistently off? If you're already happy with how it's set up it should be relatively easy to put in an adjustment (+/- a number) to make it right.

I thought of that, but I think what's happening too is that it might be getting air from inside the closet. It seems to be off when the furnace is running (return is just below) so I think it's forcing some air movement, and that closet is also the attic access which I need to seal better. So I'll fix that first. But yeah I could easily adjust it within my app if it was consistently off.