Based on the thermostat prototype boards I made, I decided it was time to integrate them. I have this Texas Instruments Digital Thermostat from 1979 that I bought new in box from ebay for like $40. It worked alright for a while but stopped and I couldn’t figure out why. I sent it to Sean Riddle for decapping and he took it apart, optically read the rom, and now it’s in mame! I scanned the PCB so people who want to complete the mame driver can trace the circuitry.
I decided to recreate this as an IoT thermostat, and I had some requirements:
- Use the original case
- Use the original display and switches
- Use and ESP32 WROVER for the additional ram
- do not use serial or jtag lines for anything else
- powered from the 24vac from the furnace
- solid state switching
- hardware lockout to prevent software glitches running the furnace and AC at the same time
- temp and humidity sensor
- humidity control connection
Some of these things I’ve implemented before, some this was the first shot at it. I had done a WROVER dev board before, I had done a max7219 led driver before, but the rest was new. There were some issues, but I’ll start with the solid state switching.
I stole the circuit for the solid state switching from here. He used a different package triac, but mine have worked just fine. This circuit has a fixed design for the 7400 lockout stuff. The fan and humidity circuits have un-needed gates in the circuit, but having at least one buffers the IO from the esp32 and this is replicating the fix I did on the board after my original design fault. I had fan and humidity tied to the ‘enable’ circuit, but that meant you couldn’t run the fan alone. You can see that IO4 enables either heat or cool and IO19 switches between heat and cool. I also had previously used IO16 and 17 which are not usable with the extra ram on the WROVER module, I had to jumper around those. I have LEDs tied to the triac drivers so you can see when the esp is controlling the triac since ther’s no click.
This is the standard LED driver schematic, but I paired it with the pinout for the bubble display on the thermostat.
OK, this one was a complete wild card. I picked a switching regulator basically at random and built the circuit that goes with it. I went to use the recommended parts but the inductor they chose was way too big so I found one of the same inductance but a much smaller size. It probably has less current capacity, worse properties in other ways, but this circuit was a bonus. If it worked, great, if not I’d run 5vdc to the thermostat and call it good. Turns out it was fine.
In order to conserve pins I used a 74hc138 to scan the switches and buttons. This saved exactly 3 pins. I could have saved one more if I made S1 into an additional line like O5 on the ‘138, but using that switch as a totem pole driver for the IO worked out fine. If I gave up on JTAG debugging my design I could have omitted this part. It fit though, and it works fine… now. The part I had forgotten in my original design was those pull up resistors. The input pins I chose on the esp work as inputs but don’t have input pullups so I needed to add those externally… oops. All these problems aside, I was able to patch the board and get it working.
Label everything, silk is free. Add graphics for what connectors mean somewhere they won’t be obscured. Label switches so you can test the board without referring to the case. and don’t bother soldering the un-needed switch contacts. That would just make it harder to remove the switches if you need to salvage them for a new board revision. You can see that I didn’t leave a correct footprint for the capacitor, that’s ok, I just knew I could bend it over and it would fit alright. I also used the screw terminals upside down, there’s enough space for these like this in the thermostat housing and I wanted a quick disconnect for the thermostat.
Also, it totally works! I don’t have code for anything but exercising the inputs and outputs, but it should be trivial to write a simple bit of code to drive it. Writing code to handle the complex programming interface of the buttons is a bit more involved but I want to do that at some point. The project page on github is here, if you have one of these and want a board that can be easily modified to work, I have 4 left. The photo album of before and after modding it is here.