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.

HDC3022: HDC3022DEJR测试温湿度偏差较大

Part Number: HDC3022
Other Parts Discussed in Thread: HDC3020

我们使用HDC3022DEJR测试温湿度偏差较大:

temp=31.75 humidity=23;    目前厦门翔安室内室温差不多26℃, 湿度39%;

芯片目前试飞线测试;

请帮忙分析下问题?

应该sensor出厂都校准过,不需要补偿吧?

如下试我们一些代码

   // set offset
    op = HDC3020_OFFSET_MSB<<8|HDC3020_OFFSET_LSB;
    buf[0] = 0x00;
    buf[1] = 0x00;
    buf[2] = hdc3020_crc(buf, 2);
    i2c_write_poll(op, buf, 3);

[2:30 PM] Eking-YiQing Chen

int hdc3020_read(int32_t values[])
{
    uint16_t op = HDC3020_MODE_TRIG_MSB<<8|HDC3020_MODE_TRIG_LPM0;
    uint8_t buf[6] = {0};
    i2c_write_poll(op, buf, 0);

    rt_thread_mdelay(20);

    i2c_read_poll(op, buf, 6);

    // check temp crc
    uint8_t tcrc[] = {buf[0], buf[1], buf[2]};
    if (hdc3020_crc(tcrc, 3))
    {
        // crc error
        return -1;
    }

    // check humidity crc
    uint8_t hcrc[] = {buf[3], buf[4], buf[5]};
    if (hdc3020_crc(hcrc, 3))
    {
        // crc error
        return -1;
    }

    /* store temperature */
    values[0] = ((int32_t)buf[0]) << 8 | buf[1];
    /* store humidity */
    values[1] = ((int32_t)buf[3]) << 8 | buf[4];

    return 0;
}

int32_t hdc3020_toCelsius(int32_t x)
{
    float f = ((float) x) / 65535 * 175 - 45;
    return (int32_t)(f * 100);
}
int32_t hdc3020_toRH(int32_t x)
{
    float f = ((float) x) / 65535 * 100;
    return (int32_t)f;
}