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:
-
Power on the Pmod HYGRO and wait at least 15 ms.
-
Call the device ID with a write bit
I2CBegin(0x80); //device ID 0x40 with a write (0) bit
-
Wait to receive an ACK from the Slave Device
-
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
-
Wait to receive an ACK from the Slave Device
-
Delay at least 12.85 ms (6.35 ms for the Temperature Sensor and 6.50 ms for the Humidity Sensor)
-
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:
- 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. - 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!