Web-Enabled Home Thermostat

Web-Enabled Home Thermostat

This Instructable explains how I built WiFi enabled thermostats for my home. The thermostats are programmable with 6 different time periods during the day, although increasing that to any arbitrary number would be fairly trivial. They can be programmed (in the sense of setting times and temperatures) as well as controlled over the internet, and they have a touchscreen LCD display for local control as well. And, I spent (and continue to spend) a fair amount of time trying to get them to look decent; after all, this is something that hangs on my wall, and I and my family will be seeing it every day.

One obvious question is “why would anyone want to do this when there are plenty of WiFi-enabled thermostats for sale commercially?” One possible answer would be to save money. But, while it is true that these might cost less to build than some commercial models, once you factor in your time, this becomes a bad answer! Better answers would be to have fun doing it (I did), or to build a thermostat that you can program to run and interact with other devices in any way desired. I built these as part of a larger home energy management system, and perhaps I’ll post another Instructable on that later. And as a bonus: the hub for the thermostats is ready to go as a hub for a complete home automation system!

A second obvious question is what sort of formal qualifications or relevant experience do I have in this area, and the answer is absolutely none – no background with HVAC systems, no background in programming, no background in electronics. So, if you decide to build your own thermostats, you should NOT just blindly copy exactly what I have here and hook it up to your wall. This project requires precise, analytic thinking, and you must understand the type of HVAC system you have, review and modify all code and circuits as appropriate, and make sure you understand what you’re doing and the consequences of getting it wrong. Failure to do so could destroy your HVAC system, electrocute your loved ones, or burn down your house. Seriously! I certainly welcome feedback from anyone who does have knowledge in these areas as to how I could make these thermostats better.

And of course, I could not have done this without all of the hard work from the folks who created the various libraries used, the people who took the time to put information out on the web in Instructables, forums, and blogs, and the many people who helped me out with advice and answers to my questions. Special thanks to Mark Pendrith who was especially helpful and gave me the code that forms the foundation of the arduino sketch.

Finally, in the process of modifying files to work with just the thermostats (as opposed to the larger home energy management system) as well as remembering everything I did over time to get this to work, there will undoubtedly be some errors in here. Please let me know if you catch any and I’ll try to get them corrected as quickly as possible.

With all of that out of the way, here’s what I did:

The system uses a Raspberry Pi as a central hub that serves web pages so I can control the thermostats from anywhere. The hub also handles all of the wireless communication over nRF24L01+ radio modules (I know I said “WiFi,” and the nRF24L01+ radio module isn’t technically WiFi, but more on that later), and maintains a MySQL database with the thermostat programming as well as any data logging I do. And finally, the hub runs two servers written in Python – one controls the thermostat (as an intermediary between the web-page and the thermostat) and the other handles data logging. I believe this could probably be done with the thermostats each serving its own simple web-page and sending data directly to the MySQL database. This would eliminate the need for the lighttpd web-server and the two python servers. But, I feel like doing this on the hub does provide the simplicity of a single web-site, and the python servers provide a lot of flexibility. Plus I don’t have to update the code on the thermostats whenever I want to make changes to these aspects.

If you really dig into this, you’ll probably wonder why I bother with a MySQL database instead of just writing a little data to a text file when necessary. The primary answer is that I need the MySQL database for other parts of my system, but if all I had were the thermostats, it might be fairly easy just to eliminate the database and replace it with text files.

For more detail: Web-Enabled Home Thermostat


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top