How To Calculate Temperature and Humidity Data

To calculate relative humidity, you only need one simple equation:

However, there is more here than immediately meets the eye. The saturation vapor density relies on both temperature and pressure data, and can be a very complicated thing to measure in reality. Luckily, some modern sensors, like capacitive humidity sensors, can measure relative humidity directly. This is the case with the TI HDC1080 on the Pmod HYGRO!

In addition to a capacitive humidity sensor, the TIHDC1080 has an integrated temperature sensor as well. Rather than the temperature sensor existing solely to improve humidity measurements, the user can also acquire independent ambient temperature measurements. Using the Pmod HYGRO, this can all be done over a simple I2C interface. Here’s how to quickly start acquiring data from the HYGRO:

  1. Power on the Pmod HYGRO and wait at least 15 ms.
  2. Call the device ID with a write bit

    I2CBegin(0x80); //device ID 0x40 with a write (0) bit
  3. Wait to receive an ACK from the Slave Device
  4. Write the device address that you want to talk to

    I2CWrite(0x00); //address 0x00 corresponds to the Temperature Register, the Humidity register will be
                                auto-incremented to next
  5. Wait to receive an ACK from the Slave Device
  6. Delay at least 12.85 ms (6.35 ms for the Temperature Sensor and 6.50 ms for the Humidity Sensor)
  7. Read 4 bytes from the temperature and humidity registers (two 8 byte samples from each, MSB then LSB)

    I2CReadMultiple(4); //read four bytes, sending an ACK to the slave after each byte received and a
                                       NACK after the last byte

After that, the user just needs to convert the measurements into usable data as follows:

  1. Note that the two LSBs (D1 and D0) will always be set to a value of 0. Only the upper 14-bits in each register contains the relevant data.
  2. Wait at least one full second before initiating another reading to avoid internal heating of the humidity sensor.

And there you have it! That’s how you acquire both ambient temperature and relative humidity measurements using the Pmod HYGRO. If you have any questions or comments please use the comment section below or go to the Digilent Forum!


Leave a Reply

Your email address will not be published. Required fields are marked *