humidity_sht
SHTxx, for Sensirion humidity and temperature sensors
|
Author
|
Eur van Andel, eur@fiwihex.nl Copyright © 2008
|
|
Adapted-by
|
|
|
Compiler
|
=2.4h
|
Description
The Sensirion SHT1x/SHT7x is a single chip relative humidity and
temperature multi sensor module comprising a calibrated digital output.
It comes in 5 flavors, with different accuracy and package style:
sensor hum acc temp acc package
SHT10 4.5% 0.5C SMD (LCC)
SHT11 3.0% 0.4C SMD (LCC)
SHT15 2.0% 0.3C SMD (LCC)
SHT71 3.0% 0.4C 4-pin single-in-line
SHT75 1.8% 0.3C 4-pin single-in-line
all consist of the same silicon: the less accurate models are sold cheaper.
My experience is mixed: I've seen some consistent +2C offset in temperature,
but good humidty measurements. The 4-pin package breaks when you touch it.
The SMD package has naked tracks underneath: you can't route under it!
If exposed to >95% RH for 10 minutes, these sensors will go beserk and need
<60% RH for an hour to recover. You might try heating them.
protocol is close to I2C, but not the same. Remember to pull up DATA.
0b0000_0011 starts temperature measurement
0b0000_0101 starts humidity measurement
device returns three bytes: MSB, LSB and CRC
this library doesn't perform any CRC check
because of self-heating, don't turn on more than 10% of the time
8/12/14 bit reading takes 20/80/320 ms
Sources
http://www.sensirion.com/en/01_humidity_sensors/00_humidity_sensors.htm
Dependencies
-
read_raw_hum_sht(byte out MSB, byte out LSB, byte out CRC)
read raw 12-bit humidity from SHT
default value of resolution bit is 12 bit RH
SHT takes 55 ms for measurement @ 12 bits
we will wait 70 ms
SHT may only be switched on for 10% of the time because of self-heating
so this measurement can only happen every 500ms
-
read_hum_word_sht(word out hum)
read humidity from SHT, result in word precision 0.01%RH
SHT may only be switched on for 10% of the time because of self-heating
so this measurement can only happen every 500ms
-
sht_get_data(byte out x)
receive one byte from the SHT
-
sht_start()
send start
_____ ________
DATA: |_______|
___ ___
SCK : ___| |___| |______
-
sht_put_ack()
send ACK
-
sht_conn_reset()
reset SHT interface, must be followed with sht_start and command
-
sht_wait_ack()
pretend to wait for ACK
-
sht_reset()
reset SHT
-
read_centicelsius_temp_sht(sword out centicelsius)
read Celcius temperature from SHT
with 0.01 C resolution, result is sword type, so -327.68 .. +327.68 C
SHT takes 320 ms for measurement @ 14 bits
we will wait 400 ms
SHT may only be switched on for 10% of the time because of self-heating
so this measurement can only happen every four seconds!
-
sht_put_data(byte in x)
send one byte to the SHT
-
read_celsius_temp_sht(sbyte out celsius)
read Celcius temperature from SHT
with 1 C resolution, result is sbyte type, so -126...+127C
SHT takes 320 ms for measurement @ 14 bits
we will wait 400 ms
SHT may only be switched on for 10% of the time because of self-heating
so this measurement can only happen every four seconds!
-
read_hum_sht(byte out hum)
read humidity from SHT, result in byte precision 1%RH
SHT may only be switched on for 10% of the time because of self-heating
so this measurement can only happen every 500ms
-
read_raw_temp_sht(byte out MSB, byte out LSB, byte out CRC)
read raw 14-bit temperature from SHT
default value of resolution bit is 14 bit temperature
SHT takes 320 ms for measurement @ 14 bits
we will wait 400 ms
SHT may only be switched on for 10% of the time because of self-heating
so this measurement can only happen every two seconds!
Here are the list of samples which use this library: