I Built a Smart Thermostat
medium.com
medium.com
Certainly an accurate observation, and what is typically known as hysteresis for those playing along at home.
I mention this because sometimes when you self-discover something, you struggle to identify the most common word to describe it, which can obscure lots of research and prior art about that thing.
Because applications of control theory are so practical and likely to be empirically observed, it’s probably pretty common to have observations like this.
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...
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.
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
- 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.
(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)
Don't know how easy that is on the AC/heating, but as far as the control system, it works, and it's PID.
PID is only effective with solid state switching devices, which are not really common for residential heating/cooling.
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.
The remote thermostats can only be averaged and not switched (eg Measure Bedroom at night, Living Room & Office during day)
There’s only 4 time blocks per day
There’s no adjustment of start time based on outside temp. In fact, no way to say: Be at 72 at 8am when I get up
There’s a ”quiet mode” to reduce speed (and noise) at night, but clearly this is on an internal timer. It will come on at 67% for up to a minute before the timed Quiet Mode Function notices and scales it back to the pre-set maximum. Sadly, I’m already awake by then.
(Also, the default values at install are wrong - they have Day and Night switched)
Since this is the smartest thermostat they do for this, can they at least open up the API so I can have a chance to get back the features I liked about my Ecobee?
For so much money, there is so little “smart”
I think I can use what APIs I have to implement the OP solution without mechanical switches, but I can not control the compressor speed directly for Quiet Mode to work
Or is it hard to keep things comfortable with the inputs you do have?
But there’s no way to tell the system - I want 72 at 8am, you work it out. So I need to see if tomorrow morning will be 30 or 50 outside and set the start time accordingly. That’s not smart.
Heat pumps aren’t great at large changes anyway, but even 68 to 70 or 72 would work for me
And I also want that inside temperature to be based on the rooms I expect to use at those times: Night time, bedroom. Daytime, living room. Ecobee has exactly this function, Trane/Nexia does not
I have a ground source heat pump and my understanding was to pretty set and forget unless you have multiple zones or are going to be away for a long period of time.
Reason being heat pumps have variable speed compressors and setting them back forces them into less efficient higher stages, and as you mention take a lot longer to recover compared to traditional heaters. If the system is sized right it should be running it should be running below max at a relatively stable power.
This would be a pretty reasonable approach in a building with high levels of insulation and efficient heating/cooling.
I don't think it'll let you use Quiet mode, but it will let you do all the other thing you're missing, and it'll be much simpler than building out everything yourself for sure.
Quiet Mode is clearly a checkbox festure they added for the city of Seattle noise ordinances (mentioned in the sales literature)
One benefit I did see in the manual, is that if the air handler was gas combined with a heat pump you can enter the price of electricity and the price of gas and it can compute which heating method is best: gas/heat pump/resistive (usually when heat pump cannot provide requested temperature). But I don't have gas.
ROMs are available for these systems distributed as hex files on Carriers website. So its been on my todo list to reverse engineer the software.
Someone with time combined with a Raspberry Pi + Raspberry Pi Display (around $80 USD) could build a much better thermostat than what Carrier has done.
Maybe the answer is to look at systems sold for business use.
What kind of third world shenanigans is this?
I had the parts I need 3D printed, partly because it looks a bit nicer and partly because I need to replace the knob with one that’s easier to attach a servo to, and so needed something with a D-shaft. Designing those parts made me learn more about gear measurements than I ever thought there was to know. Like the author I went with the DS18B20 1-Wire temperature sensor, mostly because it was the first thing that came up on Sparkfun, so I’m glad to hear it was a good choice.
I’m using an Arduino to drive the circuitry, sending the temperature and receiving control commands via serial over USB to my home server. This works pretty well (and allows for fancier logic than doing it all on the Arduino), but has the interesting result that when I’m compiling software the control program can get swapped out and my heat switches off (or rather, gets turned down to 55°F) until the thermostat daemon gets paged back in!
How fancy do you plan to go with the control logic?
In the long run, I have a bunch of ideas bouncing around in the back of my head that I might get around to eventually: the aforementioned geofencing, interfacing with an automatic alarm clock (also not built yet) to turn the heat on right before I get up, detecting when I go to bed rather than having a set schedule, determining my preferred temperature based on the weather (I think I mind the cold less when it’s raining), running the ceiling fan (in the summer, and maybe also to pull heat down from the loft in the winter), and so on. No idea if I’ll actually do any of them, but the option is there.
It seems like they might mean it doesn't control the air temperature of the HVAC, but that isn't what it is supposed to do, it's the thermostat.
If they mean it's broken, well there you go.
> The temperature dial doesn’t work, the building controls whether its heating or cooling time.
> The fluid temperature is out of our control since the building adjusts it based on the outside temperature.
It doesn't sound like the device they have available is actually a proper thermostat- rather, it's just a control device for a water heater + radiator + fan. The switch adjusts how fast air is blowing over the radiator, and the dial is supposed to adjust the temperature of the fluid in the radiator.
But if I understand correctly, the building sets their radiator fluid temperature for the whole building, and it sounds like the fan speed is apparently useless, so the only control the author has over their unit's temperature is whether or not the fan is on or off.
So, what they built is the actual thermostat, which mechanically actuates the on/off switch based on a temperature measurement.
The likely function of the dial is to set a temperature where the fan turns on and off.
http://www.pecomanufacturing.com/controls/hvac-thermostats/T...
The dial is a thermostat that reads room temperature and turns the heat source on and off accordingly.
It's also a bit sad how hard it seems to be to get Google Home to be able to control custom gadgets.
And combining Python scripts with a Spring Boot webapp - why? Seems like a good application for Flask. Why use 2 languages when 1 can do the job?
I was surprised at how difficult Google Home integration it was yes.
I see what you're saying. I honestly used Spring Boot just cause I'm really comfortable with it and can get something going quickly. It later on worked well for the Google Home stuff since they have examples and docs in Java/Kotlin. It also doesn't look like they have Python support.
This can cause trouble
Ecobee (probably others) provides a Doo-dad that wites into the furnace to help make this work
There are adapters you can use to work around the lack of wires. The existing wires already include power, it's the ground that's missing.
The existing 4 wires to a standard dumb thermostat are:
Power
heat
A/C
fan
The functions are enabled by connecting power to whichever is required. But there is a missing "C" (common) wire. So, as you discovered, smart thermostats have no easy way to also power themselves.
I was lucky when I added my smart thermostat. It turned out that my 20 y/o house already had an 8 wire cable preinstalled.
For people stuck with 4 wires, there are adapters available that will multiplex two control signals onto one existing wire. This lets you free up another of the existing wires to become the needed fifth C wire.
Here's one setup I found with a quick search. There's even a video. This adapter requires access to both ends, viz. the thermostat and the furnace.
https://smartthermostatguide.com/c-wire-venstar-add-a-wire-a...
https://www.secretbatcave.co.uk/house/raspberry-pi-powered-t...
However its all reversible