I’m a little suspect of the humidity readings I get from the DHT22 sensors. I suspect that they’re reporting higher humidity than is actually the case. I did some research and I’m not alone in this concern. It’s not a huge concern by any means, my primary interest is with temperature, but since I’m logging and graphing the data, why not try to make the data as accurate as possible?
That research led me to the BME280 sensor module. It communicates through the i2c bus, using an address on the bus to differentiate between multiple devices on the same bus. The BME280 has two available addresses depending on how a jumper on the module is configured. Since I’m using two sensors that will work out well.
The difference that you’ll need to deal with first is that the BME280 sensors use four connections to the Pi, not three as the DHT22 sensor does. So you’ll need an extra wire between the sensor and the Pi.
Normally you’d use a breakout board to easily handle the multiple connections needed, but because I don’t foresee adding other sensors at this point, I’m just going to solder the wires for data and clock together. I’ll continue to use separate 3.3v and ground connections for each sensor. If that changes, I can easily add a breakout board later.
The python script that interrogates the sensors and saves the data into the rrdtool database will require some changes. These sensors have calibration data available, and we’ll use that to be sure the readings are as accurate as possible. We’ll also need different libraries to use the i2c bus and to communicate with the BME280 sensors. Both of these libraries can easily be installed using pip.