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
* lsusb 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
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:
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: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.
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-pollBut running stuff as root is unsatisfying, so I created a UDEV rule:Found 1 devices Device #0: 24.4°C 75.9°F
$ sudo vim /etc/udev/rules.d/80-temper.rulesI then unplugged the USB stick, didSUBSYSTEMS=="usb", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7401", GROUP="users", MODE="0666"
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 -ewhere temper.sh looks like this:*/2 * * * * sh /home/me/temper.sh
The temper.gplt script 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
and the plot 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
This is so cool! Thanks for your work and contribution! I modded your script to generate temperature complaint data for my office (ha ha!) and more importantly, grab temperatures from around my solar array to determine which tubes to pump and which ones to leave.
ReplyDeleteThanks again!
This is so cool! Thanks for your work and contribution! I modded your script to generate temperature complaint data for my office (ha ha!) and more importantly, grab temperatures from around my solar array to determine which tubes to pump and which ones to leave.
ReplyDeleteThanks again!
Downloading git+https://github.com/walac/pyusb.git#egg=pyusb-1.0.0rc1
ReplyDeleteerror: Download error for git+https://github.com/walac/pyusb.git: unknown url type: git+https
Scripts aren't working as of 1/12/16
ReplyDeleteDownloading git+https://github.com/walac/pyusb.git#egg=pyusb-1.0.0rc1
error: Download error for git+https://github.com/walac/pyusb.git: unknown url type: git+https
This works on raspberry pi (debian based raspbian) as well. The install script will fail (error: Download error for git+https://github.com/walac/pyusb.git: unknown url type: git+https) but you can download the zip and install pyucb from here https://github.com/walac/pyusb/archive/master.zip. install that then install the temper-python.
ReplyDeletesudo python setup.py install
ReplyDeletesudo: unable to resolve host ubuntu-host
Traceback (most recent call last):
File "setup.py", line 10, in
long_description=open('README.md', encoding='utf-8').read(),
TypeError: 'encoding' is an invalid keyword argument for this function
running on python 2.7
I got the error in the above comment but fixed it by adding "import io" to the top of the script and changing "open" on line 10 to "io.open".
ReplyDeleteBut then I got "No devices found" when I ran temper-poll. But I ran lsusb and found that the hardware id for my device wasn't one include in the array "VIDPIDS" near the the start of the script "temper.py" in the "temper-python" folder.
So I added my hardware IDs and reran the install script, then temper-poll again. It found one device, but then timed out trying to get the temperature.
That's as far as I got. It seems current versions of the device don't work with this.