DIY Temperature and Humidity Logging System

DIY Temperature and Humidity Logging System

Sep 24, 2024    

Vision

I wanted find a low cost, open source, accurate solution for logging temperature and humidity in various rooms of a building. I used a microcontroller board based on the Espresif ESP32 to send data via WiFi up to Adafruit IO, a data storage and visualization service that is free for up to 10 feeds at up to 30 data points per minute, or in the future any connected server using the MQTT message protocol. I wanted the sensors to be compact, long life and virtually maintenance free due to being USB powered instead of having a lithium battery pack.

Parts List

(Prices as of September 2024)

Approximate cost per sensor = **$19.72

The cost could absolutely be reduced further, mainly by using generic ESP32 development boards off of Amazon. They may be larger and harder to work with, while the Adafruit QtPy is about the smallest size you can find while being packed with features like USB Type C, a plug-in I2C port, and an RGB Neopixel onboard.

Not Included in Cost Estimate

  • USB 2.0 A to C Cable - Use pretty much any generic cable.
  • USB A 5V Power Supply - Use any name brand, preferably UL listed, USB power brick that came with an old device.

Specs of the SHT41

While not having a NIST calibration certificate, Sensirion has extension documentation on their SHT41 sensor. According to their datasheet. Typical relative humidity accuracy of +/- 1.8% with resolution of 0.01%, and long term drift of <0.2%RH. Typical temperature accuracy of +/- 0.2C, resolution of 0.01C, and a long term drift of <0.03C/year.

This sensor also has a built in, very small <200mW, heater similar to other comparable sensors on the market. The purpose of the heater is to help correct inaccuracy in the humidity sensor after it is exposed to a very high humidity environment where it can become ‘saturated’. After my testing, I concluded it was not necessary to run the heater during regular operation given the typical humidity range in the climate controlled house is 45 to 55%.

Programming

I programmed the Adafruit QtPy ESP32S3 with the Arduino IDE, because it was the simplest to get up and running quickly. You can also program the ESP32 in C with the ESP-IDF, VS Code with the PlatformIO module, or in Python using CircuitPython.

Finishing Touches

I designed a 3D printable case for the microcontroller, sensor, and their connection wire. I kept the case as slim and as long as possible in order to keep the heat producing ESP32 far away from the temperature sensor, I included a hole to push the reset button, a thin spot in the plastic to diffuse the status led through, and pockets for 10mm x 3mm round magnets to be glued into.

3D Printed Case

I distributed the sensors in our 2 story house, two upstairs and two downstairs all in rooms on opposite sides of the house that get different sun exposure. The data is dumped into a line graph of all four sensors in Adafruit IO. I can then download up to 30 days of stored data at a time in a CSV files format. I have written a basic python script with the help of Google CoLab and ChatGPT that runs calculations and displays visualizations of the data using pandas, matplotlib, and bokeh.

Adafruit IO Monitoring Dashboard

Useful Performance Data

One of the most useful parts of having this data is the ability to keep tabs on the health and performance of the house’s HVAC system (a new dual fuel system with a RUUD two stage 15 seer heat pump combined with an Aqua-Coil Hydronic Heating Coil, and a highly programmable Honeywell Vision Pro 8000 thermostat). Having this data allowed me to perform basic calculations to obtain an estimated heating and cooling load rather than hiring an HVAC engineer to perform an ACCA Manual J Residential Load Calculation. This showed me how the 2 stage heat pump would be able to produce more than the required amount of heat in the winter while maintaining a coefficient of performance of 2.7 down to 17 degrees F outdoor temperature even if it wasn’t assisted by the natural gas heated hot water flowing through the coil. That’s 270% efficiency at below freezing outside, for every 1kW of electricity you pay for, you get 2.7kW worth of heat out of the vents!