House Sensors
As we have bought a new house with a basement, and we plan to put our chest freezer there, I started worrying about the time it would take us to notice a malfunction in the freezer, the lid left ajar, or a power-outage while we are gone. I decided to monitor the freezer with the following setup:
- A dedicated "server" (currently acer one running ubuntu desktop, but I'm thinking of changing that)
- "1-wire" temperature sensor DS18B20 and 1-Wire USB Adaptor from Hobby Boards
- owfs filesystem to poll the sensor
- thermd to log the data, present it in a website and issue emails in case of problems
- sSMTP on the server to take care of the email.
- DNS records updated using a DreamHost hosting and No-Ip free DynDNS service
- apache2 Server to serve up the website
I'll try to record the steps I took to make it easier for me to do again, and for others to emulate...
1. as in [1] and [ww.hobby-boards.com/store/pages/Wiring-Diagram.html], I connected the two left pins to the middle wires in a rj12 cable. 2. I installed owfs by downloading and running configure && make & make install. this had some errors as long as I didn't have enough packages installed...so I installed them using apt-get install.
sudo apt-get install libfuse-dev libusb php5 libfuse-dev php5-dev
I added the command
opt/owfs/bin/owfs -u /mnt/1-wire/ --allow-other
to rc.local so that it is started up everytime I booted. 3. At this point, I could already see the sensors:
~$ ls /mnt/1-wire/ 28.06F625030000 81.7F9230000000 alarm bus.0 settings simultaneous statistics structure system uncached ~$ ls /mnt/1-wire/28.06F625030000/ address crc8 family id power r_id temperature temperature11 temperature9 templow alias errata fasttemp locator r_address r_locator temperature10 temperature12 temphigh type ~$ cat /mnt/1-wire/28.06F625030000/temperature -21.1875
Telling me that the current temperature (inside the freezer) is -21C 4. For logging this data I downloaded thermd. to install it a few perl packages are needed so I installed them (again using apt-get). After editing the configuration file and putting it in its place ( /etc/thermd.conf ) making a directory for the datafiles (mkdir /var/log/thermd ) and copying the script to its place ( /usr/local/bin/thermd ) one can run it
thermd -daemon
5. For mailing me when alert conditions happen I installed sSMTP ( apt-get install ssmtp ) and configured it with the following configuration file:
~$ cat /etc/ssmtp/ssmtp.conf mailhub=mail.farjoun.org:465 UseTLS=YES # Secure connection (SSL/TLS) FromLineOverride=YES # Force the From: line Hostname=snowy.farjoun.org # The name of this host RewriteDomain=farjoun.org # The host the mail appears to be coming from Root=yossi # Redirect mail for root@ to postmaster@ AuthUser=mySMTP User # Your DreamHost mail account AuthPass=mySMTP Password FromLineOverride=YES
6. hostname 7. sshd 8. apache 9. opening ports