Raspberry Pi Thermostat Part 3: Software Release

Raspberry Pi Home Automation Termostate Software

(I found this article at The Nooganeer and publish it here with his permission)

I’ve finally found the time to release my software.  However… I am extraordinarily busy with Georgia Tech’s OMSCS program, so I will not have time for now to write a tutorial on using the source code.  This is my very first web development project.  Since its inception I have already learned enough to know that there are some things that could be done better–it is my goal to improve the code as I have time.

If you are an experienced web developer, you will most likely laugh at what you see.  Rather than be hateful, please feel free to fork the repo, make my idea better, and submit a pull request.

Whether you are a web developer or not, rest assured that this code base has been running my thermostat for 3 months at the date of this post with exactly zero failures.


To begin, the software consists of four major components which will run on 3 separate pieces of hardware.
  • MySQL Database — Runs on the web server but could run on separate machine
    • The whole system is driven by the database, which should make it easy to expand control methods beyond just the web application.
    • Contains sensor data and HVAC status logs
  • Flask Web App — Runs on web server
    • Displays statuses and plots data from database
    • Allows user to manipulate the state of the thermostat
    • Contains url scheme to add sensor data to the MySQL database when GET request is received from a Spark Core
  • Thermostat Control Daemon — Runs on Raspberry Pi
    • Controls the HVAC system itself and updates the system status on the MySQL database
    • Also acts as a temperature sensor and inserts data into the database
  • Remote Sensor Daemon — Runs on Spark Core
    • Reads data from DALLAS TEMP SENSOR, and sends a GET request containing the sensor ID and temperature reading to the Flask app.

Eventually, I will create posts for how to set up each piece of hardware, but for now, you’re stuck with the README files in the Bitbucket repos.

Feel free to contact me with any troubles you have and I will try to assist you. Eventually I may have some real issue tracking set up.

Raspberry Pi Thermostat Part 2: Hardware Overview

Raspberry Pi Home Automation Thermostate  HardwareCover

(I found this article at The Nooganeer and publish it here with his permission)


 Hardware “BOM”

  • Raspberry Pi with 1000mA Power Supply and Wifi Dongle
    • All pure “thermostat” logic runs on the Pi
  • Makeatronics Solid State Relay Board (More on this later)
    • Allows the Pi to switch the 24v AC signals for the HVAC system
    • I found that a 330Ω resistor behaves better in place of the 560Ω resistors.  Possibly because for my heatpump system, I sometimes have to drive all three circuits at once.
  • iPhone 4 and 3D printed wall dock (optional)
    • Mounts in place of the old thermostat to allow for “normal” interaction with the thermostat (for guests, etc.)
  • Spark Core Wifi enabled microcontroller (optional)
    • Remote wireless sensors
  • DS18B20 One-Wire temperature sensor (at least one, but the more the better!)
    • Pair one with your Pi, and then one per Spark Core.
    • I got the enclosed waterproof type which was probably unnecessary
  • Web Server
    • I used an old computer to host the web app and MySQL database locally, but it should work just as well on a cloud server
  • Wall Access Panel
    • Due to my Mechanical Engineerness, my electronics hardware work should be hidden from the light of day.
  • Jumper wires, resistors, etc.

Continue reading Raspberry Pi Thermostat Part 2: Hardware Overview