Temperature sensors are a commonplace now, but I was interested to see that Texas Instruments now make nice I²C humidity sensors too.
I’m particularly interested in the HDC10001 which boasts:
- 14-bit precision;
- 0.2°C temperature accuracy;
- ±3% relative humidity accuracy.
The HDC1000EVM evaluation board
As is often the way these days, Texas make a nice evaluation board the HDC1000EVM2 which is essentially the HDC1000 sensor chip plus a M430F55283 microcontroller which connects the I²C interface on the sensor to USB.
A bit of probing reveals that, by default the onboard sensor has I²C address 0x40.
Watching the I²C bus also reveals that when power is applied to the board, it sends a software reset, then enables 14-bit conversions of temperature and relative humidity. The precise commands are:
- 0x80, 0x00;
- 0x10, 0x00.
Terminal interface
On Windows you can download client software which talks to the evaluation board. However, I use a Mac. Happily the board appears as a serial device in /dev e.g. /dev/tty.usbmodem146151.
Opening the device with screen and prodding keys reveals that most of the numbers do something:
- 1: return the undecoded temperature in hex;
- 2: return the undecoded relative-humidity in hex;
- 3: start streaming temperature and RH readings;
- 4: stop streaming;
- 5: decrement the time between measurements when streaming;
- 6: increment the time between measurements when streaming;
- 7: cycles 0,1,2,3—it’s not clear what this changes;
- 8: cycle the I²C address used: 0x40, 0x41, 0x42, 0x43.
A reasonable strategy for logging over time is to periodically send ‘1’ and ‘2’, logging the results. If precise timing doesn’t matter though, we can just stream the data.
Hit ‘3’ and you get something like this:
stream start
62e0,802c
62e0,802c
62e0,7fec
62e8,7fec
62e8,7fec
62e0,7fec
62ec,7fac
62e8,7fac
62ec,7fac
62ec,7fac
...
62ec,7fec
62e8,7fec
62ec,7fac
62ec,7fac
stream stop
By default the measurements are taken a second apart.
Decoding the measurements
The HDC1000 datasheet explains how to decode the numbers. Given reading \(x\).
\[ T / °C = \frac{x}{2^{16}} × 165.0 - 40.0. \]Above we see a raw temperature reading of 0x62e0, this corresponds to roughly 23.73°C.
\[ RH = \frac{x}{2^{16}} \]Above we see a raw reading of 0x802c, this corresponds to a relative humidity of 50.07%.
Sample results
I left the device streaming data from my window sill for about a week. Here’s what I found:
You can see the clear diurnal variation.
Finally it is interesting to plot RH against temperature: there is a clear global negative correlation, but such a description hides much local structure.
References
- 1. http://www.ti.com/product/hdc1000
- 2. http://www.ti.com/tool/hdc1000evm
- 3. http://www.ti.com/product/msp430f5528