How much solar hot water do I have ?

pascal boudalier
6 min readApr 26, 2021

Figure out from your coach, with a DIY solution.

It all started with a life or death question, how much hot water do we have for showers ?

I know very few people ever wonder, they take it for granted.

what you will get ..

My solar water heater installation

A few years ago, I installed a solar water heater. Energy from the sun is captured by solar panels on my roof, and used directly to heat water in the water heater’s tank. Unlike photovoltaic solar installation, there is no electricity involved. It works like a charm.

Solar panels transfer heat to a special fluid (red on the diagram above). An exchanger in the water tank transfer this heat to water. Hot water is flowing from the top of the tank, replaced by cold water entering at the bottom of the tank.

Of course, the water heater is also equipped with the electrical resistor to heat water when there is no sun.

So back to the question, why do I care ?

When there is plenty of sun I do not. The tank rapidly fills with 50 °C water. But when there is little sun, the question is valid. Did I get enough hot water for the evening showers ? For the morning one? Do I need to fire the electrical heater? Now? Can I wait until night to benefit from off-hour rates ?

Yes, I have a complicated life.

You may ask: don’t your system provide you with this information? Not really. It comes from the thermal sensor located at S2 in the diagram above, i.e. the zone where the heat exchanger takes heat from the panel and transfer it to water. This is not enough:

  • this is just a display. I need to go in the cellar to read it. I want a connected solution.
  • more importantly, this is only the water temperature at the bottom of the tank. But the hot water will come from the top of the tank.
Late morning. Sun is up. Temperature at the bottom of the tank is already 48 °C

My system uses stratification, meaning hot water will naturally move to the top of the tank. Temperature is not even, and the tank may very well be filled with hot water at the top, while the bottom is much colder.

The key advantage of stratification is that you get hot water very quickly, compared to more traditional heating coils systems.

Stratification on the left. Heating coil on the right.

So to get a sense of whether I have hot water at my disposal, I need to measure the water temperature at the top of the tank. To evaluate how much hot water I have, another measure at the tank’s mid point is also handy.

My DIY connected application

My DIY solution is based on an ESP32 microcontroller, MicroPython and a couple of DS18B20 temperature sensors.

Hardware design
A DS18B20 temperature sensor. Those sensors are positioned to touch the water tank metal enclosure. I had to dig a small hole in the tank’s thermal insulation to get access to the metal. Of course I cannot get inside the water tank itself.
The two temperature sensors

The ESP32 has built-in Wi-Fi and communicates with a smartphone application using the Blynk framework. (see Enlighten your garden with MicroPython or This computer will run forever to get more details on the Blynk framework).

The system is powered with a small LiPo battery, so it can be placed anywhere since no wall plug are needed. A charge sensor is used to measure the battery state of charge ( SOC, ranging from 0 to 100%). The SOC and the temperature readings are sent periodically to my smartphone. They are also displayed on a small OLED display connected to the ESP32.

The OLED screen displays various information, in particular the temperature at the top and mid point of the tank, the LIPO battery SOC (state of charge) and the Wi-Fi signal strength.
Testing on the living room table. The MicroPython application is developed with Microsoft VScode and downloaded to the ESP32 with USB (not shown)

Several techniques are used to minimize energy consumptions (key for battery operated devices):

  • ESP32 deep sleep mode. The ESP32 starts, read the temperatures and the battery charge, send those values thru Wi-Fi to my smartphone, and then goes to deep sleep for the next 10 minutes, after which the cycle restarts. While in deep sleep, the ESP32 almost does not draw any power from the battery.
  • The OLED screen and the temperature sensors are powered by the ESP32 itself. So while the ESP32 deep sleeps, those two devices are powered off as well.

I measured ~1milli amperes consumption while in deep sleep mode. So in theory, a 1000mah LiPo battery would last 1000 hours. There may be other methods to further decrease consumption, but that will be the subject of another article. Note that for now I intend to manually recharge the battery when needed.

3 days worth of data. Temperature (red and orange) raises in the morning, as the sun hits the panel. It drops a bit in the evening, as showers are taken. The blue line is battery state of charge.

As can be seen below, the system send temperature values every 10 mn.

The smartphone application.

The code is available at this github repo.

From my experience, the temperature reading does not accurately represent the actual water temperature. This is due to the setting: because I did not want to destroy too much of the tank’s thermal insulation, only the tip of the sensor touches the metal which is not exactly at water temperature.

Actually, this is not critical since I am not interested in the exact temperature. I simply wants to figure out whether there is hot water or not. So this setting is more than good enough. If the top sensor is in the mid-90s Fahrenheit (mid-30s Celcius) I know I have enough hot water to avoid using electric heating overnight. A few kwh (kilowatt hour) saved, days after days.

I may use this application as a data source for further automation. Stay tuned !!

In the mean time, solar water feels so nice on my skin .. and the sky is the limit ..

— — Do not cross this line if you are not interested in details — —

Beside energy consumption, special consideration is needed for systems that are designed to stay out there, untouched for days or months:

  • robustness: a watchdog is implemented as a separate MicroPython thread (yes, you get multi threading on a 3$ microcontroller), which forces deep sleep after 60 seconds, no matter what. This covers possible hangs, loops, bugs ..etc.. Without a watchdog, the program would just stop, and sit idle, consuming power. A push notification is sent to my smartphone when the watchdog pops.
  • remote update: A jumper cable can be used to tell the ESP32 to not go to deep sleep, but instead initiate MicroPython’s web REPL (Read Evaluate Process Loop). This allows updating the MicroPython application via Wi-Fi with no need of a USB connection between your desktop and the ESP32. To replace a jumper cable with a virtual one, you can read This computer will run forever .
  • operation statistics: the application records the status of sensor readings (ok or failed), the number of failures since last hard reset, and the number of time the watchdog popped. Those statistics are stored in a specific RAM area of the ESP32, known as RTC (real time clock) memory. This memory is maintained during deep sleep while the rest of the RAM is wiped out. Those statistics are displayed on the OLED screen and sent periodically to my smartphone application. Note that the are no reasons for a sensor reading to fail. If it does, this is most likely a cable getting loose.

So , was crossing the line worthwhile ?



pascal boudalier

Tinkering with Raspberry PI, ESP32, RiscV, Solar, LifePo4, IoT, Zigbee, energy harvesting, Python, MicroPython, Keras, Tensorflow, tflite, TPU. Ex Intel and HP