Sensirion humidity & temperature sensors

From HeepyWiki
Revision as of 08:56, 17 January 2012 by Morris (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Library and demo program for SHT15 temperature and humidity sensor from Sensirion. Get one on a breakout board from sparkfun.com. It's not cheap, but it seems to produce repeatable and stable output.

This driver doesn't depend on any hardware support except GPIOs, so it should run on any AVR. You might need to provide different uart routines to get serial output from the demo program on say an atmega8. Even with the float stuff it still fits in 8k.

The manufacturer's data sheet is duplicated at http://www.sparkfun.com/datasheets/Sensors/SHT1x_datasheet.pdf

It speaks a two wire protocol that's almost like i2c but just slightly gratuitously different, so you have to bitbang it. Its data line is open drain, so in theory it might be able to coexist with an actual i2c bus on the same wires, but when i tried it it seemed to hang the bus in its default power-on state.

It has two resolution modes, 12 bit humidity + 14 bit temperature, and 8 bit humidity + 12 bit temperature, of which I've only implemented the higher resolution one. To use the other, you write 0x01 to the status register and then use a different polynomial (detailed in the datasheet) to convert the readout to real floating point values. If you want more accuracy, read temperature first, and then pass the temperature reading to sht_humidity_comp() which adds temperature compensation to the basic humidity reading.

It also has a low-voltage warning bit and a builtin electric heater which you can apparently use to test it - turning it on draws a few mA and causes the temp reading to go up and the humidity reading to go down, as expected. Don't leave it on permanently.

eric volpe http://heepy.net 4/21/2010