A Sonoff Switch Repurposed As A Thermostat

Underfloor heating is a wonderfully luxurious touch for a bedroom and en-suite bathroom, and [Andy] had it fitted so that he could experience the joy of walking on a toasty-warm floor in the morning. Unfortunately after about a year it stopped working and the culprit proved to be its thermostat. A replacement was eye-wateringly expensive, so he produced his own using an ESP8266-powered Sonoff wireless switch.

The thermostat has a thermistor as its temperature sensor, embedded in the floor itself. This could be brought to the ESP’s solitary ADC pin, but not without a few challenges along the way. The Sonoff doesn’t expose the pin, so some very fine soldering was the first requirement. A simple voltage divider allowed the pin to be fed, but through it he made the unfortunate discovery that the ESP’s analogue input has a surprisingly low voltage range. A new divider tying it to ground solved the problem, and he was good to go.

Rather than using an off-the-shelf firmware he created his own, and with a bit of board hacking he was able to hard wire the mains cabling and use one set of Sonoff terminals as a sensor connector. The whole fit neatly inside an electrical fitting box, so he’s back once more to toasty-warm feet.

This isn’t the first ESP thermostat we’ve featured, nor will it be the last. Here’s a particularly nice build from 2017.