Hello,

I'd like to ask you about opinion on accuracy of HTS221 sensors, both factory mounted on X-NUCLEO-IKS01A1 boards (powered by Nucleo board @ 3.3 V).

I get quite surprising results from these sensors, compared to reference designs with SHT21 and SHT31 sensors (which are obviously calibrated similar way, because in stable environment their output is no different than 0,2 centigrades and 1 % rH from each other).

**HTS221 Sensor 1***Calibration values:*

H0 = 30 %, ADC output 0xFFF8

H1 = 72 %, ADC output 0xD001

*Real-life application values (ambient conditions)*:

0xCFF0 output = 72 % rH , while SHT21 and SHT31 showed 59 % (which is about 22 % error)

0x9C80 output = 117 % rH, while SHT21 and SHT31 showed 91 % (which is about 28 % error)

**HTS221 Sensor 2***Calibration values:*

H0 = 32 %, ADC output 0x0005

H1 = 73 %, ADC output 0xD4E7*Real-life application values (ambient conditions):*

0xDC00 output = 66 % rH while SHT21 and SHT31 showed 60 % (which is about 10 % error)

(haven't tried in 90 % rH envoronment yet)

What do you think about the readings from sensors? I would expect better accuracy.

By the way, I would also like to mention TN1218 Interpreting humidity and temperature readings in the HTS221.

There is a code example, how to perform the approximation to get the relative humidity value. However, I think there is some casting needed in order to get it working with negative calibration values (for example the values above).

/*5. Compute the RH [%] value by linear interpolation */

tmp = ((uint32_t)(H_T_out - H0_T0_out)) * ((uint32_t)(H1_rh - H0_rh)*10);

*value = tmp/(H1_T0_out - H0_T0_out) + H0_rh*10;

If H0_T0_OUT and/or H1_T0_out are negative (just as in my case) and treated as uint32, it produces number close to 4 000 000 000, which then divides the tmp value to zero.

Here is my own version:

int16 a = (H_T_OUT - H0_T0_OUT);

uint8 b = (H1_rH - H0_rH);

int16 c = (H1_T0_OUT - H0_T0_OUT);

uint32 humidity = ((a * b * 100) / c) + (H0_rH * 100);

(Please note I use a multiplication factor of 100 to get xx.xx % result, the TN1218 uses only factor 10, but the principle of casting is the important part). Also, I use a different compiler so the types could have different names than in the TN1218 (but the sign and size remains).

Thank you,

David

PS: I haven't got to a temperature measurement yet, but expect the same casting troubles could happen in the provided example, too.

I tested the temperarature outputs of two HTS221 sensors (the same as mentioned above) against SHT21 and SHT31 sensors. Both HTS221 sensor 1 and 2 give typically +/- 0.3 degrees Celsius difference, sometimes they get up to +/- 0.05 degrees Celsius. This is quite satisfying in an ambient environment.

The problem with humidity sensor accuracy is still the same and any help advice be appreciated.

David