Skip to the content
2 layers48 × 62 mmAirHumidifier hardware, the printed circuit board in 3D

IoT Air humidifier controller built around two microcontrollers: an STM32F446RE and an ESP32-S3

Size
48 × 62 mm
Copper layers
2
Thickness
1.6 mm
Parts
52
Nets
97
Pads
232
Tracks, vias
314, 318
Pours
2
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
1 Oct 2026
Updated
1 Oct 2026

Overview

AirHumidifier hardware is an open-source printed circuit board by igokraj, from the igokraj/STM32_ESP32_IoT_AirHumidifier_firmware_hardware repository on GitHub, published under the MIT licence. It is a 2-layer board of 48 × 62 mm with 52 parts on 97 nets, routed with 314 tracks and 318 vias.

It is built around the ESP32-S3-WROOM-1-N8, 1812L150/24V and SMBJ15A. Its parts include 16 capacitors, 12 resistors, 6 connectors, 3 ICs and 3 diodes. It belongs with the home automation and IoT boards and the ESP32 and STM32 boards of this library.

Main components

3

README

README.md

STM32 + ESP32 IoT (AWS Core) Air Humidifier

Projekt zakładał stworzenie sterownika nawilżacza powietrza opartego na dwóch mikrokontrolerach STM32F446RE oraz ESP32-S3. STM32 odpowiada za sterowanie wentylatorem sygnałem PWM, obsługę czujników oraz maszynę stanów, na której opiera się działanie systemu. ESP32 służy wyłącznie do połączenia urządzenia z Wi-Fi, a następnie chmurą AWS IoT Core (Amazon) poprzez protokół MQTT.

Oba mikrokontrolery komunikują się ze sobą przez UART, wymieniając wiadomości w formacie JSON. STM32 wysyła do ESP32 informacje o aktualnej wilgotności, stanie systemu, prędkości obrotowej wentylatora oraz progu wilgotności ustawionym przez użytkownika. ESP32 przekazuje do STM32 wiadomość JSON przygotowaną wcześniej przez użytkownika, zawierającą żądany próg wilgotności w pomieszczeniu (np. 60%) oraz żądaną prędkość wentylatora, wybieraną poziomami od 0 do 5. Każdy poziom odpowiada innemu wypełnieniu sygnału PWM.

Firmware na STM32 jest napisany w C++, natomiast ESP32 działa na FreeRTOS, który jest natywną częścią frameworka.

Projekt był testowany na płytce stykowej, bez rzeczywistego wentylatora. Pomiar prędkości obrotowej sprawdzałem za pomocą drugiego timera, który generował impulsy i był fizycznie połączony z wejściem timera zliczającego impulsy z wentylatora. Sterowanie wentylatorem testowałem na servo ze zmienionymi parametrami sygnału PWM, ale logika sterowania pozostała taka sama.

This is an air humidifier controller built around two microcontrollers: an STM32F446RE and an ESP32-S3. The STM32 does the actual work. It drives the fan with PWM, reads the sensors and runs the state machine the whole system is based on. The ESP32 has only one job: it connects to Wi-Fi and talks to AWS IoT Core over MQTT.

The two chips talk to each other over UART using JSON messages. The STM32 sends the current humidity, system state, fan RPM and the humidity target set by the user. The ESP32 sends back a JSON message from the user with the target room humidity (e.g. 60%) and the fan speed level, from 0 to 5. Each level is a different PWM duty cycle.

The STM32 firmware is written in C++. The ESP32 runs on FreeRTOS, which comes built into ESP-IDF.

I tested everything on a breadboard without a real fan. To check the RPM measurement, I used a second timer to generate pulses and wired it to the input of the timer that counts the fan pulses. For fan control I used a servo instead, with different PWM settings, but the control logic stayed the same.

Photos

Breadboard prototype

Schematic

PCB layout and 3D render

 

How it works

The system has four states: Waiting, Running, EmptyContainer (no water in the tank) and Error.

In the main loop the STM32:

  1. checks for a JSON command from the ESP32 ({"hum": 55, "rpm_lvl": 3}) and updates the target humidity and fan speed level,
  2. reads humidity from the HTU21D every 1 s. After 3 failed reads in a row it resets the I2C bus and goes into Error,
  3. reads the water level sensor (float switch),
  4. sets the state. Priority: sensor fault, then empty tank, then humidity below target,
  5. drives the fan (PWM) and the RGB LED (green: running, blue: empty tank, red: error),
  6. every 10 s sends a status message to the ESP32, for example {"CurrentHumidity":48.20,"SetHum":70.00,"Status":1,"RPM":2000}.

Fan speed has 6 levels (0 to 5, which means 0 to 100% PWM). The real RPM is measured from the fan's tachometer output using timer input capture. The watchdog (IWDG) resets the MCU if the program hangs.

The ESP32 passes messages between UART (115200 baud) and MQTT (TLS):

  • publishes to humidifier/<client_id>/data
  • subscribes to humidifier/<client_id>/cmd (only valid JSON is sent on to the STM32)

Peripherals / electronics

  • STM32F446RETx: main microcontroller
  • ESP32-S3-WROOM-1: Wi-Fi / MQTT module
  • HTU21D: humidity sensor (I2C)
  • 4-pin PWM fan (PC fan, e.g. Noctua NF-A6x25 PWM): 12 V, PWM and tachometer
  • Water level sensor (float switch)
  • RGB LED: shows the system state
  • AMS1117-3.3: 3.3 V voltage regulator
  • 12 V power connector (barrel jack) with a fuse, reverse polarity diode and TVS overvoltage protection
  • SWD connector (ST-Link) for the STM32 and UART/boot header for programming the ESP32

BOM (short version)

ReferenceComponentQty
U2STM32F446RETx1
U3ESP32-S3-WROOM-11
U1AMS1117-3.3 (3.3 V regulator)1
RGB1RGB LED1
LED1LED (power indicator)1
J1Power jack (barrel jack)1
J24-pin PWM fan connector1
J3Screw terminal (water level sensor)1
J4ESP32 programming header1
J5HTU21D connector1
STLink1STM32 programmer connector1
F1Fuse1
D1Schottky diode B340 (reverse polarity protection)1
D2TVS diode SMBJ15A (overvoltage protection)1
L1Ferrite bead (power filtering)1
R, CResistors and capacitors (filtering, pull-up/down)~28

The full list (with LCSC part numbers) is in AirHumidifier/hardware/BOM.xlsx and All_BOM.csv.

Firmware

STM32: written in C++ on top of the C code generated by STM32CubeMX/HAL. The humidifier state logic, humidity sensor, UART, JSON parser and I2C bus recovery are separate classes/modules. The rest (GPIO, I2C, timers, UART, watchdog) is generated HAL code.

ESP32: written in C with ESP-IDF (FreeRTOS), split into WIFI, UART and MQTT modules. To build it you have to add your own main/secrets.h (Wi-Fi credentials, AWS endpoint and client ID) and AWS IoT certificates in main/Cert/. They are not included in the repo.

Repo structure

  • AirHumidifier/firmware/stm32/: CMake project with the STM32 sources
  • AirHumidifier/firmware/esp32/: ESP-IDF project for the ESP32
  • AirHumidifier/hardware/: KiCad schematic and PCB, production files (Gerbers), BOM
  • AirHumidifier/hardware/Images/: schematic and PCB renders

Parts

52
QtyValueFootprintReferences
9100nFCapacitor_SMD:C_0805_2012MetricC3, C4, C5, C6, C7, C10, C11, C12, C14
410kResistor_SMD:R_0805_2012MetricR3, R5, R8, R9
4330Resistor_SMD:R_0805_2012MetricR2, R10, R11, R12
4MountingHoleMountingHole:MountingHole_2.2mm_M2H1, H2, H3, H4
3Conn_01x04_PinConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ2, J5, STLink1
3FiducialFiducial:Fiducial_1mm_Mask2mmFID1, FID2, FID3
210uFCapacitor_Tantalum_SMD:CP_EIA-3216-18_Kemet-AC1, C2
24.7kResistor_SMD:R_0805_2012MetricR6, R7
2FiducialFiducial:Fiducial_0.5mm_Mask1mmFID4, FID5
11812L150/24Fuse:Fuse_1812_4532MetricF1
11kResistor_SMD:R_0805_2012MetricR4
11uFCapacitor_Tantalum_SMD:CP_EIA-3216-18_Kemet-AC9
11uFCapacitor_SMD:C_0805_2012MetricC15
12.2kResistor_SMD:R_0805_2012MetricR1
122uFCapacitor_SMD:C_0805_2012MetricC13
14.7uFCapacitor_Tantalum_SMD:CP_EIA-3216-18_Kemet-AC8
14.7uFCapacitor_SMD:C_0805_2012MetricC16
1AMS1117-3.3_SOT223Package_TO_SOT_SMD:SOT-223-3_TabPin2U1
1B340_SMADiode_SMD:D_SMAD1
1BEAD(FCM1608KF-601T03)Inductor_SMD:L_0603_1608MetricL1
1Barrel_JackConnector_BarrelJack:BarrelJack_HorizontalJ1
1Conn_02x03_Odd_EvenConnector_IDC:IDC-Header_2x03_P2.54mm_VerticalJ4
1ESP32-S3-WROOM-1RF_Module:ESP32-S3-WROOM-1U3
1LEDLED_THT:LED_D5.0mmLED1
1LED_ARGBLED_THT:LED_D5.0mm-4_RGBRGB1
1SMBJ15ADiode_SMD:D_SMBD2
1STM32F446RETxPackage_QFP:LQFP-64_10x10mm_P0.5mmU2
1Screw_Terminal_01x02TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_HorizontalJ3

Similar boards

  • 2 layers50 × 80 mmSelf Watering POT, the printed circuit board in 3D

    Self Watering POT

    igokraj/STM32_Cpp_Self_Watering_Pot_Firmware-Hardware

    Complete firmware and hardware solution for a self-watering pot, written in C++

    70 partsMIT
  • 4 layers100 × 100 mmBrain, the printed circuit board in 3D

    Brain

    Pegoku/SarcasmOS

    Personal assistant characterized by Bender from Futurama

    225 parts2
  • 2 layers80.5 × 53.8 mmBlynk, the printed circuit board in 3D

    Blynk

    DynamicWhiteHat/Blynk

    A feature-rich LED controller

    110 parts
  • 6 layers36 × 124 mmOpenDual Reader, the printed circuit board in 3D

    OpenDual Reader

    nuerolynx/embedded-systems-lab

    Arduino UNO R4 WiFi and ESP32 prototypes for access control, automation, displays, monitoring, and Bluetooth audio.

    74 parts4
  • 8 layers217.5 × 187.5 mmBoard c openroute partial, the printed circuit board in 3D

    Board c openroute partial

    ajisrawi/passive-radar-counter-drone

    Passive radar for counter-drone using DVB-T, 4G and 5G: simulation, receiver hardware, FPGA micro-Doppler firmware, antennas, enclosure

    314 parts3
  • 2 layers170.6 × 121.1 mmEIM, the printed circuit board in 3D

    EIM

    bhorst519/bluecar

    232 parts3
  • 4 layers220 × 120 mmCandidate filled profile, the printed circuit board in 3D

    Candidate filled profile

    misko/prompt2device

    The separate vNext PCB skill and orchestrator package is available alongside the reference workflow below; existing projects keep their accepted toolchain until an explicit migration.

    569 parts3MIT
  • 4 layers100 × 100 mmPCB Design, the printed circuit board in 3D

    PCB Design

    ConquerToFreedom/SwasthEdge

    Low-cost self-diagnosing edge controller for industrial sensor reliability

    89 parts2

Questions

How big is the AirHumidifier hardware PCB?

It measures 48 × 62 mm and has 2 copper layers, 1.6 mm thick.

What parts does the AirHumidifier hardware use?

52 parts, built around the ESP32-S3-WROOM-1-N8, 1812L150/24V and SMBJ15A. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the AirHumidifier hardware KiCad files?

From the igokraj/STM32_ESP32_IoT_AirHumidifier_firmware_hardware repository on GitHub, at the commit this page was made from: the board is hardware/AirHumidifier_hardware.kicad_pcb and its schematic hardware/AirHumidifier_hardware.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the AirHumidifier hardware design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).