Reliable data for temperature and humidity
Environmental data can be very helpful, but for that they should also be reliable. Room temperature and humidity, for example, affect not only our health and well-being, but also the preservation and structure of the building and furniture. That's why thermo-hygrometers are becoming increasingly popular. But if the instrument shows wrong values, then it can be bad not only for health, but also the structure of the building.
A relative humidity of 40% – 60% and a room temperature of 18°C – 22°C are mostly perceived as pleasant. The optimal values vary depending on the room (Living room, bedroom, bathroom, kitchen, etc.) The room temperature can be easily adjusted via the heating in the apartment. The room temperature is also relatively easy to feel without the need to measure it precisely. Humidity is not so easy to sense and also not so easy to regulate. There are many tips on what methods can affect the humidity in the apartment, but you need a meter to measure it. In the DIY and IOT field, there are numerous sensors for this task. For a small amount of money (less than $10), you can get sensors that promise high accuracy. If these sensors are as accurate as they promise, then they should show identical values for a simultaneous measurement at the same location, right?Sensors used in this test
I own a (non expensive) digital thermo-hygrometer and my analog living room barometer also has a temperature and humidity display. I found two different sensor modules in my M5Stack pool: The first generation of ENV unit with DHT12 and BMP280 sensor and the current version ENV III with SHT30 and QMP6988 sensor.
The BMP280 and the QMP6988 sensor are digital air pressure sensors. The DHT12 and SHT30 sensors are humidity and temperature sensors.
The characteristics of the two air pressure sensors are more or less similar. However, according to the data sheet, the relative accuracy of the pressure measurements should be significantly better with the QMP6988. In terms of temperature, the resolution and accuracy of the SHT30 sensor should be significantly better than the DHT12 sensor, according to the data sheet. The SHT30 sensor is also said to be significantly better in terms of humidity.
In fact, the data sheets predict a difference in accuracy between the sensors. So it will be exciting to see the results of the measurements.The setup
The M5Stack sensor units are controlled via I2C. To arrange the setup nicely, the sensors are not connected to the Grove port A (Usually used for I2C), but to the port C (Usually used for UART):
The I2C-Bus allows to use multiple sensors on one port as long as they have different I2C addresses. With Grove cables multiple sensors can be connected to one port easily by using the Grove T-connectors.
To be able to address the I2C sensors via Grove Port C, I2C must be initialized with the corresponding pins in the setup() function:
// start M5Stack without I2C
M5.begin(true, true, true, false);
// init I2C on Grove-C port
As default setting the sensors have the following I2C addresses:
- DHT12: 0x5C
- BMP280: 0x76
- SHT30: 0x44
- QMP6988: 0x70
A simple I2C-scan function searches for all existing I2C slaves and lists them:
Scanning I2C bus...
[OK] 1 0x44
[OK] 2 0x5C
[OK] 3 0x70
[OK] 4 0x76
4 devices found
This is very helpful especially for troubleshooting.
Data is read from the sensors every 30 seconds. To filter the high frequency noise of the measured values, 10 measured values are taken and the average value is calculated. The values are then shown on the display of the M5Stack:
On the wall of my office room, the devices measured the following values:
You can easily see that the thermo-hygrometer and my living room barometer are in agreement on the values. Regarding the temperature, the SHT30 sensor deviates by about +1°C. Regarding the humidity, the DHT12 sensor deviates significantly from the results of the other sensors.
Note: The living room barometer displays the air pressure referenced to sea level. This is what you do for weather determination. The QMP6988 displays the absolute air pressure at my location.
The humidity reading on the DHT12 sensor is extremely different from the other instruments. To see how the deviations behave under different conditions, I took the measurement setup into the kitchen and made myself a cup of coffee.
As described in my other project, the software periodically saves the measurement data to the SD card. The data was then analyzed and visualized using an R script. The analysis showed the following pattern:
Measurement procedure: At t=0min, I placed the setup in the kitchen. Then I prepared the coffee making setup, made a phone call and switched on the electric kettle at t=15min. One can clearly see how the humidity in the kitchen increases because of the steam from the electric kettle. And it looks like that there is a constant offset between the values of the SHT30 sensor and the DHT30.
But because I was about to take a shower after my coffee, I took the setup with me into the bathroom:
At t=0min, I placed the setup in the bathroom. Then I brushed my teeth, sorted my socks and at t=5min I took a shower, as can be clearly seen in the data:
Again, the offset between the data is good to see. It is also noticeable that the SHT30 sensor seems to reacts faster than the DHT12 sensor.The outdoor results
Currently we have winter. The local weather station in my town indicates the following actual weather data:
- Temperature: 4.7°C
- Humidity: 92%
- Atmospheric pressure: 1038hPa
So I put the measurement setup outside on my balcony to see what is measured there:
And here are the results:
For the humidity values, it can again be seen that the SHT30 sensor reacts faster to changes than the DHT12. As described above, the local weather station states that there was 95% humidity at the time of my measurements. Why all my instrument read just above 70% is strange. However, this may also be due to the place of installation.
For temperature, there is an unexpectedly large difference at lower values. It would be interesting to compare the measured values to the other two measuring devices. Therefore, I recorded the temporal development photographically:
It is good to see that the SHT30 sensor responds the fastest. The digital thermo-hygrometer and the living room barometer react very slowly and need a long time to adjust to the new environmental conditions.
A word about the air pressure readings:
My hometown is located at 341m above sea level. At sea level, the air pressure is 1013.25hPa. Since the air pressure decreases with altitude, there is only 972.96hPa at my altitude. For weather data, however, the atmospheric pressure at each location is always related to sea level. Or in other words: The measured local values are corrected by the altitude of the location. In my case this is an offset of 40.29hPa:
- Measured value at my home town: 996.3hPa
- Calculated equivalent at sea level: 996.3 + 40.29 = 1.036.59hPa
That makes sense and is also the reason why my living room barometer shows a different value than my measurement setup with the ENV sensors. Over a period of 60 hours, the comparison of the two air pressure sensors shows that both measure the weather-related air pressure changes in an identical way. There is only an offset between the values of both sensors:
As you can see from the data, it is not easy to measure environmental data. And it is also not easy to decide which data to trust and which not. Many sensors are only accurate in certain measurement ranges. My digital thermo-hygrometer, for example, is only rated for a temperature range of 0°c to 50°C. And the humidity display in my analog living room barometer will certainly not be precisely temperature compensated.
According to the data sheet, the SHT30 sensor is "Fully calibrated, linearized, and temperature compensated" and should therefore provide the most accurate values.
If you need accurate values, then it would be the best to borrow numerous measuring devices to compare all of them under different conditions. Then you can calibrate your own sensor according to these values. But that is a own story and not the topic of this project.
And last but not least: If you feel your apartment is too warm, but your thermometer says it's too cold, trust your feelings and turn down the heating.Feedback
I hope this project can be helpful in selecting sensors and interpreting the data. Feel free to message me here if you have questions or comments.