Yun Thermostat

For full documentation visit YunThermostat at rtfd.

What is it?

YANATP, or Yet ANother Arduino Thermostat Project.

Why is this one different?

  • It uses Python
  • It uses Wifi
  • It doesn't use a database
  • It doesn't require the Internet


Geez, I dunno, two of us got together and wanted to toy around with an Arduino Thermostat, but we didn't find anything that detailed, or exactly what we wanted. So we decided it'd be fun to write one from scratch.

Screen shots

From a Mobile Phone:

Image of the real-time graph (24 hour view) from the web page. Real Time Graph

From a Computer (These pages are also available from a phone):

Image of the configuration page. Config Page LT

More of the configuration page. Config Page LT

Real time logging. Logs on LT


The minimum hardware is:

  1. A temperature sensor
  2. A relay (the easiest is to find a premade relay "board" on amazon). Three for heat plus A/C.
  3. An Arduino Yun

Additionally, we both happen to have a LCD display shield with buttons, so that's also integrated.

The software is:

  1. The Arduino software (with support for the Yun)
  2. Python
  3. Bottle, a very light weight python web server
  4. JQuery (1.7.2), JQuery Mobile (1.4.5), and JQuery Flot (0.8.3). Open source Java Script tools

The cloud services in use are:


Project layout

# Everything that goes onto the Linux side of the Yun
    javascript/             # Where to put the javascript includes
    scripts/                # helper scripts for running automatically on the
                            # Yun
    static/                 # Any web items that are version controlled but
                            # don't ever change
    thermostat/             # The main python library for the thermostat      # Utilities to drive outgoing emails         # a settings store for the thermostat    # python logging.Handler that supports sending
                            # logs to a live web page       # The main logic for the python Thermostat              # Web interface (Bottle interface) for the
                            # thermostat.
    views/                  # Folder that contains templates for the bottle
                            # web interface.
        forms.tpl           # Javascript to handle the configuration page
        index.tpl           # The web interface html
        updater.tpl         # Javascript to handle updating the web interface
                            # with data from python.
    settings.json           # Storage for your settings (not committed to
                            # git).        # Main app to launch the thermostat.

# Arduino files    
Config.h        # Configuration for the Arduino.
Control.h       # Temperature Control
Display.h       # LCD & Keypad Control
Sensor.h        # Temperature sensor interface
thermostat.ino  # Main arduino sketch
Util.h          # File to store misc. helping functions.
Web.h           # Interface to the REST api from the arduino.

# Documentation    
mkdocs.yml      # The documentation configuration file.
docs/           # Other markdown pages, images and other files.    # This document.       # links to
LICENSE         # License