My central HVAC system has issues cooling down the 3rd floor of our house during the summer.
Even with all 1st & 2nd floor traps closed, the system, which is in the basement, has difficulties cooling down the 3rd floor.
The higher the exterior temperature, the higher the difference of temperature between the 1st and 3rd floors.
The average difference is somewhere between 4 and 5°C, and I measured differences as high as 10°C in the beginning of the summer.
That means if I set my (1st floor) thermostat to 23°C, the 3rd floor temperature can reach 33°C. Quite uncomfortable to watch TV or work at our desks / computers.
Even more so since I installed a (ceiling-mounted) HD projector to replace our old plasma screen on the 3rd floor, where our home theater is setup. That thing will start making a lot of (fan) noise as the temperature climbs (fixed by another DIY project)… And temperature can climb pretty fast at the highest point of the house!

To solve the problem, I started using my central HVAC system to cool the 1st & 2nd floor only, and I’m using a portative air conditioning unit on the 3rd floor. It’s a 9000 BTU unit I bought a while ago (at Costco), when we lived somewhere else, and it was sitting in the storage room since we moved. After a couple of tests to make sure it worked fine, and was powerful enough to cool the complete 3rd floor, I installed it ‘permanently’ in the storage room, and attached it using a flexible duct to a hole I made in the storage room wall. I used semi-flexible duct to push the hot air outside. (I didn’t need to cut a hole for that since the storage room is in fact the attic, where there are ventilation holes.)

Here’s that setup in pictures:








To control the AC unit, I use my PowerMac (which is always on), to which a SmartHome PowerLinc USB Controller is connected.
I created a small PHP script which runs every minute, and determine if the AC should be on or off, and tells Shion to turn it on or off. Shion talks to the USB controller, which in turns talk to the SmartHome ApplianceLinc, which then either activate or desactivate the power outlet. The AC unit is always on, so when the power outlet is on, the AC unit will always runs.

My PHP script uses many variables to decide if the AC should be on or off:

  • Programmation: I created programs, and saved them in a database. For example, I have one program which I called “We’re using the 3rd floor when the little ones are asleep”. This program defines the following:
    Every day @ 07:00 - 30°C
    Every day @ 19:00 - 25°C
    Every day @ 23:00 - off
    Weekends @ 13:00 - 25°C
    Weekends @ 16:00 - 30°C
    Basically, I want the temperature to always be kept below 30°C (except during the night), but from 7pm to 11pm every day, and from 1pm to 4pm on the weekends, I’d like the temperature to get to 25°C. This is when we usually use the home theater, since this is when our kids are asleep, and we’re not.
    Another program is called “We’re not home”, which I activate when we all leave the house for a couple of days or more (vacation or something). AC is always off in that program.
  • The AC unit performance rating: I measured how fast the AC unit is capable of lowering the temperature, and use that number to start the AC early, in order to try to reach the programmed temperature on time. (My current calculated AC performance rating is 0.012°C per minute.) For example, if my program says the temperature should be 25°C at 7pm, the AC will start earlier than that, if necessary, in order to be at 25°C at 7pm. I have implemented a maximum time to start in advance; I won’t allow the AC to turn on more than 3h before a programmed event, even if that means the temperature won’t be reached in time.
  • Manual override: I can manually override any scheduled program by turning the unit on or off myself. My script will then ‘protect’ my manual setting for 3 hours. At some point, I might change that so that it’s protected until the next programmed event, but I can’t really find a good incentive to implement that at this time.
  • Temperature thresholds: I selected thresholds to allow the temperature to vary a little above or below the programmed temperature, in order to control the number of start / stop of the AC unit. If the programmed temperature is set at 25°C, the unit will work until that temperature is reached, will then stop, and won’t start again until the temperature is 26°C. (My current thresholds are 0°C below, 1°C above.)
    My PHP script uses AppleScript (using the osascript command line executable) to talk to Shion. I had to run the Apache server as myself, instead of the usual nobody/www user, since this is required to be able to interact with any program that I run.

I made a simple iPhone webpage to display some stats, and allow me to start or stop the AC manually, or change the selected program. I made it accessible from the Internet (running on a non-standard port, and protected using an htaccess password), so that I can control the AC from anywhere.
The same webpage renders quite well in any Safari, so I use the same page on all the computers at home to control the AC when I’m at home, and my iPhone is turned off.

Here’s a screenshot of the iPhone webpage, which looks like a native app once bookmarked on my iPhone home screen!


To measure the temperature, I’m using TEMPer USB devices. I bought two from eBay for a couple of dollars.
I found a working command line Mac (universal) executable that reads the temperature from the TEMPer device, and outputs it to stdout.
I read the temperature continually from the device, and save the average each minute in a database. I can graph temperature of the 1st and 3rd floors using this data, if I want to. This is what I used to measure the difference of temperatures before I started all this.

If you’d like to see the source of either my program.php script, from my iPhone webpage, or my database, here’s the very raw package: