MQTT PoE Thermostat

I did not like the thermostats out there, because they all run on batterie and wireless. I want to save the wireless spectrum for our mobile devices. It is also not very efficient to do temperature adjustments with those thermostats. If the heating system is configured correctly, it will take care of any temperature changes and compensate for them, but it is important for example, to turn the thermostat off, if a window is opened.
The thermostat should only be used to adjust the comfort, if you’re feeling cold or warm.

So, I went to develop my own thermostat.
I tried Arduino Megas, but that didn’t go well. For details see my post Stay away from Arduino, go for ESP32.
I now use an ESP32-PoE-ISO with MQTT.
I attached a DS18B20 as temperature sensor and a L298N motor driver. I use servos that I took from some cheap wireless thermostats from amazon (10€ each) including their valve thread and put them into some body lotion casing (1€ each) from the drug store. Here two pictures:

On the software side, I use the pubsub client library for MQTT.
EDIT: I tried ESPHome for this unsuccessfully, see here GPIO Pin drops to 0V when sensors publishes.
The logic is to just translated the angular presets from a manual thermostat to specific positions. I track the thermostat positions via the drive time of the servos. To compensate for inaccuracy the thermostats are calibrated once a week. First I tried to build a PID controller with fuzzy logic decision making. Total over engineering.
Since the thermo dynamics in a house with an open lobby are very chaotic, I use the temperature sensors to detect whether there is a high temperature gradient. If this is detected and a window somewhere in the house is opened, I turn down this thermostat.

It took me 2 years to develop and finally deploy all 13 devices.

Now it is working very well. With the exception that I still wait for this What the heck it is not possible to use area in automations feature to be available eventually to have the link between window contact and thermostat in the same room.

3 Likes

Interesting project! I have a preference for wired solutions when it comes to thermostats too. Can you elaborate a little bit on what you used a radiator valve? Did you alter an existing product? Which one?

I bought these thermostats and took the servos and gears, and dumped the rest.
I put them together with a motor driver in such a plastic casing.

1 Like

Allright thank you!
I bumped into two similar projects like this. Both able to modify to use with PoE.

An arduino based one:

This one:

and a raspberry pi0 based one:

Hi Chris,

I like the idea using only the servo mechanics! I am looking for a simular hardware and just like to use this servo as an analog valve.
Later implement this into floor heating unit. Do not like to use PWM controlled soleonids anymore for different reasons.
Apart of this also usefull for any analog water control!
Like to understand how your code is adapting to valve and doing calibration once a week and normal operation. Guess you read out the rotary photo sensor and drive the motor. Would be helpfull if you could share the code you use!

Or is there a method to set the existing valve driver electronic to analog value from 0-100%??

Thanks
Alex

Hi,

well, I just use time measurements, sadly the gear has no sensor and is to tight to one in msyelf.
At first I open the valve from zero until no more increase in the waterflow is audible. I then divide this drive time tohave percentage steps.
However, the drive time varies between opening and closing. Which makes sense. If you open the valve, it takes less force to drive the motor, because the water pushes the valve open. Hence shorter drive time. If you close the valve, you work against the force of the water. Hence, longer drive time. I tried to use different multiplieres for both directions, but without success.
I haven’t solved this problem yet. Which means that you always have to drive back to zero and then drive to the target position, to get an accurate position
It works good enough though…

The code is pretty simple. Drive clock wise (motor pins: low, hi) for xx milliseconds. Brake (motor pins: hi, hi). Drive counter clock wise (motor pins: hi, low) for xx milliseconds.
Calibration is done by driving counter clock wise and overshoot significantly, to ensure the valve is coompletely closed.

I want to migrate this to a PID based solution with ESPHome, but I’m having the same problems there…

Hi Chris

thank you so much for your explanation. I buy a cheap eq3 TRV with no bluetooth and looked into it. Also realised that there is no actuation sensor like poti or ir light scale wheel…like a servo is doing. Just motor on a gear pushing at the end the valve pin via worm gear against spring load of valve. Guess motor simply run with time limit to ensure gaging to the end position and start corelate position via time. Once per week or any other lobg time period this homing ensures close means close.
I tied up with a ESP8266 D1 mini as Jan Smejkal is doing in his project. Unfortunately I spebd hours of compiling and end up with no flashing. Try to get intouch with Jan to ask for ready to use bin file.

Alex