A Smarter Thermostat – Part 1


A few years back, I made a conscious effort to be “greener”. Maybe it was getting a little older (let’s call it “mature”) or it could have been all the yoga I was doing (yes, I’m a yogi, it’s true…) but something in me changed and I decided to do my part to use less and hopefully make things better on this planet. Using less can also mean saving money, and I really like that part of it too! So for the last few years, I have driven a fuel efficient, low emissions vehicle, I’ve systematically removed all the incandescent lights in the house, and I’ve installed smart thermostats. This has really helped us to use less energy and save money in the process.

There’s a small problem with the thermostats though. Even with the smart thermostats, the temperature in the house varies significantly from one part to another because they only sense the temperature in one place. The kitchen is near the thermostat, so it is the boss of the temperature in the house, meaning the bedrooms are always cooler, and many times, too cold. In the summer, the heat from cooking, etc., results in the thermostat running the A/C, keeping the kitchen comfortable, but cooling the bedrooms down too much. In winter, the heat from cooking, etc., results in the thermostat thinking the temperature is warm enough, so the heat doesn’t run, also resulting in cold bedrooms. BTW, I don’t like to be cold when I sleep.

The engineer part of me got to thinking about this problem. The temperature variations cause us to frequently adjust the thermostat, usually resulting in more energy consumption. Part of the house is too warm, and part is too cool, but the thermostat isn’t smart enough to solve the problem. We need a smarter thermostat! It needs to somehow recognize the conditions in the house, work to better equalize the temperature (maybe just cycling the fan periodically?) and set limits on the temperatures that the two areas of the house would see. Oh, and all this needs to be time based and occupancy based. A setback temperature is fine while no one is home…

Enter the Raspberry Pi… A few months ago, I decided to try to build a Smarter Thermostat using a Raspberry Pi as the brains. It would need to recognize multiple temperature zones, get weather forecasts, outdoor temperature and humidity, and anticipate how to schedule the HVAC system for comfort and energy efficiency. No problem, right? Just need a little software…

Anyway, fast forward to the present for my Smarter Thermostat Project Status:

  • Preliminary requirements defined √
  • Raspberry Pi and touchscreen LCD integrated in a case √
  • Temperature sensor integrated √
  • 24VAC power supply designed and tested with my HVAC system √
  • Relay board integrated and tested √
  • Battery backup supply assembled and tested √

What’s in work but not finished?

  • Integration of the battery backup supply
  • Completion of the remote wireless temperature sensor (mostly programming to do now)
  • Integration and installation of an IR motion sensor (waiting on the sensor to arrive)
  • Completion of the software development

Now, for a guided tour of the hardware:

Here the case is opened with the LCD touchscreen being supported by a wire stand. Visible in the center is the board stack consisting of the touchscreen controller, Raspberry Pi, and the power supply/interface board. In the back of the case, you can see the blue relay board.


This photo shows the top view from a different angle, making the board stack a little easier to see.



The next photo shows the case from the rear. There is a large round hole for the HVAC wiring to enter, and a metal bracket attached with slotted mounting holes for attaching the thermostat to the wall or to a junction box. The cable entering the hole is used for power during development. The box is fairly thick – not bad for a prototype, but way too thick for a production device.


I’m really pleased with the LCD and touchscreen. It is very well integrated in the more recent versions of the Raspbian operating system. This is the view of the Pi and LCD controller with the power supply board removed, looking from the back side. The USB dongles are for Bluetooth and Wifi.


This is the power supply/interface board. It was designed to easily detach from the Pi for troubleshooting and development. I used a full wave bridge to rectify the 24VAC that comes from the HVAC unit. After filtering, it provides about 37 Vdc. The 24VAC is nominal, so with a light load, you get a bit more voltage than that.  The 37 Vdc is then regulated down to 5 Vdc using a COTS buck converter module I bought from Amazon.  I could buy the finished module for much less than I could buy the parts. The terminal strips were added to make it easier to test, and reconfigure if needed. All of the I/O is routed through this board to the harmonica connector on the bottom.


This is the back of the power supply module. You can see the harmonica connector that attaches it to the Pi GPIO connector. You can also see the fuse enclosed in tubing. The two large cylinders are the filter caps.


This photo shows the power supply/interface plugged into the GPIO connector on the Pi. The white block on the case in the background is a temperature and humidity sensor.


Finally, this is a view of the display running a test program to exercise the relays. The enable is an output that must be initialized and set high to provide power to the control circuit of the relay board. This will prevent transient activation of the HVAC control relays while the system is booting up and shutting down.


I hope you enjoy this little tour of my first Internet of Things (IoT) project. I’ve learned a lot about the Pi along the way and I plan to share more in future posts. Happy making!

Leave a Comment