HomeKit connected smart thermostat based on Arduino using HomeSpan.

Overview

HomeSpan Thermostat

HomeKit connected smart thermostat based on Arduino using HomeSpan.

Background and Motivation

I have a 24 V Heat-only system with a 2-wire system (No C wire, only R and W). It used a manual Honeywell single-point thermostat. I wanted to get the functionalities of a HomeKit compatible smart thermostat without the hassle of installing a C wire myself and/or having to buy an expensive smart thermostat. So I created my own with a Wi-Fi capable microcontroller.

Hardware

I used a Adafruit ESP32-S2 Feather board, along with a TMP36 analog temperature sensor, and a simple non-latching relay.

I wired up the TMP36 to an analog input pin (A5 i.e 8) and the relay to a digital pin (10), and connected the relay to the R and W wires in my heating panel in the NO mode i.e when the relay is off, the heater is also off. The circuit diagram is given below.

This image shows how the components are wired to the microcontroller board.

Flashing the Code on the Microcontroller

Use the Arduino IDE to flash the code to the microcontroller. You could also do it using arduino-cli in either serial mode or OTA mode.

cd path/to/homespan_thermostat
arduino-cli compile -b esp32:esp32:adafruit_feather_esp32s2 --port PORT_PATH --protocol serial --upload

Or

cd path/to/homespan_thermostat
arduino-cli compile -b esp32:esp32:adafruit_feather_esp32s2 --port BOARD_IP --protocol network --upload

The latter will promt you for the OTA password. The default OTA password for HomeSpan is homespan-ota. It is recommended that you change it in the source code (see below) or using the O command of the HomeSpan CLI.

Configuration and Usage

There are a few parameters that need to be configured.

  • The Wi-Fi credentials can be defined in the source code as the macros WIFI_SSDI and WIFI_PASSWORD or can be set using the W command of the HomeSpan CLI.
  • The HomeKit pairing code can be defined in the source code as the macro HOMEKIT_PAIRING_CODE. Otherwise the default code 466-37-726 is used or it can be set using the S command of the HomeSpan CLI.
  • The HomeKit QR Setup ID can be defined in the source code as the macro HOMEKIT_PAIRING_QR_ID. Otherwise the default QR Setup ID HSPN is used or it can be set using the Q command of the HomeSpan CLI.
  • The OTA Password can be defined in the source code as the macro DEFAULT_OTA_PASSWORD. Otherwise the default password homespan-ota is used or it can be set using the O command of the HomeSpan CLI.

Pair the accessory to HomeKit. The general instructions are given here. That's pretty much it.

For my particular heating setup, I have enabled two heating modes: Heating, and Auto. Heating mode allows you to set a single Target Temperature which the thermostat will try to maintain. However, depending on how well insulated your home is, and how cold it is outside, it can lead to the heater turning on and off frequently consuming a lot of energy. Auto mode fixes that by allowing you to set two temperatures, a Heating Threshold and a Cooling Threshold. In this mode, the thermostat will only turn on if the temperature reaches below the Heating Threshold, and will provide heat until the Cooling Threshold is reached. This allows the heater to be on for a longer period of time, but also be turned off for a longer periods of time, which is more energy efficient than being turned on in bursts.

If you're connected to HomeKit, you should be able to control your heater using Siri.

This image shows how the this thermostat looks in the Home app.

You might also like...
FFF is a decentralized blockchain based on IPFS/RIPPLE, which integrates lua virtual machine-based smart contracts.
FFF is a decentralized blockchain based on IPFS/RIPPLE, which integrates lua virtual machine-based smart contracts.

FFF is a decentralized blockchain based on IPFS/RIPPLE, which integrates lua virtual machine-based smart contracts. It is also a software platform designed to help coordinate voluntary free market operations amongst a set of social actors.

A smart automatic pet feeder based on OM2M
A smart automatic pet feeder based on OM2M

🚀 A Smart Automatic Pet Feeder Based on OM2M WEB 😺 Pet 👑 Core functions At present, the system can automatically generate text boxes, drop-down box

Let's upgrade cheap off-the-shelf robotic mowers to modern, smart RTK GPS based lawn mowing robots!
Let's upgrade cheap off-the-shelf robotic mowers to modern, smart RTK GPS based lawn mowing robots!

OpenMower Join the Discord server for OpenMower discussion: HERE About the Project ⚠️ DISCLAIMER: IF YOU ARE NOT 100% SURE WHAT YOU ARE DOING, PLEASE

A Fingerprint Door Lock using a microprocessor named Arduino UNO and programming through Arduino IDE
A Fingerprint Door Lock using a microprocessor named Arduino UNO and programming through Arduino IDE

INSTRUCTIONS - The codes for the Fingerprint Door lock are present in the Code For Fingerprint Door Lock folder The instructions of how to operate the

Internet of things created using arduino IoT cloud, consisting of esp and arduino boards

Internet of things created using arduino IoT cloud, consisting of esp and arduino boards. Goal of the project is to create a 3D printed RFID protected (with PIN) lock, including surveillance.

AnalogWrite for ESP32 and ESP32-S2 with LEDC PWM. Includes PWM Phase Control, DAC and Smart GPIO resource management.
AnalogWrite for ESP32 and ESP32-S2 with LEDC PWM. Includes PWM Phase Control, DAC and Smart GPIO resource management.

analogWrite() ESP32 Installation Instructions This library was tested using using the ESP32 Arduino IDE Boards Manager installation method. Stable rel

Info & tools for reverse engineering the M6 smart fitness band
Info & tools for reverse engineering the M6 smart fitness band

m6-reveng This repo contains information and tools for reverse engineering the $7 M6 smart fitness band. Hardware The SoC (system-on-a-chip) is a Teli

PNPASSIST: A “SMART” BUILD PLATFORM FOR MANUAL PCB ASSEMBLY

PnPAssist Description The PnPAssist is an open source innovative CNC table that position the next SMT component with a proper orientation for you to m

DIY Smart Blinds controller for ESP8266

Window blinds to home assistant DIY window blinds controller software for ESP8266 (Wemos D1) to control existing window blinds using servos. The full

Owner
Shubham Chaudhary
PhD student at the Department of Computer Science at Cornell University.
Shubham Chaudhary
Physical Tic-Tac-Toe smart board with PvP mode and two levels of AI. Built atop a custom PCB connected to an Arduino Mega 2560.

TicTacToe_SmartBoard The files in TicTacToe_SmartBoard are based on the files in https://wiki.illinois.edu/wiki/display/ECE110HLSF15/Tic-Tac-Toe+Smart

Hyrum Dickinson 2 Dec 3, 2022
Dummy code for using an ESP32 as a lightbulb in Apples HomeKit.

ESP32 HomeKit Lightbulb A dummy implementation of a HomeKit lightbulb using the ESP HomeKit SDK by Espressif for the ESP32. Prerequisites PlatformIO U

Louis Meyer 2 Apr 27, 2022
Let any device connect to HomeKit.

homekit-bridge Introduction A HomeKit gateway specially designed for embedded devices, it allows you to connect non-HomeKit devices to HomeKit through

Zebin Wu 84 Dec 26, 2022
Control your older LG TV via HomeKit

LG TV Controller for HomeKit Flash to an M5Atom RS232 Kit, and add your LG TV to your HomeKit home. Should work with most other ESP32 kits as well. Qu

null 6 Sep 1, 2022
Smart door lock system using Arduino

Smart door lock system using Arduino จำลองระบบรักษาความปลอดภัยของบ้าน โดยการใส่รหัสผ่าน Keypad เมื่อใส่รหัสถูกจะผ่านประตูเข้ามาได้ ซึ่งใส่รหัสผิดได้ไม

null 1 Nov 6, 2021
Connected Santa Claus hat based on an ESP32, 8x8 matrices and LEDs stripped communicating over the internet with MQTT.

Protobonnet What is it? A connected Santa Claus hat! What is it called? Le ProtoBonnet! Why? This hat has been created entirely for the Noël des proto

Audrey Cigolotti 2 Dec 27, 2021
If the button pressed esp will reset and App mode will on. App mode will on then led will on, network is connected led will off.

DHT22-to-Google-sheet-Reset-Using-ESP8266-LED-Switch If button pressed esp will reset and App mode will on. App mode will on then led will on, network

Md. Harun-Or-Rashid 3 Aug 17, 2022
sc-ble-bridge is a utility that for every connected Steam Controller creates a virtual one acting as a bridge between SC and Steam

sc-ble-bridge The main goal of this utility is to provide workaround for steam-for-linux issue which makes Valve's Steam Controller unusable in BLE mo

null 5 Apr 19, 2022
Ramp is a HID attack program that steals all connected WiFi passwords within 13 seconds.

Ramp Ramp is a HID attack program that steals all connected WiFi passwords within 13 seconds. Tested Windows 10 Warning Ramp has been created for the

Md. Ridwanul Islam Muntakim 24 Dec 24, 2022
Anotter USB temperature logger that can record up to four channels with thermocouple or NTCs connected via CDC directly or SCPI to USB.

temperature-logger Anotter USB temperature logger that can record up to four channels with thermocouple or NTCs connected via CDC directly or SCPI to

Jana Marie Hemsing 50 Nov 24, 2022