1wire attic cooling

The attic was hot. Mounting a large fan in the vent seemed to help, but it was drawing 5.5A continuously, which is too much for the thermostat/humidistat my roommate bought. He left it on all the time, which is quite a bit of wasted power. I’ve seen 1wire devices online for quite a while and I’ve always wanted to play with them. The easiest way I can afford to connect sensors to computer is with 1wire. I’ve found my excuse.

The overall idea…
The 1wire temperature sensor is connected to computer with a USB interface. The scripts do magic. The X-10 interface is connected with serial interface. The fan is plugged into an appliance module.

I’ve been a fan of the ExtremeTech books, so I picked up a copy of Weather Toys to get me started.

 

The interface I used the DS9490R 1wire USB adapter.
http://www.hobby-boards.com/catalog/product_info.php?cPath=23&products_id=1503

The temperature sensors I used are DS18S20 1-Wire Digital Thermometer.
http://www.hobby-boards.com/catalog/product_info.php?cPath=26&products_id=93

To connect the sensors and interface:
Cat5e
RJ14 plug
Dual Modular Surface Jack 6 Conductor (only using 4 Conductors)

Additional wiring info
http://www.hobby-boards.com/catalog/howto_wiring_diagram.php?referer=howto_adaptors.php

Once you have the hardware connected, test it with the manufacturer’s viewer to make sure everything is communicating. I used my windows XP laptop for this.
http://www.maxim-ic.com/products/ibutton/software/1wire/OneWireViewer.cfm

Once that’s working, I’m going to go back to my linux box.

I’m a fan of linux. The price is right, it has a pretty large, helpful user base. I chose Ubuntu because it’s my favorite distro this week.

Ubuntu server
http://www.ubuntu.com/products/WhatIsUbuntu/serveredition

Once that’s running and updated, I’m going to install owfs.
http://owfs.org/

You can install from source, but I prefer packages
http://ppa.launchpad.net/smurf/ubuntu/pool/main/o/owfs/
libow-perl_2.7p14-1_i386.deb
owfs_2.7p14-1_i386.deb

These packages depend on an older version of perl, so I modified the .deb for the version of perl installed with Jaunty.
http://ubuntuforums.org/showthread.php?t=636724

Once owfs is installed, I launched the owfs server using a USB device on port 3000.

/opt/owfs/bin/owserver -u -p 3000

To see if you’re able to read you’re sensors, use owdir to list connected devices

/opt/owfs/bin/owdir -s 127.0.0.1:3000

Mine works correctly. one of my temperature sensors is /10.F0B9D5010800
Next I list the attributes I can read from the sensor.

/opt/owfs/bin/owdir -s 127.0.0.1:3000 /10.F0B9D5010800

I’m only interested in the temperature right now, so I read the temperature

/opt/owfs/bin/owread -s 127.0.0.1:3000 /10.F0B9D5010800/temperature

I live in the US and prefer to read my temperature in Fahrenheit. Use -F

/opt/owfs/bin/owread -F -s 127.0.0.1:3000 /10.F0B9D5010800/temperature

If everything seems to be working, you might consider making owserver start with the computer.
https://help.ubuntu.com/community/UbuntuBootupHowto

I have some crappy perl I threw together in a hurry to control the fan and web page generation.

The graphing is just a modified version of http://www.it-slav.net/blogs/?p=75
It works so well that the only changes I made were to rename the script to graphtemp.pl, replace the sensors with my own, and put my website on the graph.

To control the fan, I use X10 and heyu
http://heyu.tanj.com/

The interface I used is the CM11a serial X10 interface.
The module I used to control the fan is the AM466.

I assume reader knows how to make symlinks and adjust permissions accordingly.

# Crontab -l ####################################

* * * * * /usr/bin/perl /home/raging/hvac.pl
*/5 * * * * /usr/bin/perl /home/raging/graphtemp.pl > /home/raging/graphtemplog.txt
*/15 * * * * /usr/bin/perl /home/raging/fanmaster.pl  >> /home/raging/fanmasterlog.txt

# cat fanmaster.pl ##############################
#!/usr/bin/perl
# fanmaster.pl
sleep 10;
use OW;
OW::init("-F localhost:3000");

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

my $attic = OW::get("10.2FA8D5010800/temperature");
$attic =~ s/^s*(.*?)s*$/$1/;

my $outside = OW::get("10.F0B9D5010800/temperature");
$outside =~ s/^s*(.*?)s*$/$1/;

printf "%4d-%02d-%02d %02d:%02dt",$year+1900,$mon+1,$mday,$hour,$min;
if (abs($attic - $outside) < 10){
printf "Less than 10 Degrees - Turning fan OFFt%.1ft%.1ft%.1fn", abs($attic - $outside), $outside, $attic;
system("/usr/local/bin/heyu off b16");
} else {
printf "More than 10 Degrees - Turning fan ON t%.1ft%.1ft%.1fn", abs($attic - $outside), $outside, $attic;
system("/usr/local/bin/heyu on b16");
}

# cat hvac.pl ###################################
#!/usr/bin/perl
# hvac.pl
use OW;
OW::init("-F localhost:3000");
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

my $duct = OW::get("10.4572D5010800/temperature");
$duct =~ s/^s*(.*?)s*$/$1/;

my $shelf = OW::get("10.72B1D5010800/temperature");
$shelf =~ s/^s*(.*?)s*$/$1/;

my $attic = OW::get("10.2FA8D5010800/temperature");
$attic =~ s/^s*(.*?)s*$/$1/;

my $outside = OW::get("10.F0B9D5010800/temperature");
$outside =~ s/^s*(.*?)s*$/$1/;

open (HVAC, ">/var/www/hvac.htm");
print HVAC "<html><head><title>Temperature</title><meta http-equiv="refresh" content="10" /></head><body>n";
print HVAC "<font size="+2">Temperature Monitor</font><br>n";
printf HVAC "Last Updated: " . "%4d-%02d-%02d %02d:%02dn<br>",$year+1900,$mon+1,$mday,$hour,$min;
if ($duct < 57){
print HVAC "AC cycle is probably <b><font color="#0000FF">ON</font></b><br>n";
} else {
print HVAC "AC cycle is probably <b><font color="#FF0000">OFF</font></b><br>n";
}
printf HVAC "<b>Attic - Outside Difference:</b> " . "%.2fn<br>", abs($attic - $outside);
print HVAC "<img src="hvac/temp0-day.png"><img src="hvac/temp0-week.png"><br><b>Current Outside Temp:</b> $outside<br><br>n";
print HVAC "<img src="hvac/temp1-day.png"><img src="hvac/temp1-week.png"><br><b>Current Attic Temp:</b> $attic<br><br>n";
print HVAC "<img src="hvac/temp2-day.png"><img src="hvac/temp2-week.png"><br><b>Current Duct Temp:</b> $duct<br><br>n";
print HVAC "<img src="hvac/temp3-day.png"><img src="hvac/temp3-week.png"><br><b>Current Bedroom Temp:</b> $shelf<br><br>n";
print HVAC '</body></html>';
close (HVAC);
#################################################

12 thoughts on “1wire attic cooling

  1. Well the idea is nice but doesn’t the computer running all the time and the fan running about 1/3 of the time use more electricity than the fan running all the time. A photosensor feeding a relay to run the fan in the daylight or an old mercury switch t-stst would use the least amount of electricity.

    Like

  2. ok. but where are you ejecting the attic heat to? is it being forced out the attic through the vents in the eaves or are you just circulating air through out the attic? my idea was to have two fans, one intake and one exhaust at each attic vent to pull air across and out.

    Like

  3. Hello!
    Nice use of Linux, even though Ubuntu isn’t my favorite. However that’s an older version of OWFS. We’re up to 2.7p24 as of yesterday.

    Deb versions should catch up within the week.

    Like

  4. Nice job – Have you found the X10 to be reliable enough? It worked well enough for me until I switched houses and then it was about 30% reliable, not exactly stellar, lol. Using insteon now, but I think the house wiring has a lot to do with x10 reliability.

    Like

  5. Several years later, now… I’m no longer living there. The computer was on all the time anyway (it was also MythTV). There are many other ways to accomplish the same thing, but this is how I did it. I was using the Perl interface, so FUSE wasn’t required.
    This setup is gone, as are the updated scripts that added checking for dropping sensors or seeing abnormally high temps. If there was ever a fire in the attic, I would have hated to keep feeding air to it.

    Like

Leave a comment