Community project

ESP32 Climate Controller

Photo of ESP32 Climate Controller
Generated with AI

Владимир

Published November 27, 2026

The ESP32 Climate Controller is a mains-rated automation system for managing HVAC equipment, humidifiers, and dampers in controlled environments. Built around an ESP32 microcontroller, it combines an 8-channel relay module for low-voltage switching with solid-state relays and safety-rated contacts for direct 220 V AC control, plus limit switches for equipment feedback.

This guide provides a complete wiring diagram, component checklist, and step-by-step assembly instructions for building the low-voltage control section and safely integrating mains-rated connections. Readers will also receive the Arduino firmware needed to monitor limit switches and manage relay outputs, along with safety verification procedures to confirm proper operation before connecting to live power.

Wiring diagram

Wiring diagram for ESP32 Climate Controller
Loading diagram…

Gather all the parts

QtyComponent
1

8-channel JD-VCC relay module — 3.3 V input required

Conditional wiring specification: jumper removed, VCC 3.3 V, JD-VCC 5 V, active-low inputs. Only use a module whose manufacturer confirms this mode; TS0012 catalog record does not establish it. Contact ratings must match actual loads.

1

onsemi PN2222A

NPN TO-92; identify E B C using onsemi PN2222A datasheet. Low-side SSR input driver.

1

Resistor

1 kΩ, 0.25 W

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

10 kΩ, 0.25 W

Through-hole resistor (current-limiting in series with an LED)

1

Omron G3NA AC-output SSR, 5–24 V DC input

Select current rating and heatsink for actual heater. DC input maximum 7 mA for G3NA-2xxB; AC output. AC1/AC2 are functional labels: map to manufacturer terminal markings.

1

Micro Switch - Premium Zippy 3-Terminal

Higher-quality 3-terminal bump-actuator microswitch for arcade controls and light mechatronics, rated 30 VDC / 250 mA max. Common, normally-open, and normally-closed contacts.

1

Micro Switch - Premium Zippy 3-Terminal

Higher-quality 3-terminal bump-actuator microswitch for arcade controls and light mechatronics, rated 30 VDC / 250 mA max. Common, normally-open, and normally-closed contacts.

1

USB-C 5V Adapter

USB-C wall adapter delivering regulated 5 V to the board's USB or VBUS rail. Default wired power source for desktop / stationary projects.

1

Protected 220 V AC installation interface

External installation boundary after isolation and load-specific protection; not a raw unprotected mains supply.

1

220 V AC exhaust fan connection interface

Functional appliance terminals; verify actual fan ratings. PE only for Class I equipment.

1

220 V AC intake fan connection interface

Functional appliance terminals; verify actual fan ratings. PE only for Class I equipment.

1

220 V AC humidifier connection interface

Functional appliance terminals; verify load and inrush current. PE only for Class I equipment.

1

Mains-rated float switch contact interface

Functional series contact closed only at safe water level. Select mains-rated switch for actual load; MAC3 manufacturer manual describes series load contacts. Not the low-voltage catalog float sensor.

1

220 V AC three-point damper connection interface

Functional terminals, not an assumed product pin numbering. Requires manufacturer-approved hardware direction interlock before operation; never energize both directions. PE only where required.

1

220 V AC lighting connection interface

Functional appliance terminals; verify inrush and relay rating. PE only for Class I equipment.

1

220 V AC heater connection interface

Functional appliance terminals; current rating and SSR heatsink must be selected for actual heater. PE only for Class I equipment.

1

KSD301 Thermal Cutoff Thermostat

Normally-closed bimetallic snap-disc thermostat (thermal cutoff switch). Passive electromechanical device — no firmware, GPIO, or library required. Rated 10 A, 250 V AC / 12 V DC or higher. Used in two temperature variants: 110 °C (primary cutoff) and 120 °C (secondary backup). Both units are wired in series on the 12 V heater line between the SSR-10DA output and the ceramic heater. Opens the circuit automatically when the bimetal disc reaches its rated temperature; resets (snaps closed) when it cools below the reset differential. Must be mounted flush against the heater element for accurate thermal contact.

Assemble it in 5 steps

1. Проверьте совместимость релейного модуля

Схема условная: нужны активные LOW входы с VCC 3,3 В и отдельным JD-VCC 5 В. Снимите перемычку только при отключённом питании. Не подключайте неподтверждённый модуль.

  • До старта прошивки реле должны аппаратно оставаться выключенными.

2. Соберите низковольтную часть

ESP32 питается через USB. Отдельный стабилизированный источник 5 В питает JD-VCC и SSR DC+. Объедините GND, но не соединяйте плюс отдельного источника с 5V ESP32. Красный +5 В, оранжевый +3,3 В, чёрный GND; жёлтый управление реле, фиолетовый SSR, белый концевики.

3. Подключите транзистор и концевики

GPIO10 через 1 кОм на базу; база через 10 кОм на GND. Эмиттер на GND, коллектор на SSR DC−. Проверьте E/B/C по документации onsemi. COM концевиков на GND, NO на GPIO17 и GPIO18.

4. Сетевые выводы — L, N и PE различайте по клеммам

Цвет линий в Build не является маркировкой физического провода. Различайте цепи по именам клемм — L/COM/NO — фазные цепи, N — нейтраль, PE — защитное заземление. Силовые цепи показаны отдельными компонентами с функциональными клеммами, не как готовый сетевой щит. Вход ac — граница защищённой установки после отключения и защиты. Фаза идёт на COM1–COM6; NO1 на вытяжку, NO2 на приток, NO3 через поплавок на увлажнитель, NO4/NO5 на OPEN/CLOSE, NO6 на свет. Фаза нагревателя идёт через термостат и SSR; все N нагрузок на ac.N, предусмотренные PE на ac.PE. Коричневый — фаза, синий — N всех нагрузок, жёлто-зелёный — PE предусмотренных клемм и металлического корпуса. Нужны защита, отключение, разделение цепей, сетевой поплавковый выключатель нужного номинала, независимый термостат и радиатор SSR. Привод должен иметь N/OPEN/CLOSE и аппаратную блокировку направлений.

  • Термостат KSD301 имеет автоматический возврат; температуру срабатывания и ток должен подтвердить электрик. Он не заменяет всю необходимую защиту нагревателя.
  • Направления заслонки требуют аппаратной блокировки перед эксплуатацией; она не спроектирована в этой схеме.
  • 220 В смертельно опасны. Не собирайте сетевую часть на макетной плате.
  • SSR может отказать во включённом состоянии. Номиналы силовых устройств не выбраны без токов нагрузок.

5. Проверьте без сети

Начальная прошивка держит все выходы выключенными и сообщает состояние концевиков через USB. Она не выполняет автоматическое управление климатом. Испытывайте сначала при отключённых 220 В.

Review all connections

1. Connections between "relays" and "ESP32"

FunctionrelaysESP32
powerVCC → Оранжевый: питание входов; только совместимый модуль3V3
groundGND → Чёрный: общий провод релеGND
digitalIN1 → Жёлтый: R1, активный LOWGPIO 11
digitalIN2 → Жёлтый: R2, активный LOWGPIO 12
digitalIN3 → Жёлтый: R3, активный LOWGPIO 13
digitalIN4 → Жёлтый: R4, активный LOWGPIO 14
digitalIN5 → Жёлтый: R5, активный LOWGPIO 15
digitalIN6 → Жёлтый: R6, активный LOWGPIO 16
powerIN7 → Оранжевый: неиспользуемый вход выключен3V3
powerIN8 → Оранжевый: неиспользуемый вход выключен3V3
powerNO1 → 220 V AC exhaust fan connection interface LEXT
powerNO2 → 220 V AC intake fan connection interface LEXT
powerNO3 → Mains-rated float switch contact interface COMEXT
powerNO4 → 220 V AC three-point damper connection interface OPENEXT
powerNO5 → 220 V AC three-point damper connection interface CLOSEEXT
powerNO6 → 220 V AC lighting connection interface LEXT

2. Connections between "supply" and "ESP32"

FunctionsupplyESP32
power+5V → 8-channel JD-VCC relay module — 3.3 V input required JD-VCCEXT
groundGND → Чёрный: общий провод с ESP32GND

3. Connections between "rb" and "ESP32"

FunctionrbESP32
digitalP1 → Фиолетовый: управление SSRGPIO 10
digitalP2 → onsemi PN2222A BEXT

4. Connections between "rpd" and "ESP32"

FunctionrpdESP32
digitalP1 → onsemi PN2222A BEXT
groundP2 → Чёрный: выключение транзистораGND

5. Connections between "q1" and "ESP32"

Functionq1ESP32
groundE → Чёрный: эмиттерGND
dataC → Omron G3NA AC-output SSR, 5–24 V DC input DC-EXT

6. Connections between "ssr" and "ESP32"

FunctionssrESP32
powerDC+ → USB-C 5V Adapter +5VEXT
powerAC2 → 220 V AC heater connection interface LEXT

7. Connections between "limit1" and "ESP32"

Functionlimit1ESP32
groundCOM → Чёрный: общий контакт концевикаGND
digitalNO → Белый: LIMIT 1, замкнут = LOWGPIO 17

8. Connections between "limit2" and "ESP32"

Functionlimit2ESP32
groundCOM → Чёрный: общий контакт концевикаGND
digitalNO → Белый: LIMIT 2, замкнут = LOWGPIO 18

9. Connections between "ac" and "ESP32"

FunctionacESP32
powerL → 8-channel JD-VCC relay module — 3.3 V input required COM1EXT
powerL → 8-channel JD-VCC relay module — 3.3 V input required COM2EXT
powerL → 8-channel JD-VCC relay module — 3.3 V input required COM3EXT
powerL → 8-channel JD-VCC relay module — 3.3 V input required COM4EXT
powerL → 8-channel JD-VCC relay module — 3.3 V input required COM5EXT
powerL → 8-channel JD-VCC relay module — 3.3 V input required COM6EXT
powerL → KSD301 Thermal Cutoff Thermostat Terminal 1EXT

10. Connections between "float" and "ESP32"

FunctionfloatESP32
powerSAFE → 220 V AC humidifier connection interface LEXT

11. Connections between "thermostat" and "ESP32"

FunctionthermostatESP32
powerTerminal 2 → Omron G3NA AC-output SSR, 5–24 V DC input AC1EXT

12. Connections between "exhaust" and "ESP32"

FunctionexhaustESP32
powerN → Protected 220 V AC installation interface NEXT
powerPE → Protected 220 V AC installation interface PEEXT

13. Connections between "intake" and "ESP32"

FunctionintakeESP32
powerN → Protected 220 V AC installation interface NEXT
powerPE → Protected 220 V AC installation interface PEEXT

14. Connections between "humidifier" and "ESP32"

FunctionhumidifierESP32
powerN → Protected 220 V AC installation interface NEXT
powerPE → Protected 220 V AC installation interface PEEXT

15. Connections between "damper" and "ESP32"

FunctiondamperESP32
powerN → Protected 220 V AC installation interface NEXT
powerPE → Protected 220 V AC installation interface PEEXT

16. Connections between "light" and "ESP32"

FunctionlightESP32
powerN → Protected 220 V AC installation interface NEXT
powerPE → Protected 220 V AC installation interface PEEXT

17. Connections between "heater" and "ESP32"

FunctionheaterESP32
powerN → Protected 220 V AC installation interface NEXT
powerPE → Protected 220 V AC installation interface PEEXT

Deploy the firmware

#include <Arduino.h>
constexpr uint8_t relayPins[] = {11,12,13,14,15,16};
constexpr uint8_t SSR_PIN=10, LIMIT1=17, LIMIT2=18;
void setup(){
  digitalWrite(SSR_PIN,LOW); pinMode(SSR_PIN,OUTPUT);
  for(uint8_t pin:relayPins){digitalWrite(pin,HIGH);pinMode(pin,OUTPUT);}
  pinMode(LIMIT1,INPUT_PULLUP);pinMode(LIMIT2,INPUT_PULLUP);
  Serial.begin(115200);
}
void loop(){
  static int previous=-1;
  int state=(digitalRead(LIMIT1)==LOW ? 1:0)|(digitalRead(LIMIT2)==LOW ? 2:0);
  if(state!=previous){Serial.printf("All outputs OFF. Limit1=%d Limit2=%d\n",state&1,(state>>1)&1);previous=state;}
  delay(20);
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik