Temperature and Humidity monitoring

The slightly smarter home topic continues. In this coming winter many of us probably want to understand our energy usage and home climate a bit better. We have two analog humidity gauges and they both seem a bit suspect. And to be honest, now that we have our own little Volkszaehler server in the basement, I wanted to have some data on indoor temperature and humidity and not just the outdoor data (which, as far as I know, is coming from modelled-weather sources and not an actual weather station) and see a few more interesting things on the page with all the traces.

We have a lot of old bits and pieces in our basement - sensors and Arduino-compatible boards, even another Raspberry PI in addition to the one we used for the Volkszaehler. So I wanted to see if we could use some of that up instead of needing to buy more stuff.

I found a "Pretzel board" Arduino-like board with ESP WLAN from Franzis. More details on that here (in German). I also found a "TPH board" for the Grove sensor system which contains an SHT21 temperature/humidity sensor and a BMP180 temperature/pressure sensor. I'm not very good at this stuff, but after a lot of reading and trial and error I figured out how to wire the two together and find the code/libraries online to make it all work.

I wanted to send to our Volkszaehler server instead of Thingspeak, and the experience in that post of HTTP POST requests to add data was helpful, but I had success by using the simple GET request detailed in their API docs (you just specify the operation in the GET request to get around the REST API purism - I'm very grateful for their pragmatism there).

You can find the cleaned-up source code here. You need to have the Sodaq SHT2x library and the Sodaq BMP085 library if you want the pressure data (I didn't use the BMP180 data at all in my project). I had to select the ATMega328P (Old Bootloader) board. The other includes should automatically work. The functions for the ESP are from the Conrad Advent Calendar project and seem to still be available here. The code for using the Sodaq libraries is based on their example here.

The wiring diagram there is also important (3.3V, not 5V!) but for the Pretzel board, the pins are A4 for SDA and A5 for SCL. It seems the include of Wire.h is the important part to make I2C work over those pins for this type of Arduino-compatible board. In general, as described in the page referenced above, you can look for info on the Arduino Nano.

A serious hiccup I had was that the board only very sporadically wanted to connect to our WLAN. With internet sharing from a Mac it worked fine. In the end it seemed creating a separate SSID for 2.4GHz and setting that network to only do older-style WLAN 802.11b/g worked.

Below you can see the data being plotted. The big change is the the morning airing reducing the humidity.

I added a function to disconnected from the WLAN because I didn't want it sitting connected all the time between the short data sends, and also didn't want to have to add monitoring/reconnect-if-disconnected code. A simple reconnect each time solved that well, for me.

The monitor is still sitting in raw breadboard form in our hallway. I still need to set it up in a more tidy/compact way.

Birgit is still talking about building a proper outdoor weather station, maybe that's be a topic for a future post.