Home Automation (HVAC)

Originally posted on ETO though I would share with AAC too.
Home Automation controlling the HVAC system​
The intention for building this system was to compliment the retrofit of the heating system for my uniquely built home. The home is a three level house built in 1936. It was originally built with forced air heat without central air. The central staircase design meant there is 18’ between the floor of the lower level and the ceiling of the upper level. Keeping uniform temperatures was difficult to say the least.

Air circulation is what is needed. So I installed an air circulator with ductwork fished down an inside wall from the attic and over to the ceiling of the top level. This setup has a remote bulb thermostat to actuate a 4” inline fan when there is heat to move and a place to install an air filter. This went a long way to making the space more livable during the winter but it needed more heat down on the lower level.​

The next step taken was to change from forced air to a hot water boiler system. Radiators were installed in all the rooms with valves at the boiler to create zones. Each room had its own thermostat. That is 5 zones in a 1400 sq ft home! Now the house is uniformly warm and comfortable on all 3 levels. At first I used a few different programmable thermostats with some mercury switch/bi-metal thermostats controlling the heating needs.

Now is where the Home Automation System was needed. I kicked around a few ideas, should I use MS Visual Basic for a GUI? I thought better of it and decided to go with the NetBurner PINK70 http://www.netburner.com/products/serial-enabled-web-server/pink70 . This nifty little device houses a web server that you can interface to a microcontroller (uC). It has 100 variables to play with and can send email/text messages to alert you of events.

I mentioned Visual Basic, as Basic is the language that I know. Using PicBasic Pro I set out to tackle this project. I had to learn HTML to work with the PINK70. My HTML code worked but was not pretty and needed cleaned up. Fellow ETO member micr0man helped me out by working on the web page after I had it roughed in. He spent time adding JavaScript, .css, Ajax, jquery and calendar files to give the web page the finishing touches. Thank you David.

Basically it operates like 5 individual 'set back' thermostats. aka programmable thermostat.
With 'Wake', 'Leave' ,'Return', and 'Sleep' times and temperature settings for Monday through Friday, then Saturday and Sunday have 'wake' & 'Sleep'. I went so far as to have a switch on the nightstand next to my alarm "Sleep alarm Switch" to switch between Work Day and Non-Work day settings. "On" = Work day; "Off" = non work day.
' if day <= 5 then
if sleepalarmswitch = 1 then
'if day >= 6 then
if sleepalarmswitch = 0 then
By changing these lines of code you can change it to follow Mon-Fri /Sat-Sun or the sleep alarm switch .

Web page calendar feature:

All these files are in the PINK70:



This web interface with a uC gives me "anywhere" control of the system. Of course this web page is the final look and I started with one zone at a time on a solder-less breadboard.

Now that the prototype is working well I need to make 5 thermostat units (one for each zone) and have them be presentable enough to hang on the wall in each room...
First was the PCB's. I used Eagle to lay out the schematic and boards then chose OSH Park https://oshpark.com/ to do the work.
The Pic Basic Code for the thermostat units can be seen here: http://pastebin.com/URdzKce
Here is the .asm code for the thermostat unit http://pastebin.com/xJbyfMG7

I have just recently added a bootloader to the slave units to be able to update the Firmware through the X-bee system. Here is the .asm code for the bootloader running 4 MHz internal xtal and 9600 baud. http://pastebin.com/RcTFmNjd
You assemble that with MPASM to create a .hex file then with PicKit2 load the hex file to your slave pic. From there you can upload new firmware with X-bee/serial.
micr0man directed me to tiny bootloader found here: http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm
Another fellow ETO Member Jon_Wilder helped me configure the .asm file to work at the lower baud rate my system was designed with. Thank You Jon.

By using the X-bee serial explorer board from Sparkfun :https://www.sparkfun.com/products/9111 and one additional X-bee you can change the x-bee channel and upload your program to the individual thermostat units.This is the X-bee profile you can load with X-CTU http://pastebin.com/EL5e4sWJ ; by modifying the Destination Address (ATDL) and Source Address (ATMY) with the node's address you then are talking to just that node. The PINK Master Vars .pdf (located below) has all the node addresses listed in the left column.

The Slave nodes have this code which checks for the Tiny Bootloader GUI 'ping' which is '193' then does a software reset of the PIC to initiate the bootloader sequence.
  hserin 250,read_serial2,[ x]  'look for bootloader activity
  debug dec x,cr
  if x = 193  then  'reset the pic to enter bootloader mode
@ reset
The Master has this code to check if there is a bootloader conversation and waits so only one is talking at a time.
SERIN2 RX,Baud,250,bedroom_set1 ,[mem1,mem2,mem3] 'listen to the line to check for bootloader activity
  debug "Bootloader programming in Progress",dec mem1,dec mem2,dec mem3, cr
  pause 18000
  goto timeout5  'skip com with bedroom for now
I have included the Eagle .brd file below.

Then the cases. I searched around and found these: http://www.mouser.com/ProductDetail/Hammond/1597CGY/?qs=/ha2pyFaduhuDRlkNpAScaNp5vW45stNzhljxRv/myc=

Ran them through my mini-mill to get this:

Last edited 8/31/2014
Added a bunch of links and more information on the project.
More to follow. Stay tuned. Next up: The Master control unit...

Blog entry information

Last update

More entries in General

Share this entry