Cheap USB temperature logging

At dealextreme.com they sell a cheap USB thermometer dongle. Thanks to Revalak there is a driver available for linux. This makes it very easy to setup temperature monitoring using munin.

Get the device working

Download the temper source code here: temper-1.0.tar.gz. Compile it using make, plug in the devices and see somthing like:

Found device: 1130:660c
Found deviceNum 0
Trying to detach kernel driver
Device already detached
Device already detached
sending bytes 10, 11, 12, 13, 0, 0, 2, 0
sending bytes 82, 0, 0, 0, 0, 0, 0, 0
sending bytes 10, 11, 12, 13, 0, 0, 1, 0
Other Stuff (232 bytes):
57 58 14 00 14 00 53 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
sending bytes 10, 11, 12, 13, 0, 0, 2, 0
sending bytes 84, 0, 0, 0, 0, 0, 0, 0
sending bytes 0, 0, 0, 0, 0, 0, 0, 0
sending bytes 0, 0, 0, 0, 0, 0, 0, 0
sending bytes 0, 0, 0, 0, 0, 0, 0, 0
sending bytes 0, 0, 0, 0, 0, 0, 0, 0
sending bytes 0, 0, 0, 0, 0, 0, 0, 0
sending bytes 0, 0, 0, 0, 0, 0, 0, 0
sending bytes 0, 0, 0, 0, 0, 0, 0, 0
sending bytes 10, 11, 12, 13, 0, 0, 1, 0
temperature 86.90F 30.50C

Be sure to have sufficient rights or use sudo to run the program. You now have a working thermometer. The output of temper however is not sitable for munin read out directly. I have made some changes to the source to only have put a number on screen. Download the modfied source here. Compile a gain and run. Now you should only see the temperature:

26.00

Setup munin

If you do not have munin running yet setup it up using a guide or howto found on the internet.

Then to enable the temperature logging simply add a script named temp in /etc/munin/plugins/ with the following in it:

#!/bin/shif [ "$1" = "config" ]; thenecho 'graph_title Temperature'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Cabinet temperature in Celsius'
echo 'temp.label temperature'
exit 0
fi
echo -n "temp.value "
/path/to/temper/temper

Be sure to replace /path/to/temper/ with the path temper is in.

Then in /etc/munin/plugin-conf.d/munin-node add:

[temp]
user root

This will make munin to run temper as root and thus having sufficient permissions to the USB device.

Now restart munin and wait for the data to be gathered, see picture at top o the post.

Leave a Reply

Your email address will not be published. Required fields are marked *