Old Thermostat Gets Smarts

A smart thermostat is nothing new. But making one built a decade or more ago takes a few tricks. If you want to upgrade your thermostat without replacing it, [geektechniquestudios] shares their solution using a Raspberry Pi Zero to smarten up that dumb controller.

The hardware is decidedly simple: just a Pi Zero and a pair of relays. The relays act as button presses to the old thermostat. The software, though, is decidedly complex. There’s a React server and a Redis database along with some other bits and pieces.

The project is a work in progress, so you’ll probably have to figure a bit out for yourself. Even better, there is room to contribute back. In fact, the project page has a wish list of additions including Google home integration, scheduled temperature changes, and a few others.

Fake button presses takes a bit of finesse on the software side. After all, the computer can jam a button many times faster than a human with a mechanical switch can, and that’s bound to confuse an old circuit, especially if it denounces the switches.

This project is relatively simple to some others we’ve seen. A Pi Zero is cheap, but we’ve seen similar projects done for even less. For example, a $5 Sonoff box can do the same job.

24 thoughts on “Old Thermostat Gets Smarts

    1. I’m not a PI user (but still read a little about SD corruption) nor a thermostat installer but I will be more scared about some logic glitch from the smart thermostat than other thing.

      – SD card won’t get a lot of write for the temperature, so it is unlikely the temperature will be corrupted.
      – If the SD card is currupted otherwise it is likely to end up with a kernel panic/PI unable to boot.
      – Just plan according to the default pin configuration so if the PI can’t boot it disable the smart feature. (Would need a manual override mode thought)
      – Add some external watchdog?
      – Add an override feature (either physical bypass the PI or/and bypass ignore any temperature changes while away)

      Then you can mitigate the SD corruption:
      – SD in read-only (+ a better external medium)
      – SD mostly in read

      By the look of the code, I would be more scary about an “ouf of sync” event; a button deboncing issue (behavior not matching the thermostat), power outrage when he is saving the new value (unlikely…), messing with limit values. (The thermostat will cap at some value which his code need to handle as well),…

      At least on such DIY system you have more control, this is not like some cloud based system when it can stop working because you don’t have internet/servers are down/hacker find a way to control your thermostat (what is security?)

  1. “The hardware is decidedly simple: just a Pi Zero and a pair of relays” so just a few millions of transistors and condensators, an UNIX based full-featured operating system with layers and layers of abstraction(…)

    What a waste. It´s not even reliable nor maintenable because of the SD card, and all those software layers.

    An textbook example of what should not be done.

    1. It’s a good example of exactly how to do this safely. By keeping the existing hardware intact, he retains the safety features designed into the original device. For example, his original thermostat has limits: temperature set points are limited to values between X and Y, simultaneous button presses are handled, etc.

      In a worst case scenario where his SoC goes into a loop and continually presses the down button, this is behavior that the old thermostat already knows how to handle. Sure, his house may go up to 90F or down to 50F, but the existing limits prevent it from going so low that it freezes, or so high it burns his house down.

      His system may not be as reliable, but it is likely safer than some of the modern commercial offerings.

      1. The option to bridge switches with relays is a good one, but an ESP8266 as brains might have been a better solution. It needs less power, it’s cheaper and there is no risk of sdcard corruption.

        1. I think some of the commercial ones include similar devices to the ESP8266.
          I know our Drayton heating timer has an atmel/microchip ‘328 inside it (when the old one blew, I took it apart). The board got accidentally thrown in with a load of other things at the local waste recycling plant before I could try pulling the firmware off of it, not that it would be particularly complicated for a timing controller.
          Raspberry pis for a thermostat are overkill. You can add a TFT (with touch, even) to a AVR or ESP. A couple of MOSFETs, or a couple of SSRs added to that and you’re sorted.

          Linux, systemd and Apache/Lighttpd/Nginx, Python/PHP/JS/insert language of choice on top of it is overcomplicating things.
          The Raspi is a brilliant hobbiest and prototyping platform, and has its place, but it also gets abused and bunged into places it really shouldn’t be.
          As others have mentioned, the SD corruption problem kinda hampers things too, unless you make the root fs read only.

  2. How the heck do I know that I’ll want the thermostat set to 63.127 degrees at 2:15 AM a week from next Tuesday?? I just want dumb sensors. I have a ‘smart’ thermostat. Never figured out how to set the stupid thing. I leave it in manual mode. I can fairly reliably switch it from heat to cool and bump the temperature up or down a degree. If somebody switches it to programmed mode it will take me a week to get it back to some sort of functional state. Same goes for smart bulbs. I want on and off. That’s all. Been in my house 15 years and there are still a dozen wall switches which control nothing as best as I can figure and several lights which can’t be turned on with any possible switch combination.

    1. ” I want on and off” Hear, hear!

      It took me a while to turn my “smart” thermostat into a simple brain dead clock thermostat. Now it no longer “learns” how long it takes to get the living room to the correct temperature, and it no longer starts heating the room up to 22 Celsius at 02:00 in the morning. (it takes just a few minutes, from 18C to 22C)

    2. Spot on Bob! I’m a reasonably clever chap – Phd and so on, but I despair at the complexity foisted on us to control the essentials – heat, light, security, food supply/preparation. I do not want to spend my time fault finding a heater on/off function.

      1. Sorry, accidentally reported. I agree with “Pete”! I’d never thought of it before in relation to “complexity to control the essentials,” I’ll use that next time I’m trying to explain why I hate apps and IOT instead of simple mechanical controls.

  3. During the last covid lock-down, did a reliability analysis per SR332 and MH217 and IEEE1633 on my HVAC controllers (yes, I was very bored). It did correctly identify the vent controllers as the least reliable. As master control was a Linux box, the obvious and glaring weakness was the OS.

    Went from digital to analog vent control, and a Teensy 3.5 (PJRC.com) as the ‘master’ furnace and AC controller. No problems for six months (as compared to about one glitch every other month for previous year).

    Complexity is the enemy of reliability.

  4. 13 years ago i scattered temperature sensors around the house, just an LM35 (linear voltage sensor) with a PIC12 to connect it to a simple 4-wire serial network. i went ahead and put together one of my PIC12 boards with the PIC controlling a relay instead of a temperature sensor. the relay was connected directly to the furnace, in parallel with the existing mercury switch thermostat, so i wouldn’t get frozen pipes or whatever if the computer crashed. made a little expression language to go in my thermal-logging daemon to control the switch. also added a switch type for controlling X10 devices, to turn the window fans on and off in the summer.

    for reasons i never could figure out, the PIC12 hooked up to a relay kept failing. it wasn’t driving it directly, it drove an NPN 2N2222. it was a tiny relay, coil current around 1ma. i included the bypass diode so the coil wouldn’t eat everything around it. never figured out what the problem was, rebuilt the board a couple times before i gave up. i imagine that’s a testament to my own ignorance…

    the X10 stuff was its own nightmare, because various laptop power bricks around the house would interfere with X10. and the little plug boxes would die on their own over time. tried insteon but it had all of the same flaws, plus the boxes got *hot* even when they were not in use. eventually i realized, it doesn’t make a difference, finding the exact instant in the evening to turn on the fans isn’t any better than just doing it when you feel like it. getting those last few minutes out of the morning where outside temperature is still negligibly lower than inside temp…whatever.

    a couple years ago i finally removed the expression language from my temperature logging daemon.

    switched to a different kind of furnace (to hydronic) and now i have the cheapest digital thermostat, and my only complaint with it is that it has an AAA battery instead of stealing microamps from the furnace control signal. *shrug*

    there’s just nothing like simplicity

  5. “A smart thermostat is nothing new. But making one built a decade or more ago takes a few tricks.” I think you’re missing a couple words. Do you mean upgrading one? Making it smart?

Leave a Reply to AnonymouseCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.