Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
TEMPerHum Utilities
C C++ Python Shell
Branch: master

README

= Device =
	
Cheap unbranded hydro-thermometer. The manufacturer only provides some
basic Windows-only software and incomplete drivers on a CD.

Manufacturer: http://rding.cn/ (eBay store at http://pcsensor.cn/)
Distributor: http://usb.brando.com.hk/ (has some software updates)
	
	
= Software =
	
Aside from the manufacturer's software, which I am unable even to run,
there's a SourceForge project UTAC which wraps the basic interface with
a large amount of other stuff. I'm not willing to even try running this
(it's Windows-only).
	
== UTAC ==
	
The UTAC code appears to be reverse engineered from the original software.
Unfortunately it's in some .NET language and the quality of the code
makes me want to throw up. I'm not quite sure what the Delay() function
is supposed to be doing because any good compiler would optimise it out.

Example: http://utac.svn.sourceforge.net/viewvc/utac/trunk/utac/Components/Temper/TEMPerInterface.cs?revision=54&view=markup

It supports the "TEMPer" temperature only device too, but my code only
supports "TEMPerHum" (as far as I know) because that's all I have for
testing.

UTAC: http://sourceforge.net/projects/utac/
	
== Others ==
	
Tollef Fog Heen has code which can only access the "TEMPer" devices:

Source: http://err.no/src/TEMPer.c
	
== Mine ==
	
Eventually I found the specifications for the device and wrote an
interface that I consider sane (i.e. no bizarre string/binary conversion
and actual bitwise operations).
	
	
= Logging =
	
I've used librrd for storing the data. At the speed required to reliably
access the device, the main loop runs once per second by itself without
the need for special timing. The RRD data file will take up 187MB unless
you modify the parameters (it's also created on the first run resulting
in a long delay).

RRD: http://oss.oetiker.ch/rrdtool/
	
	
= Usage =
	
Find your device(s). The following lists the physical USB port the device
is connected to. This is used to refer to it for access and as the RRD
filename.

 $ ls -1 /sys/bus/usb/devices/*/ttyUSB* -d|cut -d / -f 6|cut -d : -f 1
 1-1.1.3
 5-1
 6-1.4
 6-2

Run the main process (in src/):

 $ ./temperhum 1-1.1.3
 ; Status {Battery: OK, Heater: OFF, Reload: YES, Resolution: HIGH }
 1236342817.173860429; T  26.42℃ / RH  38.36% / DP  11.09℃
 1236342818.371585371; T  25.30℃ / RH  42.28% / DP  11.56℃
 1236342819.428093143; T  25.49℃ / RH  42.11% / DP  11.67℃
 1236342820.485240453; T  25.56℃ / RH  41.92% / DP  11.67℃

It's also possible to specify more than one device. If you try to access
multiple devices concurrently, you'll soon run into problems with invalid
data due to the timing involved.
	
	
= Networking =
	
There's a Linux service to provide realtime information from one or more
sensors (in server/) which uses a simple protocol. The last 5 seconds of
data is averaged and sent to all connected clients.

To display the information from one (default) sensor, in client/win32/
is a Windows executable to output the current temperature and relative
humidity as a tray icon. This can be compiled for Win2K+ or WinXP+ (as
either 32-bit or 64-bit).

Both applications support IPv6 connections.
	
	
= Hardware =
	
Sensor specification: http://www.sensirion.com/ (SHT1x Datasheet)
Serial interface specification: http://wch-ic.com/product/usb/ch341.asp (CH341 English DataSheet)
EEPROM specification: http://www.microchip.com/ (DS21709J)
	
	
= Linux Driver =
	
You'll need Linux 2.6.29-git1 or newer to be able to use these devices
(commit 664d5df92e88b6ef091048a802b3750f4e989180 adds support for
DTR/RTS/CTS to the CH341 driver).
Something went wrong with that request. Please try again.