Skip to main content
Explorer II
June 9, 2020
Question

HTS221 Incorrect Temperatures / Calibration (T0_OUT = 0)

  • June 9, 2020
  • 4 replies
  • 3314 views

Hi,

I'm having an problem whereby I believe the temperature readings from an HTS221 device are incorrect. They seems to be around 5degC too high compared to reference temp. I'm using a Nest thermostat as the reference, and while this may not be calibrated I would still expect the temperatures to be roughly similar.

I have suspicion that the calibration registers aren't correct, specifically the T0_OUT value which is zero. Is a value of 0 for T0_OUT expected or is there something wrong with the calibration? Seems a bit suspect to me.

Below is a dump of all the calibration registers:

Calibration Registers

Addr: 0x30 Value: 0x3d
Addr: 0x31 Value: 0x8f
Addr: 0x32 Value: 0x99
Addr: 0x33 Value: 0x0e
Addr: 0x34 Value: 0x00
Addr: 0x35 Value: 0xc4
Addr: 0x36 Value: 0xf2
Addr: 0x37 Value: 0xff
Addr: 0x38 Value: 0x3a
Addr: 0x39 Value: 0x03
Addr: 0x3a Value: 0xf5
Addr: 0x3b Value: 0xd0
Addr: 0x3c Value: 0x00
Addr: 0x3d Value: 0x00
Addr: 0x3e Value: 0x1e
Addr: 0x3f Value: 0x03

So for the linear interpolation of temperature I get the following:

x0 = 0
y0 = 19.125 degC
x1 = 798
y1 = 33.75 degC

However using those values yields temperatures which are too high (by approx 5degC). The humidity also appears to be around 10% lower than the Nest thermostat.

Hardware and Software

I'm using the HTS221 driver from the ST Micro MEMS library. The HTS221 is mounted on a MikroE Click board (https://www.mikroe.com/temp-hum-click) attached to an Azure Sphere dev kit.

At the moment I don't have another HTS221 device to compare with.

Device Configuration:

Data Output Rate: 7Hz

Averaging: H: 512, T:256

Heater: Off

Block Data Update: Enabled

Samples are being read from the device at approx. 1Hz.

Any advice would be appreciated.

Thanks,

Simon

    This topic has been closed for replies.

    4 replies

    ST Employee
    June 12, 2020

    Hi @Simon Sq​ , are you experiencing a 5°C shift across a certain (wide) range of temperature? This to understand if it is only an offset or there is also a gain issue... The x0 = 0 value is quite strange (here for some reasonable data). Can you check please if your code is compatible with the driver on github for HTS221 (e.g. hts221_read_data_polling.c)? Did you try to enable the heater and then read again both temperature and humidity, in case it could be a problem on the sensor? Regards

    Simon SqAuthor
    Explorer II
    June 12, 2020

    Hi Eleon,

    It's difficult to say, I don't think it's a straight forward DC offset issue, I suspect it is the gain that is the problem. If I simply subtract 5°C from all the readings and then touch the sensor with my finger, it only reaches about 28°C, where as I would expect it to get to around 32°C.

    Another strange behaviour I noticed on a couple of occasions is when I touch the sensor with my finger the temperature reading actually decreases!

    I've just done a test by turning the heater on for 2 minutes. During that time the temperature reported approximately 68°C, while the relative humidity was 0%. I would expect the %RH to be zero with the heater on, but can't comment on the temperature reading.

    A few minutes after turning the heater off the temperature stabilised at around 28.9°C and 44.2% RH, which is 4.9°C above my control thermostat (24.0°C). The %RH is within 5% of my control measurement so not too concerned about that.

    I experimented with changing the value for T0_OUT from it's value of 0, and a value of around 390 seems to result in more sensible temperatures being reported. With the value of T0_OUT changed to 390, the temperature reported when the heater is on is around 100°C

    The code I am using to sample to sensors is basically copied from the sample you mentioned (hts221_read_data_polling) so I'm fairly sure it's compatible. The only difference is that I call the function to sample to sensors every 1000ms, rather than using a while() loop. I am still checking the RDY flags to determine if a sample is ready to be read.

    Below is the code I have to read the temperature and humity (the linear interpolation function is taken directly from the github sample):

    if(hts221_detected)
    {
     // Read output only if new value is available
     hts221_reg_t reg;
     hts221_status_get(&hts221_ctx, &reg.status_reg);
     
     if(reg.status_reg.h_da)
     {
     // Read humidity data
     memset(data_raw_humidity.u8bit, 0x00, sizeof(int16_t));
     hts221_humidity_raw_get(&hts221_ctx, data_raw_humidity.u8bit);
     
     // interpolate the raw value
     sensor_data.hts221_humidity_rh = linear_interpolation(&lin_hum, data_raw_humidity.i16bit);
     
     if (sensor_data.hts221_humidity_rh < 0) sensor_data.hts221_humidity_rh = 0;
     if (sensor_data.hts221_humidity_rh > 100) sensor_data.hts221_humidity_rh = 100;
     }
     
     if(reg.status_reg.t_da)
     {
     // Read temperature data
     memset(data_raw_temperature_hts221.u8bit, 0x00, sizeof(int16_t));
     hts221_temperature_raw_get(&hts221_ctx, data_raw_temperature_hts221.u8bit);
     
     // interpolate the raw value
     sensor_data.hts221_temperature_degc = linear_interpolation(&lin_temp, data_raw_temperature_hts221.i16bit);
     }
    }

    I'm starting to suspect a faulty device? Or at least incorrect calibration?

    Visitor II
    February 10, 2021

    Any update on this issue?

    I am having the same problem across 5 devices.

    ST Employee
    February 11, 2021

    Hi @FMunt.1​ ,

    are all the 5 parts behaving in the same way or they are drifting randomly?

    If also after the heater procedure described above you are facing the same issue, especially in the former case you could characterize offset and gain and compensate linearly the sensor output data in post processing.

    -Eleon

    Visitor II
    November 24, 2021

    hi,

    Is there any solution for this issue.

    I am using a MKR IoT Carrier with HTS221 sensor. The device is sending a approximately a 5 degree higher readings everytime. I believe this thread is discussing same issue.

    Kindly share a fix.

    BR,

    Ajna

    ST Employee
    November 26, 2021

    Hi Ajna @AShuk.4​ , all,

    please note that you are using a "third-part" board, and ST cannot guarantee that the performances declared on the datasheet are then met after an unknown soldering process.

    Even for STEVAL-MKI141V2 adapter you might be careful.

    For this reason, I suggest you to characterize the offset and maybe the gain shift of the parts from the datasheet and "calibrate" them at software leverl, if you need a very accurate application setup.

    I also suggest you to collect all your experiences and try asking the question on MKROE forum at this link.

    -Eleon