Low Level Home “Automation”

By silviodc, 27 July 2020

Like many humans and all Nerds, I really enjoy to place my life into metrics and keep an overview.

Since my gf and I started making mead, it was of interest where we could store it during fermentation process.

For that the temperature needs to be at least above 15°C and so we placed a thermometer into the basement to check this.

I also have some other projects in mind, where it is interesting to know the exact temperature during the curing process,…

While the temperature stays pretty constant in the basement, it definitely does not in our attic flat. So I got an DHT11 temperature and humidity sensor to keep track of the apartment.

Since it is cumbersome to store it on a SD card and read it out again and again, I decided to use the sensor in combination with my ESP32, and send the values to my server and suddenly I had a great micro project which had a surprisingly broad spectrum, which not to much depth in each of them.

This projects involves Sensors, Microcontrollers, Network Technology, Backend and Frontend development.

The ESP32 code was quickly copied together from the built in libraries for DHT11 and a Wifi Client scan.

Reading the sensor values worked right from scratch and I had to enter a delay, to not spam my server with new data every second. (I also do not need that granularity)

But I had some issues with the wifi libraries of the WifiClientBasic example, until I found out that my server automatically forwards to https and I needed the WifiClientSecure example to send a certificat and get it to work.

On the backend there is a simple php script, which splits the content form the GET request into a csv file and adds a timestamp.

Also the frontend is suuper simple and just shows the current temperature and humidity value in my apartment and a plot of the last days via the Chart.JS.

So for around 5€ in Hardware and a few hours of coding, I know have an online overview of the temperature and humidit curve in my apartment.

Now I am kind of looking forward to the next heat wave, where I can methodically analyse the efficiency of the mobile AC 😉

There is also some potential to improve this in the future, where for example the ESP32 also controls the AC and turns it on if a temperature threshold is reached and it recognizes that I am at home (my phone in the wifi) or something similar 🙂

The whole code can be found here. Feel free to use and modify it for your own projects 🙂