Immersion heater thermostat replacement

Hi there,

I’m looking to modernise my immersion hot water heater. The heater is a simple on/off controlled with an old fashioned bimetallic thermostat:

I will use a Sonoff TH16 for the control but I am looking into different temperature reading approaches.

I’ve seen folks here have:

  1. Attached temperature sensor to the tank
  2. Attached temperature sensor to outlet/inlet
  3. Used existing temperature sensor (e.g. visual)

I’m wondering if anyone has retrofitted these tube thermostats with a small sensor and used that? There is not a lot of room to work with (6mm internal diameter), but I think I can squeeze in a small sensor and long wires down into the bottom, which will obviously give a good temperature reading.

I’m assuming regular wires + solder will be fine at up to 100C?

From the Tasmota documentation there appear to be 3 sensor options:

  1. Si7021 which requires an MCU to “make it 1 wire” so that is out
  2. AM2301 which looks like a DHT22 package ie. too large
  3. DS18B20 which is a TO-92 package (~5mm) package and appears to only need one 4.7k resistor to work

I’m thinking of trying the DS18B20 down the tube - any suggestions welcome!

Cheers,

Amadeus

1 Like

My suggestion is not to do that, as these are also safety cutoffs.

I have a (raw TO-92 cased) DS18B20 under the foam insulation next to the immersion and it gives good readings. The heater is switched with a Shelly 1PM which, at the moment, turns on the element and lets it run until its thermostat cuts the power. The 1PM’s power reading then lets HA know it’s finished, and I switch it off.

I could configure it with a higher thermostat temperature just as a safety backup and do the switching with the Shelly based off the sensor but it’s not ideal to be switching off high current loads with relatively small relay contacts (Shelly is rated to 16A). If I chose to do that, I’d use a much bigger contactor relay rated well above the 13A draw of the element.

I also have sensors on the coil in and out, which add to the data:

image

Purple is top of tank, cyan is coil inlet, blue is coil return and red is loft cold water tank. I ran a combination gas + immersion cycle at 10pm (coil temperatures fluctuate with the boiler cycling) and had a shower a few minutes ago (drawing colder water into the bottom of the tank).

Thanks @Troon, the system doesn’t currently have a cut-out but I can add one in, set the thermostat component to a high temperature and control power through HA.

For the sensors on the coil in and out, what did you use? Another DS18B20? Was it battery-powered or did you hook all the sensors up to one device?

All three on the tank are TO-92-packaged “raw” DS18B20 sensors: the top one is wedged under the insulation; the other two are cable-tied to the pipes right next to the tank.

I have a box with an ESP8266 (Wemos D1 mini) and a couple of relays running as a controller for the gas central heating and gas hot water (Y-plan system) — these three sensors as well as the one for loft cold water (waterproof DS18B20) and loft ambient air (another TO-92) are connected to that and reporting to HA.

The loft ones are to protect against freezing: if the temps get too low if we’re away in winter with the heating low, it can run the hot water to soak some heat upwards and warm the cold water tank. No idea how likely that is, but I can find out now I have it instrumented.

image

Nice! Do you use parasite power for the DS18B20 sensors or run multiple external supply lines from the Wemos D1 mini?

And do you share one data bus for all your sensors or have them connected on different GPIO?

The controller is powered by a Vigortronix VTX-214-005-105 power supply module, and I run a 5V supply directly from that to the sensors. They’re all on the same GPIO as all the others are in use.

I also have a template sensor that makes an estimate of the “charge” of the cylinder:

- platform: template
  sensors:
    hw_tank_heat_pct:
      friendly_name: 'Hot water cylinder heat charge'
      entity_id: sensor.tank_top, sensor.coil_inlet, sensor.coil_return
      value_template: >-
        {{ ((([0, [50, (states('sensor.tank_top')|float)]|min - 30]|max) * 0.5) +
            (([0, [55, (states('sensor.coil_inlet')|float)]|min - 30]|max) * 3.0) +
            (([0, [40, (states('sensor.coil_return')|float)]|min - 30]|max) * 1.5))|round(0) }}
      icon_template: >-
        {% if states('binary_sensor.hw_running') == 'on' or
              states('sensor.immersion_switch_power')|int > 100 %}
            mdi:battery-charging-outline
        {% elif states('sensor.hw_tank_heat_pct')|int < 10 %}
            mdi:battery-alert-variant-outline
        {% elif states('sensor.hw_tank_heat_pct')|int < 100 %}
            mdi:battery-{{ 10-(states('sensor.hw_tank_heat_pct')[0]|int) }}0
        {% else %}
            mdi:battery-outline
        {% endif %}
      unit_of_measurement: '%'

The numbers in the value_template line are “fully-charged” temperature for the section (50°C), “cold” temperature (30°C) and a weighting for the section (0.5). If all the sections are at or above the fully-charged temperature, the tank is at 100%.

The icon_template shows this as an upside-down battery icon, as the heat is at the top of the tank. If the gas or immersion is running, the icon changes to indicate that the number is probably useless. Here’s how it currently looks:

image

1 Like

Thank you for the details. As an experiment, I disabled the electric immersion coil and replaced the existing thermostat with a DS18B20:

I attached three more DS18B20 to the oil boiler (aga so affected by cooking lunch…) inlet, outlet and hot water pipes coming off the water cylinder.

The data is interesting in that the internal tank temperature is consistently ~5 degrees higher than the measured hot water temperature, which also spikes whenever a tap is run:

I’m assuming that’s because the external coupling won’t get as close to the real temperature as the internal thermostat approach, and the top of the tank will cool until run and gets a fresh burst of hot water from the tank:

1 Like

Update on this. Adding insulation and cable tying it tight to the sensor boosted recorded temperature by ~10C! I ascertained that the hot water temperature sensor is about 10C lower than the temperature measured in the tank via the tube thermostat. I also ascertained that a sensor 1/3 of the way up the tank (recommended approach) is really inaccurate - as soon as you draw hot water cold water rushes in and drops that temperature reading significantly, even though you have lots of hot water above that.

My final approach is to set the thermostat based on the hot water measurement at the top, which is about 10C cooler than actual water temperature. So I set the thermostats to 50C. I’ve added a thermal cutoff analog thermostat back in which is set to roughly 60C. I’ll monitor over time with a digital thermometer when I run the hot taps.

And finally got around to finalising the wiring:

1 Like

UPDATE

Sadly, the Sonoff TH16 (rated 15A) caught fire last night:

Luckily the case I used was sealed and even with the holes for wires there wasn’t enough airflow to cause serious, significant damage.

There is a three year old thread on the manufacturer’s support page showing many others have issues.

I’ll be looking for a properly rated relay or contactor. TBC…

UPDATE

Thanks to @HeyImAlex’ suggestion on a separate post about mixing DC and AC in one box, I’ve improved the setup to:

  1. Add a 6A MCB to protect the Sonoff Mini
  2. Move the “ELV” (extremely low voltage) DC component outside the case to comply with UK regulations on mixing ELV with LV (low voltage aka mains AC voltage).

I need to tidy up the DC elements now perched on top, but I’m happy with the safety of the mains components.