Working External Linux Thermometer (TEMPer)

2008-10-08 21:01 - Tech

I've got a hefty deal of DIY spirit, and frugality, in my blood. In my current apartment, both the A/C in the summer, and (quite unfortunately) the heat in the winter both go onto my electric bill, both from the same unit built into the apartment. I've had various things controlled by X-10 since my dorm room in college. It's super convenient to, for example, turn the lights off after getting into bed, and never worry about it, or turn on the lights without getting out of my chair.

Turns out my HVAC unit runs off of a dedicated 220V circuit. By its nature, regular X-10 units don't work. I ended up setting up a relay in-line with its power safely, and now I have remote control to turn it on and off. I even did this once across the internet, while sitting in a restaurant — I've got the firecracker X-10 unit hooked to the linux server that runs in my apartment anyway.

This gave me the ability to schedule turning the heating or cooling on and off. I used this to keep comfortable when I was home, but not waste energy and money while I'm out at work, or asleep. What I really wanted, however, was to make a thermostat. Maintaining a particular temperature, not just "on" or "off", on a schedule. Unfortunately, my server had no idea what the temperature was, so it couldn't do this.

I found a cheap USB "TEMPer" device and tried it out. It certainly works, but only on Windows! I found plenty of links, and even a number of other people who wanted to use the device in linux, but nobody that had done so successfully. Reading and working at it for quite a while got me the knowledge that inside this device was a WinChipHead CH341 usb-to-serial adapter, and a simple temperature device hooked to that virtual serial port. Linux even had a driver for the CH341! But this crappy device made its own fake protocol with the CTS/RTS and other control lines, which this driver did not support, just plain data.

Looking again recently, I found that someone had made it work! The program provided there, as source, compiled fine but didn't run: still no control lines. I managed to google up the driver patch. With just a little effort, I applied that patch to my existing kernel (2.6.25), tried again, and the program runs!

Now, I've also had for a while a plain indoor/outdoor thermometer which helps inform, for example, shorts vs. pants, jacket or no, and so forth. Right now, it says that it's 71.6°, while my now-working USB TEMPer says it's 66.65°. Not exactly close. But if I hold the TEMPer between my palms, the temperature pretty quickly rises to just over 81° — probably quite close to the surface temperature of my clasped hands. It's hard to say which is right, or if the truth is in between, but this will probably be close enough to make a thermostat out of!

Comments:

TEMPer Driver for Mac OS X?
2008-12-01 18:29 - Jmp478

I just got my TEMPer USB Thermometer in the mail today, hoping that it would work with Mac. Unfortunately, It can't seem to mount it as a serial port when I plug it in.

$ ls /dev/
This shows my built in modem and USB - serial adapter for an LED sign I have plugged in, but I doesn't show the TEMPer device.

Is there a driver that needs to be downloaded for this to work and where can I find it?

Mac?
2008-12-01 20:06 - arantius

I can't help you much with the Mac. All I know for certain is that the Linux driver that works is for the WinChipHead CH341. You will definitely need some driver, and if it doesn't show in /dev/, then you probably don't already have it.

Mac software...
2008-12-19 15:57 - big.stu

Try this: http://www.janitorium.co.uk/TEMPer.tgz

Binary only for now I'm afraid as it was written for a work related project, but I'll try and get the source released (USB code derived from Apple sample code, CH341 setup information gleaned from linux kernel USB serial ch341.c source, but I2C code written from scratch by me using DS75 datasheet as reference).

It's a universal binary (ppc & intel) user-space command line tool which accesses the USB TEMPer device directly via IOKit (no drivers to install) and prints the current temperature to stdout. That's all it does. It will iterate over multiple TEMPers, printing one temperature value per line on the output (not actually tested as I only have one).

No guarantees, but it works for me :)

Forgot to say...
2008-12-19 15:59 - big.stu

...that it was built on Leopard (10.5.6) and has been tested on both Intel and PPC machines, but no idea if it runs on older versions of OS X...

OSX Driver Mirrored
2009-01-05 14:38 - arantius

First, I've mirrored the TEMPer OS X driver posted above, for the convenience of future users. Second, however: if you "gleaned information from the linux kernel" then you are legally obligated to open source the code, as the linux kernel is GPL, and any derivative work must be released under the GPL.

Temper on NSLU2
2009-02-21 15:23 - NSLU2

I've been trying to apply the patch on NSLU2 2.6.26 kernel (Debian Lenny) against which it was supposedly made. Only couple of hunks succeed in the patch, the rest fail. Should this happen? Some parts of the patch seem to be there already. I'm compiling it on an NSLU2 so I wouldn't want to try-and-fail too many times. Cross-compile chain is apparently not working so I can't compile it anywhere else.

Good Linux software for TEMPer
2009-09-11 14:30 - dskoll

The existing Linux software for TEMPer was just horrible, so I wrote a replacement. Requires a recent kernel (probably 2.6.30 or newer.) URL: http://www.roaringpenguin.com/products/temper-tools

HID TEMPer with NSLU2 ?
2009-12-04 10:47 - NSLU2too

I've just gotten an HID TEMPer running on a surplus Windows XP computer, sending me email every 30 minutes. I plan to use it to monitor the house temperature in the winter when I'm traveling.

I'd like to duplicate this functionality with less power consumption, using an NSLU2 that I happen to have lying around. I'd like to run the NSLU2 without an external disk.

I am definitely not a linux expert. OpenWrt Kamikaze (www.nslu2-linux.org/wiki/OpenWrt/HomePage) looks like it might be the most appropriate OS for running the NSLU2 without an external disk. As far as I can tell, it uses the linux-2.6.26.7 kernel.

Could anybody advise on the possibility of doing this without linux expertise?

thanks very much.

HID Temper solution
2009-12-06 00:13 - relavak

I've written a dirver for linux using libusb. You can find it at http://relavak.wordpress.com/2009/10/17/temper-temperature-sensor-linux-driver/.


(Link edited by site owner.)

Post a comment:

Username
Password
  If you do not have an account to log in to yet, register your own account. You will not enter any personal info and need not supply an email address.
Subject:
Comment:

You may use Markdown syntax in the comment, but no HTML. Hints:

If you are attempting to contact me, ask me a question, etc, please send me a message through the contact form rather than posting a comment here. Thank you. (If you post a comment anyway when it should be a message to me, I'll probably just delete your comment. I don't like clutter.)