cancel
Showing results for 
Search instead for 
Did you mean: 

HTS221 - TR - Correct Temp Data not found

iabhilash909
Associate II
Posted on July 30, 2016 at 02:09

Hello, 

I am trying to access the HTS221 (TR) Temperature Humidity sensor.

Firstly, the driver code of this sensor provided by ST Microelectronics states that the I2C address is 0xBE but I had been trying that address for a while and it did not work. Whereas on pinging the I2C port with different addresses, I understood that the sensor I2C address is 0x5F. So, I am using 0x5F address to access all the registers of the sensor. 

Secondly, Following are the temperature data that I can getting from the calibration registers: 

T0_OUT = -258

T0_degC = 21C

T1_OUT = 2570

T1_degC = 35.63

T_OUT = 30840    // this value looks too high 

On conversion, the room temperature comes to be 181C. which is definitely wrong. You mentioned about trimming the values in one of the discussion, please let me know about it.

Thirdly, the driver for HTS221 keeps multiplying T0_degC & T1_degC by 10, I dont understand the reason for that. Can you elaborate on that? The datasheet mentions that T0_degC is 8*(10 bit T0_degC), nowhere 10 was mentioned. Please let me know about it. 

Thanks & Regards,

#hts221-hts221tr
5 REPLIES 5
licciardello.anto
Associate II
Posted on August 01, 2016 at 11:18

Hi,

1. 

The 8-bit slave address (SAD) associated to the HTS221 humidity sensor is BEh (write) and BFh (read).

It is composed from SAD[6:0]  +  Read/Write patterns (see pag 13 of technical datasheet). The SAD[6:0] is 0x5F.

Maybe you are using a implementation of I2C bus that is implementing the shift of SAD at 7 bit  and adds the R/W bit. 

3.

The driver for HTS221 manages 16 bit integer variable for temperature.

To get a float value, the obtained value is multipled for 10 inside the driver.

The returned temperature value from driver,after  that it must be divided by 10 to get the value in ['C] .

For example you get value 281, it means 28,1 °C.

2. 

So the room temperature of 181, means 18.1 °C. 

Regards

Antonella

iabhilash909
Associate II
Posted on August 03, 2016 at 19:33

Thank you for your reply. 

1. I wanted to know if you could take a look at the values of T0_OUT, T1_OUT and T_OUT. I really doubt the value of T_OUT is too high to get a right temperature. It should generally fall between the T0 and T1 values right? 

2.  The above values are from wire library I2C implementation but if I use your driver to read temperature, my arduino is giving me an error of collectible2.exe. This is the error when usually the included file is not in right path or not included at all. On looking inside the HTS221_Driver.h,  I see that it asks the user to include HAL_EnvSensors.h. Can you share those files to get the implementation of HAL_ReadReg and HAL_WriteReg? 

Please let me know about it. 

Thanks & Regards,

iabhilash909
Associate II
Posted on August 04, 2016 at 19:50

Can anybody share the firmware of HTS221 humidity and temperature sensor? The firmware files that I currently have, does not have HAL_ReadReg and HAL_WriteReg Implementation files and I require those two implementations to grab the temperature values. 

Thanks,

licciardello.anto
Associate II
Posted on August 05, 2016 at 11:22

Hi,

the code line  #include ''HAL_EnvSensors.h'' in HTS221_driver.h is only an example prototype.

The user must include the proper own file where HAL_ReadReg and HAL_WriteReg are implemented

This implementation depends on the used hardware, depends on the microcontroller and if it is used I2C bus or SPI bus.

After that the  kind of bus has been chosen, it needs to configure the GPIO of micro used as SDA, SCK, CS and so on.

Regards

Antonella

jean_gt3
Associate
Posted on September 05, 2016 at 15:09

Hi, 

Is it possible to have an example of a file (HAL_EnvSensors.h) where HAL_ReadReg and HAL_WriteReg are implemented with an I2C communication ?

Thanks a lot,

Regards !

JL