I have two heaters in my fish tank. Since the thermostats are very hard to synchronize I’ve added a THIRDREALITY Smart Dual Plug, Zigbee 2-in-1 and an Aquarium Thermometer, Smart Fish Tank Thermometer in combination to control the heaters.
I have both heaters set to 84° F and an automation that turns both outlets on when the temperature is below 80° F and off when it is above 80.01° F. This is working well, but has some overshoot, so the actual temperature varies from about 79°F to 81° F. (BTW, event monitoring didn’t seem to work, so my automation checks every 5 minutes).
To improve this I am thinking of using PWM techniques and/or a PID controller.
I’ve used PID control before, so I am good with that. A PID control should learn (by integration) how much baseline energy is required to offset heat loss to the room
The remaining problem is that the temperature control is binary (bang-bang control https://en.wikipedia.org/wiki/Bang–bang_control.) I am thinking of using slow timescale PWN methods to smooth this out. The idea is that I have a controller with a power setting from 0 to 100. Given this setting the heater (switches) turn on for P seconds, then turn off for (100 - P) seconds.
The PWM automation would directly control the heat, and the PID control would adjust the PWM setting.
I am trying to figure out a simple way to implement this PWM algorithm in HA. It would be simple in Python or C++ but not so much in YAML.
Has anyone worked on something like this before? Any tips?
Relays aren’t meant to be switched anywhere near that frequently or quickly. It won’t be a matter of if, but when they fail.
I have my aquariums controlled/monitored by an ESPHome controller I made myself, but for the heating piece I’m not much different than your setup. Standard aquarium heater (with the temp a bit higher than my setpoint) and a relay that controls it. I have them set with a 1 degree deadband as this seemed like a reasonable tradeoff between right temperature control and a reasonable number of relay cycles. I never get over or undershooting.
I’m wondering if you’d have better luck using the generic thermostat rather than your automation:
Are you sure that the checks are occurring every 5 minutes?
The “flat” sections in the graph seem to indicate that the checks are only occurring about once every hour - unless there is some kind of reporting/graphing issue going on.