This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

HDC2010 Low temperature threshold reading wrong value.

Part Number: HDC2010

Tool/software: Linux

Hi Team,

I am getting wrong low threshold value while reading the temperature. I am following the below procedure for fetching value.

1. Reading register value from 0x0A register.

2. I am using the below formulas for converting humidity percentage. In both the formula i am getting wrong value.

temp_ths_low = register value (7:0)

//calc_humidity=(((temp_ths_low*165)/256)-40); 

//calc_humidity=(((temp_ths_low/256)*165)-40);

But after that also iam getting 65496 value.

So, please answer me ASAP?

  • Dear Himansu -

    the formula for calculating the temperature threshold low value in degrees C is found on page 24 of the HDC2010 datasheet: www.ti.com/.../snas693b.pdf

    it is the bit value of the register (converted to decimal) divided by 256, all multiplied by 165-40.
    this gives you a working scale from -40C to +125C (functional range of the part)

    for example, when threshold bit value is 0000 0000, the resulting threshold will be -40C, when the threshold bit value is 1000 0000 (decimal 128), the resulting threshold is 42.5C and when the threshold bit value is 1111 1111 (decimal 255), the resulting threshold is 124.3554688C

    Please adjust your formula.

  • Hi Josh,

    I have verified with the formula as given in data sheet. Formula is same for reading temperature value from 0x0A and 0x0B. With the formula given i can read the accurate value from the 0x0B register but not from 0x0A register.

    So i am trying to find out the issue and is there any possible way to debug this issue?
  • Himansu -
    Let's back up for a moment - the threshold values are not used in the calculation or reading of the temp or humidity. These registers are for setting a level and then triggering an action from the device, based on the level(s) set by the threshold.

    the registers to be read for use in the calculations are 0x00 through 0x03 (see pages 17 & 18 of the datasheet) and page 6 here: www.ti.com/.../snaa312.pdf
  • Hi Josh,

    Thanks for the response. Let me explain in some otherway. For Example:
    1. My current temperature is 21 C.
    2. And I set my Low_temp_threshold(0x0A) to -10 and High_temp_threshold(0x0B) to 40 C.
    3. And my device run for 1 days. Then After one day someone has forgotton the threshold values and Again Try to read the value of the 0x0A &0x0B register.
    4. In this case i want to read the value of the register. With the formula given i can read the accurate value from the 0x0B register but not from 0x0A register.

    So i am trying to find out the issue and is there any possible way to debug this issue?
  • Dear Himansu -

    one suggestion for debug would be to connect a logic analyzer to the I2C pins and verify the values coming over the wire so you can then know if you are or are not getting values correctly, which will then point you to either the hardware or the software

    for example:

    reading register 0x0A, which has been set for 0x10

    reading register 0x0B, which has been set for 0x6C

  • Hi Josh,

    Thanks for a useful debugging idea. After a lot of R&D, i came to know that we are unable to show the negative value. So for display negative value what will be procedure/formula for the same.

    Example:

    When the temperature is  -10.

    /sys/kernel/hdc2010 # cat temperature humidity
    65517
    30

    Register dump: 

    /data # ./i2cdump -f -y 0x04 0x41
    No size specified (using byte-data access)
    0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    00: 51 21 31 4f 00 7f bb 78 e0 e0 2f 8c 03 fe 54 00 Q!1O.??x??/???T.
    10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
    f0: XX XX XX XX 00 00 00 00 00 00 00 00 49 54 d0 07 XXXX........IT??
    /data #

  • Dear Himansu -

    The formula for calculating temperature with the HDC2010 is (from page 18 of the datasheet):

    Temp (in degrees Celsius) = (Temperature Registers (0x01 and 0x00) / 65536) x 165 - 40

    This means you need to take the register values, which come in as hexadecimal values, concatenate them, then convert to decimal and do the math operations. 

    for temp value  = -10C, for example - the hex values for registers 0x00 and 0x01 will be 8B and 2E, respectively. If you were looking at this from MSB/LSB perspective, the value will be 0x2E8B, which when converted to decimal will be 11915. 

    Plugging that back into the formula, this would be: 

    Temp (in degrees Celsius) = (11915 / 65536) x 165 - 40

    Temp (in degrees Celsius) = (0.1818085) x 165 - 40

    Temp (in degrees Celsius) = 29.9984 - 40

    Temp (in degrees Celsius) = -10.00160 degrees Celsius

    Its not 100% clear to me in which order you are reading out the registers, but if your highlighted 0x2F is the MSB byte for the temperature register - looking on either side of that is either an 0xE0 or a 0x8C

    0x2FE0 would equal 12256 in decimal, which would result in a calculated temp value of -9.143537239C

    0x2F8C would equal 12172 in decimal, which would result in a calculated temp value of -9.354553223C

    Hope that clears it up for you, so you can adjust your firmware accordingly. 

  • Hi Josh,

    Thanks for the support. Issue Resolved.