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.

HDC3020-Q1: Sample code for resistors configuration

Part Number: HDC3020-Q1
Other Parts Discussed in Thread: ENERGIA

Hi Team,

Our customer is looking for a sample code to configure the 14 resistors inside the HDC3020-Q1 as mentioned in Section 8.5.7.8 of the datasheet. There are sample codes in the E2E thread below but I can't confirm if there are sample code for heater configuration. Can you please confirm?

https://e2e.ti.com/support/sensors-group/sensors/f/sensors-forum/1190688/faq-hdc3020-is-there-an-energia-or-arduino-example-available

Regards,

Danilo

  • Danilo - 

    In the HDC3 datasheet, there is a figure for this: 

    (click on image to enlarge)

    Here are three setting examples (using Energia/Arduino style) using either of those three settings

    // configure heater for 1/4 power
    Wire.beginTransmission(0x45); // transmit to HDC3x device address 0x45
    Wire.write(0x30); // 0x30 // configure heater
    Wire.write(0x6E); // 0x6E // configure heater
    Wire.write(0x00); // 0x00 // setting MSB
    Wire.write(0x9F); // 0x9F // setting LSB
    Wire.write(0x96); // 0x96 // CRC
    Wire.endTransmission(); // stop transmitting

    or 

    // configure heater for 1/2 power
     Wire.beginTransmission(0x45); // transmit to HDC3x device address 0x45
     Wire.write(0x30); // 0x30 // configure heater
     Wire.write(0x6E); // 0x6E // configure heater
     Wire.write(0x03); // 0x03 // setting MSB
     Wire.write(0xFF); // 0xFF // setting LSB
     Wire.write(0x00); // 0x00 // CRC
     Wire.endTransmission(); // stop transmitting

    or 

    // configure heater for full power
    Wire.beginTransmission(0x45); // transmit to HDC3x device address 0x45
    Wire.write(0x30); // 0x30 // configure heater
    Wire.write(0x6E); // 0x6E // configure heater
    Wire.write(0x3F); // 0x0F // setting MSB
    Wire.write(0xFF); // 0xFF // setting LSB
    Wire.write(0x06; // 0x06 // CRC
    Wire.endTransmission(); // stop transmitting

  • Hi Josh,

    Thank you very much for the confirmation and for sharing the sample codes.

    Regards,

    Danilo

  • Hi Josh,

    Our customer has a follow up inquiry below.

    I know 25%, 50%, 100% heater control.
    My question is how to control few %.
    HDC3x devices have 14 heater as shown in user manual.

    When we want to ON 1 or 2 heater only, how can we do?
    We want to confirm CODE for this control.

    Regards,

    Danilo

  • Danilo - 

    If you just want to configure the heater to enable on/off check of the sensor operation and draw the least amount of current, you can configure using 0x0001, CRC 0xB0 or 0x0002 CRC 0xE3. See binary selection to hex byte + associated CRC table below. 

  • Hi Josh,

    If my understanding is correct, the customer just have to change the value of MSB and LSB in the code to turn ON the specific resistor. For example, to turn ON the bit element 0 (resistor on the right most) the code would be,

     Wire.write(0x00); // 0x00 // setting MSB
     Wire.write(0x01); // 0x01 // setting LSB

    Is this correct?

    Regards,

    Danilo

  • Danilo - 

    Yes, correct and of course send the CRC 

    // configure heater for least power setting
    Wire.beginTransmission(0x45); // transmit to HDC3x device address 0x45
    Wire.write(0x30); // 0x30 // configure heater
    Wire.write(0x6E); // 0x6E // configure heater
    Wire.write(0x00); // 0x00 // setting MSB
    Wire.write(0x01); // 0x01 // setting LSB
    Wire.write(0xB0); // 0xB0 // CRC
    Wire.endTransmission(); // stop transmitting

    CRC calculator is in the HDC3xEVM GUI, in case they want to calculate any other combination and hard code it as shown above