News for hackers. Stuff that matters.
Re:I Built a Smart Thermostat by wolfgang42 on Tuesday December 15, 2020 @11:43PM (#25439159)
Bang-bang[1] works fine for home heating applications, and is used by every thermostat I’ve ever seen. PID is more useful if your system requires/allows fine adjustments rather than just switching on and off.

[1] https://en.wikipedia.org/wiki/Bang%E2%80%93bang_control

Re:I Built a Smart Thermostat by mtsr on Wednesday December 16, 2020 @02:14AM (#25439912)
My 18 year old central heating system already supports modulation. Surely these days most support it through some open control standard such as OpenTherm?
Re:I Built a Smart Thermostat by eythian on Wednesday December 16, 2020 @11:10AM (#25444234)
Mine also, my heating is often running at ~40° unless it's bringing it up from being off overnight or something. Recently I installed a Nest thermostat and doing reading around it suggested that in the US (I'm in the EU) OpenTherm may not be so common, so perhaps they don't tend to use systems that can do modulation much there.
Re:I Built a Smart Thermostat by tW4r on Wednesday December 16, 2020 @02:43AM (#25440064)
Do you perhaps have recommendations on how to control:

1x central heater with:

.. state: on or off

.. actions on or off

Nx Temperature regulator valves

.. state: current temp, target temp, percentage open

.. actions: set target temp only

What control loop do I use to control the central heater on|off based on the state of the TRVs? To maintain distinct temperatures in different zones’ TRVs

Re:I Built a Smart Thermostat by nom on Wednesday December 16, 2020 @03:53AM (#25440377)
If your regulator valves close completely when target temp is reached, this should work:

- Set target temp for each room.

- Implement 2-step control using min(current_temps[]) and max(current_temps[])

So basically:

- if any room is below set_temp - X degrees, turn on

- if any room is above set_temp + Y degrees, turn off

Log and plot the temperatures, you should see some kind of sawtooth wave that flattens at the peaks due to the valves closing. Adjust the X/Y values to start/stop heating earlier or later to reduce the temperature variance.

Re:I Built a Smart Thermostat by tW4r on Wednesday December 16, 2020 @07:50AM (#25441910)
Thanks a ton! I'll try it out, maybe even do a write up if I succeed
Re:I Built a Smart Thermostat by froh on Wednesday December 16, 2020 @02:23AM (#25439958)
It seems like the PID can be used to control the bang bang intervals?
Re:I Built a Smart Thermostat by rckoepke on Wednesday December 16, 2020 @06:13AM (#25441278)
Absolutely - I've done this in industrial facilities and it's very common with LED's where it's generally called PWM (Pulse Width Modulation). Somewhat obviously, you'd generally use a "hidden layer" converting the % output of the PID algorithm to % duty cycle.

This works if your device can have a short enough cycle time for the PID algorithm to receive reasonable response feedback to its output. Ideally for PID to duty cycle conversions, your system should be low frequency (large "inertia") and the physical actuator/device you're controlling should have a high frequency (able to turn on/off rapidly, as LED's can with PWM).

The difficulty for home HVAC is that you'd like to start/stop it as rarely as possible to extend the life of the motors. The cycle frequency ends up being in the same order of magnitude relative to the frequency that the house heats and cools.

Obviously you can tune these things until the cows come home, and eventually you'll probably find some good settings. In reality, most people/installers/technicians will improperly tune a PID loop, especially if it converts to % duty cycle.

Hysteresis will almost always work better for home HVAC.

Alternatively, you can install (somewhat expensive) variable speed AC units and then happily use PID. You'll probably save a bit of energy and be more comfortable overall with more precise management of not only temperature, but also humidity.

Re:I Built a Smart Thermostat by froh on Saturday December 19, 2020 @08:03AM (#25477166)
TIL, thank you:-)
Re:I Built a Smart Thermostat by m463 on Wednesday December 16, 2020 @03:02AM (#25440153)
and now I have two more magic words :)

(btw I wasn't saying PID is what this situation needs, I meant that knowing that term unlocked a whole lot of interesting history and applications and more)