News for hackers. Stuff that matters.
Re:I Built a Smart Thermostat by m463 on Tuesday December 15, 2020 @11:28PM (#25439056)
> you struggle to identify the most common word to describe it

In case of temperature control, the magic word (acronym) was "PID" which I learned from a friend who set up an open-source bbq controller:

https://www.raspberrypi.org/blog/heatermeter-open-source-bar...

https://en.wikipedia.org/wiki/PID_controller

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)

Re:I Built a Smart Thermostat by lmilcin on Wednesday December 16, 2020 @05:31AM (#25441004)
PID is very simple control loop that will show over/undershoot every time there is external change (for example somebody opens a window) and will take a long time to settle when disturbed.

I would use a simple model of the room (as a thermal mass with three components -- heater, air and walls -- that heat up / cool down / exchange energy at different rates).

Then I would run moving horizon estimator to predict future effect of turning on/off the heating system (for example, if I turn it off now, what will be the final temperature before it starts to drop again?)

Then you include Kalman filters to discover basic parameters of the model and then update them as system change (for example external temperature changes) so that predictions of the model are accurate.

You can even monitor the parameters of the model and response of the system and recognize different situations like open doors, windows, etc.

For example, I have made similar for my dumb espresso machine and by monitoring parameters of the model I can detect boiler scale buildup and then I can detect whether I have cleaned all scale from the boiler or there is still some of it left. It is all very simple because there are two parameters of the system: thermal mass and delay from when the heater is engaged to when the water has reached its temperature. By detecting that thermal mass has decreased and that the delay has increased it can automatically tell there is scale buildup.

Re:I Built a Smart Thermostat by dokem on Wednesday December 16, 2020 @12:21AM (#25439369)
You are still talking about different systems dispute them both having to do with temperature. An AC unit can only be on or off, so you need a window, hysteresis, to keep from toggling on and off constantly. If you can input an analog signal, like control how much power goes into the heating coil in a BBQ, the PID is applicable. PID, if tuned properly, will find the right amount of power to feed the heating element to keep the oven at the desired temperature. This is not possible if you can only turn the AC on/off with significant lag, so you need hystereiys.
Re:I Built a Smart Thermostat by lucianbr on Wednesday December 16, 2020 @01:28AM (#25439704)
PID can be used with an on/off control, you do something like PWM: on X minutes out of every hour, and vary the X as the analog parameter.

Don't know how easy that is on the AC/heating, but as far as the control system, it works, and it's PID.

Re:I Built a Smart Thermostat by conk on Wednesday December 16, 2020 @01:47AM (#25439804)
PID can’t be used for control of any device that uses a relay. PWM will have the effect of just changing the coil voltage. Even if you could switch a relay on/off quickly you’d just prematurely burn out the contacts.

PID is only effective with solid state switching devices, which are not really common for residential heating/cooling.

Re:I Built a Smart Thermostat by lsorber on Wednesday December 16, 2020 @01:31AM (#25439724)
Did you even need the D, wouldn't a PI controller be sufficient?
Re:I Built a Smart Thermostat by harperlee on Wednesday December 16, 2020 @02:52AM (#25440096)
The point is that once you know the word PID you can read about the concept and reach conclusions such as yours.
Re:I Built a Smart Thermostat by tga on Wednesday December 16, 2020 @04:17AM (#25440508)
The article project is already using a Pi controller.