cancel
Showing results for 
Search instead for 
Did you mean: 

HTS221 Humidity problem

Jakub Witowski
Associate II
Posted on May 12, 2017 at 12:04

Hello. I have a problem with humidity measurement. Despite the proper value of temperature, te humidity is always over 100%. I'm using the official ST software. I'm wondering if it is a hardware problem ?

The initialization is as following:

...

HTS221_Init_st cfg_struct;

cfg_struct.avg_h = HTS221_AVGH_4;

cfg_struct.avg_t = HTS221_AVGT_2;

cfg_struct.odr = HTS221_ODR_1HZ;

cfg_struct.bdu_status = HTS221_ENABLE;

cfg_struct.heater_status = HTS221_DISABLE;

cfg_struct.irq_level = HTS221_LOW_LVL;

cfg_struct.irq_output_type = HTS221_PUSHPULL;

cfg_struct.irq_enable = HTS221_DISABLE;

HTS221_Get_DeviceID(&deviceID);

HTS221_Set_InitConfig(&cfg_struct);

/* it is activation function in fact !!! */

HTS221_DeActivate();

while (true)

{

         HTS221_Get_Measurement(&humidity, &temperature);

         ... some delay and read data

}

#humid #hts221 #humidity #sensor
9 REPLIES 9
Legacy member
Not applicable
Posted on May 17, 2017 at 11:05

Hello,

it is easier to help if you paste the device's register contents.

We can quickly rule out a faulty device.

David

Posted on May 17, 2017 at 11:18

If the following register contents will be sufficient ?

AV_CONF (10h)

CTRL_REG1 (20h)

CTRL_REG2 (21h)

CTRL_REG3 (22h)

Legacy member
Not applicable
Posted on May 17, 2017 at 11:21

To be able to count the output, output values + calibration values are needed.

Please paste the content of all the registers below:

0690X000006071yQAA.png
Posted on May 17, 2017 at 19:46

0690X00000603WUQAY.jpg
Jakub Witowski
Associate II
Posted on May 17, 2017 at 22:12

I2C analyzer's log when writting 0x20 register:

0690X00000603qJQAQ.jpg
Legacy member
Not applicable
Posted on May 17, 2017 at 21:01

According to the formula provided in

http://www.st.com/resource/en/technical_note/dm00208001.pdf

 is and your H_OUT value is the humidity 143,3 % rH.

I believe H_OUT = 0x8000 is some default value to be overwritten by a first measurement (I have seen the same with other sensors).

Make sure your sensor is switched to active mode from power-down mode. The only thing to turn it on is to write a correct value to CTRL_REG1 (20h).

Can you trace your code to the point where the constants in the struct are combined (ORed) together and what value is written to that register?

Or even better, can you see what is written to that register by connecting a bus analyzer?

Legacy member
Not applicable
Posted on May 18, 2017 at 09:58

The configuration also seems to be OK, active mode, BDU and 1 Hz output data rate.

Does the the H_OUT remain the same even after a few seconds and samples measured? Do you see the same behaviour with temperature measurement?

Posted on May 18, 2017 at 10:10

I will check it as soon as possible, but there is no problem with temperature measurement.

Legacy member
Not applicable
Posted on May 18, 2017 at 12:55

Interesting... Do you have any other sensor to test?

If the value doesn't change at all, I would be suspicious about ESD / soldering damage. The fact is, that the material for measuring humidity is exposed and can be damaged easier than the rest.

Honestly, I am running out of ideas.