OpenTherm Sample
  • 8/21/2020
  • OpenTherm, DIY

OpenTherm Sample

What is OpenTherm?

OpenTherm is communication protocol for Heating, Ventilation and Air Conditioning (HVAC) systems. Most often it is used in communication between a central heating boiler and a room thermostat. OpenTherm protocol is designed to control modulating heating appliances which allows to reach better efficiency and energy saving. It is simple but powerfull protocol with large set of commands which enable the manufacturer to build extra functions into their control devices. Check OpenTherm protocol specification v2.2 for more details.


OpenTherm communication takes place using two-wire, polarity-free low voltage connection for distance up to 50 meters. 15-18 V for High level and below 8 V - Low level, but it is still very high for popular Arduino compatible microcontrollers. That is why to implement Master OpenTherm interface (thermostat) you need hardware adapter to adjust voltage levels, like Master OpenTherm Shield.

OpenTherm Connection

OpenTherm Connection Master OpenTherm Shield Connection


There is OpenTherm Library, which implements OpenTherm protocol communication and should work with all OpenTherm compatible boilers. OpenTherm library has support of Arduino, ESP8266, ESP32 and similar modules. To use library you need install it into Arduino IDE. Then you should set right pins configuration for concrete board. After that you will be able to send OpenTherm commands to boiler. Major commands are: get/set boiler status and set Central Heating temperature setpoint.

Code Sample

#include <Arduino.h>
#include <OpenTherm.h>

const int inPin = 2; //for Arduino, 4 for ESP8266
const int outPin = 3; //for Arduino, 5 for ESP8266
OpenTherm ot(inPin, outPin);

void ICACHE_RAM_ATTR handleInterrupt() {

void setup()


void loop()
    //Set/Get Boiler Status
    bool enableCentralHeating = true;
    unsigned long response = ot.setBoilerStatus(enableCentralHeating);
    OpenThermResponseStatus responseStatus = ot.getLastResponseStatus();
    if (responseStatus == OpenThermResponseStatus::SUCCESS) {
        Serial.println("Central Heating: " + String(ot.isCentralHeatingActive(response) ? "on" : "off"));
    else {
        Serial.println("Invalid response");

    //Set Boiler Temperature to 64 degrees C

    //Get Boiler Temperature
    float temperature = ot.getBoilerTemperature();
    Serial.println("Boiler temperature is " + String(temperature) + " degrees C");