How I Used Two ESP32 Boards to Monitor My "Dumb" Hot Water Tank

When I first considered how to make my "dumb" hot water tank smarter, the obvious solution was to buy a smart-connected immersion heater. However, being a tinkerer, I wanted something a little more DIY—and cost-effective! Enter the ESP32, a cheap and versatile microcontroller. With two of these boards and a little ingenuity, I managed to monitor my water tank’s temperature and energy usage. Here’s how I did it.

The Problem

My immersion heater works well enough, but it’s completely unaware of the world around it. I couldn’t easily track how long it was running, how much energy it was using, or whether the water temperature was reaching optimal levels. I didn’t want to rip out a perfectly functional immersion just to upgrade to a smarter one.

The Solution

The ESP32 boards are an excellent choice for this kind of DIY project. They’re inexpensive, Wi-Fi-enabled, and packed with GPIO pins for connecting sensors. For this project, I used:

Two ESP32 boards: One for monitoring temperature, the other for energy usage.

DS18B20 temperature sensors: Reliable and easy to interface with.

A current sensor: To measure the power drawn by the immersion heater.

Home Assistant: To bring all the data together.

Step 1: Temperature Monitoring

The first ESP32 board was dedicated to monitoring the water temperature. I attached a DS18B20 temperature sensor to the tank’s surface using thermal paste and a metal strap to ensure good thermal conductivity. The ESP32 reads the temperature data and sends it over Wi-Fi to my Home Assistant setup.

Code for Temperature Monitoring

Here’s a snippet of the code I used for the ESP32: