Solid-fuel boiler controller: fan, pump and overheat guard

Holds the water temperature with the blower, runs the pump above a threshold and cuts the blower on overheat or sensor fault.

Level: Advanced Board: ESP32 DevKit V1 (WROOM-32) Smart home

⚠ Safety

Never remove or bypass the boiler safety thermostat, overheat protection or draft safety. The ESP32 is only an additional controller; sensor or Wi-Fi failures must leave the boiler in a safe state. Install a certified CO detector.

What you need

Buy the parts kit · Estimated total: $23.50

ESP32 DevKit V1 (30 pin, WROOM-32) × 1
$4.00
Buy at AliExpress Buy at Amazon.com
MAX6675 + K-type thermocouple (flue gas up to 800 C) × 1
$4.00
Buy at AliExpress Buy at Amazon.com
DS18B20 waterproof probe × 1
$1.50
Buy at AliExpress Buy at Amazon.com
Relay module 1-channel 5V (opto-isolated) × 1
$1.50
Buy at AliExpress Buy at Amazon.com
Solid-state relay SSR-25DA + heatsink (for heaters) × 1
$6.00
Buy at AliExpress Buy at Amazon.com
MQ-7 carbon monoxide (CO) sensor module × 1
$2.00
Buy at AliExpress Buy at Amazon.com
Inline fuse holder + fuses × 1
$1.50
Buy at AliExpress Buy at Amazon.com
Plastic project enclosure × 1
$3.00
Buy at AliExpress Buy at Amazon.com
🇺🇦 Ukraine🌍 Other countries

Other countries: order these parts on AliExpress with the links below.

Some links are affiliate links: we may earn a commission at no extra cost to you.

Wiring

ModuleModule pinESP32 pinNote
MAX6675 SCK / CS / SOSPIGPIO18 / GPIO5 / GPIO19K-type probe in the flue; VCC 3V3
DS18B20 DATA1-WireGPIO44.7 kΩ pull-up to 3V3; clamp on the supply pipe
Relay IN (circulation pump)signalGPIO26opto-isolated module in an enclosure
SSR input (blower fan)signalGPIO27SSR sized for the fan, on a heatsink
Buzzer +signalGPIO25

Libraries

Arduino IDE → Tools → Manage Libraries, then install:

  • MAX6675 library (Adafruit)
  • OneWire
  • DallasTemperature

Code

solid-fuel-boiler.ino
#include <WiFi.h>

const char* WIFI_SSID = "YOUR_WIFI";
const char* WIFI_PASS = "YOUR_PASSWORD";

bool connectWiFi(uint32_t timeoutMs = 20000) {
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASS);
  uint32_t t0 = millis();
  while (WiFi.status() != WL_CONNECTED && millis() - t0 < timeoutMs) {
    delay(250);
    Serial.print(".");
  }
  Serial.println();
  if (WiFi.status() == WL_CONNECTED) {
    Serial.print("IP: ");
    Serial.println(WiFi.localIP());
    return true;
  }
  return false;
}
#include <WiFiClientSecure.h>
#include <HTTPClient.h>

const char* TG_TOKEN = "123456:ABC-YOUR-BOT-TOKEN";   // from @BotFather
const char* TG_CHAT  = "YOUR_CHAT_ID";

// Keep the text free of double quotes and line breaks (it is inserted into JSON).
bool telegramSend(const String& text) {
  if (WiFi.status() != WL_CONNECTED) return false;
  WiFiClientSecure client;
  client.setInsecure();   // simple; pin the certificate for production
  HTTPClient http;
  String url = String("https://api.telegram.org/bot") + TG_TOKEN + "/sendMessage";
  if (!http.begin(client, url)) return false;
  http.addHeader("Content-Type", "application/json");
  String body = String("{\"chat_id\":\"") + TG_CHAT + "\",\"text\":\"" + text + "\"}";
  int code = http.POST(body);
  http.end();
  return code == 200;
}
#include <WebServer.h>

WebServer server(80);
String buildJson();   // implemented in the project below

String num(float v, int d = 1) { return isnan(v) ? String("null") : String(v, d); }

const char PAGE_HTML[] PROGMEM = R"rawliteral(
<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>ESP32</title>
<style>body{font-family:system-ui;background:#0b0f14;color:#e6edf3;margin:20px}table{border-collapse:collapse}td{padding:6px 14px;border-bottom:1px solid #223}button,input{font-size:16px;padding:8px 14px;margin:4px;border-radius:6px;border:1px solid #345;background:#16202b;color:#e6edf3}</style>
</head><body><h2>ESP32</h2><table id="t"></table>
<script>
function load(){fetch('/json').then(r=>r.json()).then(d=>{let h='';for(const k in d){h+='<tr><td>'+k+'</td><td>'+d[k]+'</td></tr>';}document.getElementById('t').innerHTML=h;});}
load();setInterval(load,2000);
</script></body></html>
)rawliteral";

void startWeb() {
  server.on("/", []() { server.send_P(200, "text/html", PAGE_HTML); });
  server.on("/json", []() { server.send(200, "application/json", buildJson()); });
  server.begin();
}
#include <max6675.h>
#include <OneWire.h>
#include <DallasTemperature.h>

MAX6675 flueProbe(18, 5, 19);            // SCK, CS, SO
OneWire ow(4); DallasTemperature water(&ow);
const int PIN_PUMP = 26, PIN_FAN = 27, PIN_BUZ = 25;
float SET_WATER = 65.0, HYST = 4.0;       // target boiler water temperature
const float PUMP_ON_C = 45.0, FLUE_MAX = 350.0, WATER_MAX = 85.0;
float flueC = NAN, waterC = NAN; bool fanOn = false, pumpOn = false, alarmOn = false;

String buildJson() { return String("{\"flue\":") + num(flueC) + ",\"water\":" + num(waterC) + ",\"fan\":" + (fanOn ? 1 : 0) + ",\"pump\":" + (pumpOn ? 1 : 0) + ",\"set\":" + num(SET_WATER) + "}"; }

void setup() {
  Serial.begin(115200);
  pinMode(PIN_PUMP, OUTPUT); pinMode(PIN_FAN, OUTPUT); pinMode(PIN_BUZ, OUTPUT);
  water.begin(); connectWiFi(); startWeb();
  server.on("/set", []() { if (server.hasArg("t")) SET_WATER = constrain(server.arg("t").toFloat(), 40, 80); server.send(200, "text/plain", String(SET_WATER)); });
}
void loop() {
  server.handleClient();
  static uint32_t t = 0;
  if (millis() - t > 2000) {
    t = millis();
    flueC = flueProbe.readCelsius(); water.requestTemperatures(); waterC = water.getTempCByIndex(0);
    bool sensorsOk = !isnan(flueC) && waterC > -100;
    bool danger = !sensorsOk || waterC > WATER_MAX || flueC > FLUE_MAX;
    if (danger) { fanOn = false; pumpOn = true; }                    // blower off, pump on to shed heat
    else {
      if (waterC > PUMP_ON_C) pumpOn = true; else if (waterC < PUMP_ON_C - 5) pumpOn = false;
      if (waterC < SET_WATER - HYST) fanOn = true; else if (waterC > SET_WATER) fanOn = false;
    }
    digitalWrite(PIN_PUMP, pumpOn); digitalWrite(PIN_FAN, fanOn); digitalWrite(PIN_BUZ, danger);
    if (danger && !alarmOn) telegramSend(sensorsOk ? "Boiler overheat protection triggered" : "Boiler sensor fault: fan switched off");
    alarmOn = danger;
  }
}

Flash a ready firmware from the browser Paste your error into the AI Error Doctor

Build tips

  • Start with the blower disconnected and only watch the readings for a few days.
  • Keep every original safety device. Tune SET_WATER and HYST to your boiler.

← ← All projects

Related ideas

⛔ High risk

Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.

Floor heating controller

Controls an electric floor or heater with a solid-state relay, floor and room probes and a schedule.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●● Advanced
  • Build time 3–5 h
Pick parts / kit
⛔ High risk

Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.

Pipe freeze guard with heating cable

Watches the temperature of an unheated pipe, switches a heating cable and warns you when the cable cannot work because the power is out.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●○ Intermediate
  • Build time 2–3 h
Pick parts / kit
⛔ High risk

Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.

Night-tariff water heater scheduler

Heats the water heater only in the cheap night tariff zone or from surplus solar power, with a temperature limit.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●● Advanced
  • Build time 3–5 h
Pick parts / kit

Comments

No comments yet. Share your experience or ask a question.

Comments are moderated.