Archive: 2012/05

Sense temparature and humidity at your home

Long time no see. What’s up ? I’ve been working hard for about a year and have no time to write blog. Here is old story but I’ve not written yet.

You always take some attension about tomorrows weather and current temparature and humidity roughly. “Today is cold”, “Today is dry”, “Today is moist”…and so on. When you know temparature and humidity correctly, your feeling go more clear ? Of course, it gonna be cheap. OK, here is my trial. My budget doesn’t exceed over $200.

I’ve decided to use Strawberry Linux’s USBRH-FG sensor. You can buy it from this URL «http://strawberry-linux.com/catalog/items?code=52002>>. It costs about $50. Here is the photo if USBRH-FG.

I’ve decided to measure outside temparature and humidity, so USBRH should go into outside and should be resistant from rain, wind, and sunlight in order to take correct measure. Here is diagram about my installation. USBRH is installed into weather resistant case and its output is converted into Cat5 cable. It doesn’t mean that output of USBRH is converted to TCP/IP. It’s absolutely USB protocol which runs inside of Cat5 cable. Cat5 cable is also weak against outside weather, so I’ve covered Cat5 cable with ordinary PVC pipe.

I’ve decided to connect my server and USBRH device with USB expander in order to connect between inside of my home and outside. USB cable cannot extend more than 5 meter, so I’ve bought usb expander and connect about 20m between USBRH device and server, and it costs about $60. Here is photo of usb expander.

Here is a part of my installation. I’ve bought some weather proof case to be installed at nearest home depot. I’ve set USBRH with some small box and punched some small holes in order for outside air and moisture to go through into box moderately.

OK, here is software turn. I’ve installed USBRH linux driver into my server from here ( http://green-rabbit.sakura.ne.jp/usbrh/ ). It shows current temparature and humidity like this. Unit of temparature is celsius.

# cat /proc/usbrh/0/status
t:23.42 h:67.38

I’ve also installed munin ( http://munin-monitoring.org/ ) in order to store sensed data and see log-term movement of temparature and humidity. I’ve written some plugin for munin to work with USBRH sensor.

#!/bin/sh
# -*- sh -*-

: << =cut

=head1 NAME

Plugin for USBRH - Plugin to measure USBRH device's temparature and humidity. 

=head1 NOTES

Especially the average and max values on the bigger graphs (yearly) can be interesting.

=head1 AUTHOR

Contributed by Mitsutoshi Kiuchi

=head1 LICENSE

GPLv2

=head1 MAGIC MARKERS

 #%# family=auto
 #%# capabilities=autoconf

=cut

. /usr/share/munin/plugins/plugin.sh

MODEL="USBRH"

if [ "$1" = "autoconf" ]; then
    echo yes
    exit 0
fi

if [ "$1" = "config" ]; then

    echo graph_title "$MODEL outside"
    echo 'graph_args --base 1000 -l 0 '
    echo 'graph_scale no'
    echo 'graph_vlabel Celsius'
    echo 'graph_category sensors'
    echo 'usbrht.label temparature'
    echo 'usbrhh.label humidity'
    print_warning load
    print_critical load
    exit 0
fi

TEMP=`cat /proc/usbrh/0/temperature`
RH=`cat /proc/usbrh/0/humidity`
echo "usbrht.value $TEMP"
echo "usbrhh.value $RH"

and, here is sample output.

Wow, it’s good looking.