gonium.net » logging http://gonium.net/md so much time, so little to do. Sat, 11 Sep 2010 16:42:09 +0000 en hourly 1 http://wordpress.org/?v=3.0.1 New Temperature Page http://gonium.net/md/2009/01/08/new-temperature-page/ http://gonium.net/md/2009/01/08/new-temperature-page/#comments Thu, 08 Jan 2009 07:50:33 +0000 md http://gonium.net/md/2009/01/08/new-temperature-page/ I now publish the temperatures I am measuring in Kaiserslautern on the temperature page. Slightly easier to find ;-)

]]>
http://gonium.net/md/2009/01/08/new-temperature-page/feed/ 0
USBTemp: Continuous Temperature Monitoring http://gonium.net/md/2009/01/03/usbtemp-continuous-temperature-monitoring/ http://gonium.net/md/2009/01/03/usbtemp-continuous-temperature-monitoring/#comments Sat, 03 Jan 2009 18:21:09 +0000 md http://gonium.net/md/?p=124 Kaiserlautern, Germany

Its this time of the year: I have time for a small project. This year I have built an USB-powered thermometer. Basically, you just plug it into an USB port. Then you can query the module via a small commandline tool. I wanted to be able to use my NSLU for creating temperature graphs. The image above is the temperature in Kaiserslautern, Germany – updated every 15 minutes.

The code and the schematic are open-source, licensed under the terms of the GPL. The code is available at the Mikrowerk code repository:

USBTemp start page at Mikrowerk

On these pages you can read more about the actual device and the software. This post describes how to use USBtemp to record temperature information continuously. Im am using my trusty NSLU running Debian as a host – any other Linux/Mac machine will work the same way. The NSLU is a NAS device. It is small and doesn’t consume too much power (about 20 W).

My NSLU home server

The USBTemp device is attached to the second USB port of the NSLU. Using the host software I can easily query the sensors of the device:

$ ./usbtemp sensors
2 sensor(s) found, querying
sensor 0: ID 9F17A5010800 type: (DS18S20)
sensor 1: ID B46865010800 type: (DS18S20)

The first sensor is soldered on the USBTemp board itself – it monitors the temperature in my office. The second sensor is attached to my balcony:

Outside sensor

Actually the sensor is hidden in the white box to protect it from rain. The sensor is the second in the list above, so I can query it using the command

/usbtemp temp B46865010800
searching sensor with id B46865010800 - using sensor handle 1
reading sensor 1 (°C): +1.1875

In combination with RRDTool it is easy to create timeline graphs. The USBTemp package contains scripts that help you to do this. First, you have to edit the settings in etc/config.sh:


# This file contains the configuration. Adjust it to meet your needs.
SENSOR1_ID="9F17A5010800"
SENSOR2_ID="B46865010800"
TEMP_DATABASE="$HOME/usbtemp/temperatures.rrd"
GRAPH_DIRECTORY="$HOME/usbtemp/temp-graphs"

Then you must define the USB_HOME environment variable to point to your USBTemp installation directory, e.g. (for bash)

export USBTEMP_HOME=/home/md/Projects/usbtemp/trunk

As soon as you like the settings you can use bin/generate-db.sh to create the RRDTool database. Please review the script if you want to adjust some settings. I use the cron daemon to query the sensors periodically (every five minutes) and update the plots every 15 minutes. This is the crontab:

# Linux cron can handle environment variables
# set usbtemp path
USBTEMP_HOME=/home/md/Projects/usbtemp/trunk

# m h dom mon dow command
*/5 * * * * $USBTEMP_HOME/bin/log-temperature.sh > /dev/null 2>&1
*/15 * * * * $USBTEMP_HOME/bin/plot-temperature.sh > /dev/null 2>&1

I use another little script to upload the graphs of the external sensor to my webserver. For my personal use, I also generate graphs of my office temperature – but I don’t publish these :-)

Here are the currently available temperature plots.

]]>
http://gonium.net/md/2009/01/03/usbtemp-continuous-temperature-monitoring/feed/ 4