I2CChip.com: Sensirion SHT1x and SHT7x Humidity Sensors

Contents

Sensirion make a family of combination humidity and temperature sensors with a 2 wire bus. They have high accuracy and resolution.

The I2C to PC can read up to 3 of them directly.

They do NOT use I2C bus, but they are a very useful and unique sensor, and can be read by the BL233 and I2C2PC.

The commands below are on the I2CMisc tab of Realterm versions > 2.0.0.18. Get the latest version of  Realterm

Sensors

Get the datasheet: http://www.sensirion.com/en/pdf/Datasheet_SHT1x_SHT7x.pdf

By default the sensors return:

The Sensibus Bus

For inexplicable reasons, Sensirion have made a bus that is uses very similar elements to the I2C bus, but is utterly incompatible.

Connecting to I2C Bus

I2C Bus Pin#

SFH 1x Pin#

Function

SHT1x

Make sure to put a 100nF capacitor across VDD and GND!

1

2

SDA

2

4

VDD

(2.4-5.5V)

3

1

GND

4

3

SCL


 

Reading from BL233

To read we use the SPI commands and bit-bashing modes of the BL233. The example below assumes that the device is connected to bus#1. For other buses the bit-bashing commands ('O....') must be changed.

The BL233 should be in the stoP condition before beginning.

Realterm versions > 2.0.0.18 contain support for SHT sensor on the I2CMISC tab

A Simple Datalogger

To make a simple logger for temperature and humidity, just put the commands you need from below into a text file call shtdata.txt, and use Realterm to automatically send the file, and capture the result.

The commandline below will make Realterm send the commands every 30 secs for ever, and capture the results into shtdata.txt

Realterm flow=2 capture=shtdata.txt sendfile=shtcmds.txt senddly=30000 sendreps=0

Initialise the Bus interface

# To reset or initialise the bus interface of the SFH sensor you send 9 clocks with SDA high

Y1WFFFFP

First select the bus with G command e.g. to select bus 2

G2

Transmission Start

The start requires pulsing the SDA and SCL lines. We use the 'O' command to bit bash the bus pins for the selected port (port#1 in these examples)

O00FD 00FC 00FD 00FF 00FE 00FC

For Bus#2 the commands are:

O 00F7 00F3 00F7 00FF 00FB 00F3

For Bus#3

O 007F 003F 007F 00FF 00BF 003F

Send Command Byte

The first byte is the command byte. The last bit of the command byte is 1 for all read commands, and 0 or all write commands, like I2C. We use SPI mode, writing one byte, and then reading the single ACK bit from the SHT.

YW03Y1R01

Command 03 is “Read Temperature” and 05 is “Read Humdity”. The BL233 will reply with FE when it reads the ACK bit.

Pause for Conversion

The 12 bit humidity conversion takes 63ms max (0x40), and the 14bit Temperature conversion takes 241ms max (0xF2). We allow a bit extra to be safe

L0100

for temperature and for humidity

L0050

If the pause is too short, one or both of the following data bytes with be FF. The timing is +/- 15%.

Read 2 data bytes

We read each data using an SPI read.

YR01

After each byte we have to send the ACK bit from the BL233. For the first byte we ACK – ie write a 0

Y1W00

After the last byte we have to send NACK – ie write a 1

Y1WFF

So to read both databytes we send

YR01Y1W00 YR01Y1WFF P

Note that at the end we return the bus to idle with a P

Returned Data

Reading Temperature returns

FE 18 A2

The first byte 'FE' is the ACK bit, which is 0, and should always be 'FE'

The data 0x18A2=6036dec. Temp= -40+ (0.01*6036) = 20.36

Humidity returns

FE 07 E8

The data is 0x07E8 =2024dec. Humidity is -4+ (.0405 *2024) + (-2.8e-6 * 2024^2) = 66.5%

CRC

It is not necessary to read the CRC value back, and the commands above, and Realterm built in commands don't do so. To read it just add another read cycle

YR01Y1W00 YR01Y1W00 YR01Y1WFF P

Writing Status Register

To write XX to the status register we have to send a byte, and read the ACK bit

YW?? Y1R01

So the whole sequence to write 0x04 (turn on heater) to the status register(06) is:

YW06Y1R01 YW04Y1R01

Suppressing the ACK 'FE'

If you want to stop the 'FE' that is returned by reading the ACK bit after byte writes, then you could write a 1 instead. This will allow the ACK to happen, but won't return the 'FE' data. Of course you wan't know if the part ACK'd. So in the writes above:

YW06Y1WFF YW04Y1WFF

Back to Top

Back to Home

Contact Information

sales@i2cchip.com
http://www.i2cchip.com
Phone +64 21 623-402

Back to Top

Comments and Suggestions

Please send us mail telling us what you think about this page and how we might improve it.

Back to Top