This post describes my recent project to improve upon the Domestic Hot Water (DHW) situation at my house.


I wanted to design a more efficient DHW system for my house. A large percentage of our household energy is spent on hot water, so I wanted to optimize and customize.

Most Systems

Most DHW systems are relatively simple. There is a hot water heater, somewhere around 40-50 gallons in size, and it uses electricity or natural gas to maintain water at a certain temperature. It uses a simple thermostat logic where it turns on the heat when the water gets below a temperature, say, x, it turns off the heat when the water gets above temperature y, and x < y. Cold water goes in the bottom of the tank and hot water comes out the top. Simple.

The Problem

The problem with this is that there are standby losses, which means that heat in the tank slowly dissipates, even though most tanks nowadays are very well insulated.

Also it is dumb, maintaining hot water all the time whether you need it or not.

The Typical Solution

Enter tankless water heaters (TWHs). They solve the standby loss problem by only generating hot water when it is called for. They sense when flow is happening in the pipe and blast the cold water with so much thermal energy as it flows through the heat exchangers that it comes the other side nice and hot. These units are typically much smaller than traditional water heater tank. They use either electricity or natural gas.

Tankless water heaters are touted as more energy efficient than traditional water heaters. They also give you unlimited hot water for as long as you have fuel and are willing to pay for it.

The Typical Solution’s Problems

Unfortunately TWH systems have their own issues. The hot water is not instantaneous, so there will be a bit of cold water at first. This can be a problem if the pipes have warm water in them but the TWH has cooled down and somebody calls for heat, say, for a shower. The showerer will turn on the shower and, feeling warm water, will get into the shower. In the meantime, cold water just passed through the TWH on the way to the showerhead. The TWH is working hard to heat this cold water up and it will soon reach the desired temperature, but the cold water’s already on its way. So the showerer is in for a nordic surprise. Folks call this the “cold water sandwich.”

Another problem is that you will have no hot water reserves if you lose electricity or natural gas service. During blackouts or natural disaster recovery periods you will be enjoying robust cold showers.

The Typical Solution’s Problem’s Solution

A solution to the cold water sandwich problem is to add a small (6-10 gallon or so) hot water mixing tank downstream of the TWH so that any temperature fluctuations are evened out. But then again you have the problem of standby losses, although not nearly on the scale of a full-size tank.

My System

My system uses electricity and previously only a traditional electric water heater tank. After installing rooftop photovoltaics (solar panels) we decided to switch to a time-of-use (TOU) metering plan from the electric company. In our case, TOU means:

  • The cheapest electricity is during off-peak from 2100-0900.
  • The middle tier of cost is during shoulder from 0900-2100.
  • The most expensive electricity is during peak from 1400-1800, Monday-Friday.

Now if only there were a way to combine the benefits of both traditional tank water heaters and newer, fancier tankless water heaters to save money and retain some hot water reserves….

The Details

Instead of using the tank as a mixing tank to even out temperature fluctuations, I decided to reverse the typical order of water heaters and have the TWH act on the output of the full-size tank heater. Combined with the ability to remotely control the on/off state and temperature of the TWH, this system provides the following benefits:

  • The TWH does not work as hard (or at all) if the water coming out of the tank is already hot.
  • The tank can be turned on during off-peak hours when electricity is at its cheapest and the hot water can be used during the more expensive times of day, essentially time-shifting our hot water. (Think of it as a DVR for hot water.)
  • The TWH can be used as the only source of hot water during off-peak hours when the tank is heating up by using a three-way valve to temporarily bypass the tank.

By custom engineering this system, I am able to optimize for the amount, temperature, and cost of hot water depending on the time of day and even the intended use of the hot water (washing clothes, taking a bath, washing your hands, etc.)

But Wait, There’s More

Another problem that I wanted to rectify with this overhaul was the time it took for hot water to reach the farther bathrooms. The hot water systems are in one corner of the house, close to the master bathroom, washing machine, and kitchen. But the two other bathrooms require the hot water to travel a longer distance. This is quite wasteful of water and, where I live, water conservation frequently outweighs energy conservation. So the answer is a DHW recirculation loop.

The hot water system is re-engineered to form a loop, with the return point at the farthest fixture (in our case the guest bathroom). The loop returns the water back into the water heating system, right where cold water enters. But to maintain energy efficiency, the pump only runs when a bathroom is occupied, as determined by motion sensors, and using thermostat logic: there is an inline water temperature sensor just before the farthest fixture. The target temperature of this thermostat logic is automatically adjusted to be 95% of the target temperature of the TWH. The pump will shut off when this temperature is reached and re-activate when it drops more than 1°C below the target temperature (so long as there is motion in a bathroom, otherwise it doesn’t run at all).

Home Automation

The system is controlled through our home automation system and the logic can be altered with a few lines of code.

  • Want the hot water to get hotter when washing your clothes? Done.
  • Want to only use stored hot water during peak TOU hours? Done.
  • Want to shut the system off completely when nobody’s home? Done.
  • Want to only turn on the TWH after 15 seconds of continuous use? Done.

The last point is because it would be a complete waste of energy to heat water that will never make it to the fixture. This is the typical use case for someone washing their hands: the hot water is turned on at the fixture and water flows through the pipes to the fixture, but by the time hot water reaches the fixture, the hands are washed and the water is turned off. So why waste the energy to simply heat the pipes?

System Diagram

Here is a diagram of the components of my DHW system. The following components are connected to the home automation system:

  • WH power
  • TWH on/off and temperature setpoint
  • temperature sensor
  • DHW recirculation pump
  • 3-way valve

![DHW system diagram](/images/DHW system diagram.png)

System Images

remote interface to TWH

One of the first components I had to create was a physical interface (and custom firmware) from the TWH to the home automation system. Learn more about that project here.

system overview

Here is an overview of most of the physical components of the system. The DHW loop return enters from the upper-right of the photo, through the pump, and back into the three-way valve. The valve is actually two regular motorized valves wired together so that when one is open, the other is closed (and vice-versa). This allows supply water to go into either the tank or the tankless, but not both simultaneously. They are controlled by a low voltage relay connected to a NodeMCU with special home automation firmware.

DHW loop recirculation pump

This is a closer view of the DHW loop pump. It is plugged into a smart switch that is controlled by the home automation system. Creating this system necessitated installing several (GFCI) outlets.

remote inline DHW loop temperature sensor

This is the remote inline temperature probe, ordered from BrewPi. My only concern with this part is galvanic corrosion between the stainless steel tee and the brass fittings. I will have to keep an eye on this and install a water leak sensor nearby. (This leak sensor would give the system the ability to automatically shut off main water to the house should it detect a leak.)

I also had to write custom firmware for this, since I wanted to strike a balance between frequent temperature reports for a responsive system and not flooding the data network with unnecessary information. I came up with a simple algorithm that reports the temperature more frequently as temperature changes more rapidly, and it slows down reporting as the temperature changes slow down:

2018-08-01 water temperature

Measurement & Future Experiments

All that it is needed to create a system model that will generate desired results is to iteratively measure the energy going into various components of the system and to modify system behavior. That is the potential next step for this project. Fortunately as it is currently designed, the DHW system behavior can be altered through software to simulate any number of scenarios:

  • traditional WH only, on all the time
  • traditional WH only, on during off-peak
  • TWH only, on all the time
  • TWH only, “smart” setpoints that adjust depending on TOU
  • TWH only, “smart” setpoints, and hand-wash delay
  • traditional WH + TWH, all automations

After adding energy measurement to the WH and TWH it may be worthwhile to validate my engineering instincts through empirical data collection by performing various experiments to characterize energy usage and by taking notes on subjective comfort and convenience.


Thanks for reading and please let me know if there’s something I missed or may not have considered.