Close
0%
0%

Old thermostat learns new tricks

Hacking my home's classic ON/OFF wall thermostat, right into 2020

Similar projects worth following
I hacked open this Honeywell T87G1006 stand-alone digital ON/OFF thermostat to add a microcontroller and make it communicate with the world.

The firmware connects it to the smart home setup and reports its set temperature by reading the changes from the the knob, a quadrature encoder. It also simulates knob movements to keep everything synchronized with Home Assistant and Alexa.

This project is only for the thermostat modification / interface. For the actual heating PID and modulation control, see my other project: OpenTherm interface:
https://hackaday.io/project/170821-opentherm-interface

The stowaway microcontroller is also able to fool the thermostat into changing its set point to any temperature, by faking the encoder sequences as if the knob was being rotated. 


The updates are received with Node-RED which serves as glue to tell Home-Assistant that the set point has changed. It also integrates with Alexa and keeps all three things in sync.

Honeywell nowadays sells a WiFi enabled thermostat very similar to this decade-old one, but:

  • This one works when the cloud doesn't.
  • I rent this place so I want this hack to be reversible.
  • The smart version is quite expensive.
  • ... What's the fun of that???

The original hardware:

The original thermostat is quite clever. It does not use batteries or dedicated power lines, it uses a charge pump to "steal" 5 volts from the boiler's normal open-contact connection. It does repeatedly this for only a few milliseconds at a time, but enough to power the thermostat, CPU and LCD, and never draining enough current for the boiler to detect a closed contact (or to detect it open when it's operating). It stores the stolen angry pixies in a 5.5 volt .25 F supercapacitor. Very clever!

This is the original input configuration for each of switches that form the quadrature encoder:

Note the absence of an external pull-up resistor, not that that's very uncommon these days in consumer electronics but certainly helps not to have these in this very low power device.

Both switches you see top and bottom of the PCB are actuated by levers which are pushed or released by this outer plastic ring:


The outermost race is just  detents, the inner ring has a "wave". It's s single race so what's 90 degress out of phase is the switches in this case.

Detail of the switch under the lever when partially assembled (plastic ring missing):

The hardware mod:

For each of the switches, I added an in-series 1K resistor, and connected my microcontroller directly to the original Atmel CPU output. I figured out they'd never have those pins in low-Z, so it shouldn't be a problem.

I did this the ugly only way, cutting the existing PCB track with a knife, and soldering my resistor in the proper place wherever I could.

Reading the set point:

As you can see in the video, the latency is surprisingly low considering the amount of moving parts: ESP8266 > WiFi > Mosquitto > Node-RED > Home Assistant > WifFi > Frontend on Android chrome

One MQTT Message is sent with every encoder step. Admittedly that is a bit of an overkill as the message could be sent after a second of the value being stable, but this lets me brag about it.

The encoder is read using this Arduino library:
https://www.pjrc.com/teensy/td_libs_Encoder.html

I kind of regret not going the CLion/cmake way with this project. I wanted to give the Arduino IDE a try since this was  "a quick thing" and the Wemos board is directly supported; I can't help it but to be really disappointed with the IDE. No autocomplete and no refactoring tools in 2020? Feels like programming on Notepad.

Setting the set point:

Things get a bit more complicated now. To set the set point we need to switch the encoder pins to OUTPUT mode and drive away. However, the initial phase has to be the real one, and the end phase... too. This is because as soon as we release the pins by setting them to INPUT, if their state is different from the real switch state, the thermostat will register additional unwanted changes.


Fortunately for us, when the thermostat wheel is rotated past the minimum temperature of 5 degrees, it just ignores any further steps in that direction. We can exploit this to keep "rotating" the encoder past that limit, and then keep going until the phase mismatch counteracts the mismatch that our target set point would produce. After resetting to the minimum, we want a phase that "lags" as much as we would be ahead of the physical phase after applying our new set point.


Note that the thermostat goes...

Read more »

  • 1 × Wemos D1 Mini Pro Or similar MCU, for the RS-232 version, any MCU will do!
  • 1 × Honeywell Thermostat Or similar thermostat that uses a quadrature encoder
  • 1 × Rasperry Pi ...or anything else, really. To run Node-RED and Home-Assistant

  • Less is more

    Ivan Stepaniuk04/07/2020 at 00:31 0 comments

    I was about to close this project as done but I was annoyed at the fact that the thermostat was still reading just a bit over the room temperature because of the heat that the ESP generates.

    I gave the setup another thought and decided that it was better to cram a good old MAX232 instead of the WiFi-enabled mcu, I had 3 extra wires anyway and with a bit of effort, I can make them reach the Raspberry PI where Home Assistant and NodeRED are running. The encoder code stays the same, and I added some code to parse the serial input.

    Smells like 1980s

    I also switched to an STM32 generic board, I would probably find better uses for the ESP board. I will keep both versions of firmware on GitHub for reference.

    The heating is now working perfect with the much-more-colder STM32F103, right on time for spring when I don't need it.

  • Thermostat can be set

    Ivan Stepaniuk04/05/2020 at 00:38 0 comments


    I had 5 wires to work with from the boiler room to the thermostat box, the original clever thermostat only needed two. Sending power to the micro-controller without adding dissipated power that could disturb the thermometer was a bit challenging. 

    In the video, a last flight check before putting everything back together. You can see how the set point moves all the way  to minimum and then advances to the set point. Check the project details (or the Github code!) if you wanna know what's going on.

  • Space cake

    Ivan Stepaniuk04/02/2020 at 01:19 0 comments

    It was my birthday recently and I got a nice cake. It came on a piece of cardboard with a metallic golden finish. When I saw it it immediately reminded me of the heat shields they use in satellites.

    Nothing left of the cake
    This cake was not a lie

    Imagination aside, I decided I will add a circular piece of this material between the thermostat mount plate and the wall, to further isolate the heat from the microcontroller from affecting the thermostat.

    So far it seems to be working perfectly.

  • Things are heating up

    Ivan Stepaniuk04/01/2020 at 16:28 0 comments

    The ESP8266 dissipates enough heat to skew my thermostat reading by almost 2 degrees Celsius, which is no fun.

    I thought of beforehand and added a foam pad between the back of the thermostat and the Wemos board; this was however not enough.

    You can't really see the pad on the picture but if you look at the wires you can see that they are not flush with the back of the thermostat PCB. The yellow heatshrink tube on the left is a voltage regulator, but it does not generate comparable heat.

    The solution I am trying is to put the whole thing behind the wall mounting plate, so literally inside the wall (I have brick and mortar walls). For this to be a bit more maintainable, I soldered a connector to the thermostat.


    It's not a hack if you did not use the hot melt glue gun.

  • Status and TO-DO

    Ivan Stepaniuk03/31/2020 at 22:30 0 comments

    Simulating steps on a quadrature encoder that has a real encoder attached is a bit tricky. I will add some explanations here because I think that is the interesting part.

    This project is pretty much finished but I will add more data and videos. I am still figuring out the best way to use this site. The editor is really cumbersome, I wish this was markdown instead of this buggy HTML editor!

View all 5 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates