02 December 2013

532. TEMPer temperature monitoring USB stick on Debian Wheezy

Because the air conditioning in my office has a habit of turning itself off, and since I'm running my beowulf cluster in there, and since it's Australia, I've become interested in monitoring the temperature in my office.

The USB stick itself looks nothing special, so here's the card from the box it came in.


A colleague of mine got a TEMPer thermometer USB (0c45:7401 Microdia) back when he didn't have any air conditioning at all in his office and wanted to prove to the university that the temperature got so high that it was impossible for him to do any work on some days. He's now got air conditioning.

Anyway, plugging in the USB stick got me the following:
* /dev/hidraw5 and /dev/hidraw6 get created

* DMESG shows
[441126.932728] usb 2-4.2: new low-speed USB device number 11 using ehci-pci [441127.025790] usb 2-4.2: New USB device found, idVendor=0c45, idProduct=7401 [441127.025803] usb 2-4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [441127.025811] usb 2-4.2: Product: TEMPerV1.2 [441127.025818] usb 2-4.2: Manufacturer: RDing [441127.030229] input: RDing TEMPerV1.2 as /devices/pci0000:00/0000:00:02.1/usb2/2-4/2-4.2/2-4.2:1.0/input/input24 [441127.030516] hid-generic 0003:0C45:7401.000F: input,hidraw5: USB HID v1.10 Keyboard [RDing TEMPerV1.2] on usb-0000:00:02.1-4.2/input0 [441127.033234] hid-generic 0003:0C45:7401.0010: hiddev0,hidraw6: USB HID v1.10 Device [RDing TEMPerV1.2] on usb-0000:00:02.1-4.2/input1
* lsusb shows
Bus 002 Device 011: ID 0c45:7401 Microdia

Searching online for 0c45:7401 brought up this cheesily title post: http://www.linuxjournal.com/content/temper-pi

From that post:
 If instead dmesg says this:
[snip]
and lsusb says:
$ lsusb
Bus 001 Device 005: ID 0c45:7401 Microdia
then congratulations, you have the new TEMPer probe and will have to use completely different software. 
While that sounds as if you'll have continue searching for a new how-to, in fact the entire post is about that particular version. So, I followed the instructions at Linux Journal -- I'll just offer my step by step version of it here with some added detail:

sudo apt-get install python-usb python-setuptools snmpd git
sudo easy_install snmp-passpersist
mkdir ~/tmp
cd ~/tmp
git clone git://github.com/padelt/temper-python.git
cd temper-python/
sudo python setup.py install

At this point I could get a temperature reading by doing:
$ sudo temper-poll 
Found 1 devices Device #0: 24.4°C 75.9°F
But running stuff as root is unsatisfying, so I created a UDEV rule:
$ sudo vim /etc/udev/rules.d/80-temper.rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7401", GROUP="users", MODE="0666"
I then unplugged the USB stick, did
sudo service udev restart

and plugged it back in.
$ temper-poll 
Found 1 devices
Device #0: 25.8°C 78.3°F

Sweet.
Finally, I set up a cronjob that would check the temperature, update a plot and put it in my Dropbox:
$ crontab -e
*/2 * * * * sh /home/me/temper.sh
where temper.sh looks like this:
temp=`/usr/local/bin/temper-poll |grep Device|gawk '{print $3}'|sed 's/°C//'` when=`date +%s` thetime=`date +%D' '%T` if [ -n "$temp" ]; then echo $when $temp $thetime>> /home/me/temper.dat fi gnuplot /home/andy/temper.gplt cp /home/me/temper.eps /home/me/Dropbox
The temper.gplt script looks like this:
set term postscript eps enhanced colour set output 'temper.eps' unset key set ylabel 'Temperature (Celsius)' set border 3 set xtics nomirror set ytics nomirror unset xlabel set xdata time set multiplot set size 0.5,0.45 set origin 0,0.05 set timefmt "%H:%M:%S" set title 'Daily' set xtics 30000 plot 'temper.dat' u 4:2 w points pt 1 ps 0.15 set origin 0.5,0.05 set title 'By Day' set timefmt "%m/%d/%y" set xtics 100000#0 plot 'temper.dat' u 3:2 w points pt 2 ps 0.5 set size 1.0,0.5 set origin 0.0,0.5 set timefmt "%m/%d/%y %H:%M:%S" set xtics 30000 set title 'Log' plot 'temper.dat' u 3:2 w lines
and the plot looks like this:
Temperature in a lab at a leading Australian research institute. In five years they have not been able to fix the air conditioning.  On 01/04 someone pushed a cardboard box against the sensor which lead to a slower change in temperature.

25 November 2013

531. Briefly: NWChem 6.3 -- issues with planewave (PSPW) module and AMD FX8150 and 8350 CPUs

This is more of an announcement or warning than a proper blog post:

Both FX8350 and FX8150 have trouble running the pspw module causing the calculation to lead to exploding structures:
http://www.nwchem-sw.org/index.php/Special:AWCforum/st/id1059/Issue_with_pspw_using_nwchem_6.3....html

My other nodes have no trouble running the job in question. Also, the issue was only found in nwchem 6.3 -- nwchem 6.1.1 worked fine. So it's not an FX83x50 related fault per se.

Again, see the post at the nwchem-sw.org site for more information.

18 November 2013

530. Briefly: Adding a new entry to Default applications in Gnome 3. Example using Firefox

I'm tired of google chrome/chromium -- for some reason more and more websites are rendering incorrectly in it. Part of the reason is because I refuse to allow just any website to set cookies, but that can't explain all instances (e.g. I'm having major issues with any elsevier journals). I'm also tired of google in general, especially after having spent some time with google plus.
Anyway, I recently showed how to install firefox: http://verahill.blogspot.com.au/2013/11/528-briefly-setting-up-64-bit-pre-built.html

I'll show here to set it as a selectable application in the System Settings/Details

At the beginning the following selections are available:

The key to adding a new 'Default Application' is simply making sure that it appears in the MIME file type associations. And one way to do that is to create a .desktop file and use update-desktop-database to read it:

sudo cp /usr/share/applications/iceweasel.desktop /usr/share/applications/firefox.desktop
sudo sed -i 's/Iceweasel/Firefox/g' /usr/share/applications/firefox.desktop
sudo sed -i 's/Exec=iceweasel/Exec=firefox25/g' /usr/share/applications/firefox.desktop
sudo sed -i 's/Icon=iceweasel/Icon=firefox/g' /usr/share/applications/firefox.desktop
sudo update-desktop-database

Once that's done we get the following:
 You can then set up a shortcut launcher, e.g.
(you could of course just have it execute the command directly, but what's the challenge in that?)