Loading 3D model… large boards can take a moment.
A smart thermostat built on the ESP32 platform featuring environmental sensing, e-paper/LVGL display, deep sleep power management, and multiple connectivity options (WiFi, Bluetooth, Blynk IoT).
Designed to fit inside an existing thermostat housing, this project includes both the firmware and KiCad hardware design files.
esp32-thermostat/
├── hardware/ # KiCad PCB design files
│ ├── thermo_v2_266.kicad_sch # Schematic
│ ├── thermo_v2_266.kicad_pcb # PCB layout
│ └── pins.ods # Pin mapping spreadsheet
├── software/ # PlatformIO firmware project
│ ├── src/ # Implementation files
│ ├── include/ # Header files
│ ├── lib/ # Libraries (BSEC, LVGL submodule)
│ └── platformio.ini # Build configuration
└── README.md
git clone https://github.com/your-username/esp32-thermostat.git
cd esp32-thermostat
git submodule update --init --recursive
cp software/include/secrets.h.example software/include/secrets.h
Edit software/include/secrets.h with your WiFi credentials and Blynk tokens.
Configure features in software/include/config.h:
// Display type (choose one)
//#define DISPLAY_EPD // E-paper display
#define DISPLAY_LVGL // LVGL-based display
// Optional features
#define HAS_SENSOR // Enable BME680 sensor
#define SENSOR_SAMPLERATE 3 // Sample rate: 3 or 300 seconds
#define COMMANDS // Extended CLI commands
//#define BLUETOOTH // Bluetooth LE support
//#define OTA // WiFi OTA updates
#define BLYNK // Blynk IoT platform
cd software
pio run -t upload
pio device monitor
For OTA updates (after initial flash):
pio run -e mhetesp32devkit-ota -t upload
The firmware is organized into namespaces, each handling a specific subsystem:
| Namespace | File | Description |
|---|---|---|
Power | power.cpp/h | Deep sleep management, battery monitoring, wake source handling |
Tasks | tasks.cpp/h | RTC-persistent task scheduler that survives deep sleep |
RTC | rtc.cpp/h | Real-time clock and timestamp management |
CLI | cli.cpp/h | Serial command interface for debugging |
Commands | commands.cpp/h | Extended CLI command set |
| Namespace | File | Description |
|---|---|---|
Sensor | sensor.cpp/h | BME680 environmental sensor via BSEC library |
Display | display.cpp/h | Display abstraction (EPD or LVGL backend) |
Input | input.cpp/h | Button handling via AceButton library |
Peripherals::LED | peripherals.cpp/h | Status LED control |
Peripherals::Thermo | peripherals.cpp/h | Bistable relay control via DRV8837 |
Pins | pins.cpp/h | GPIO pin definitions and initialization |
| Namespace | File | Description |
|---|---|---|
Wifi | wifi.cpp/h | WiFi with static IP, NTP sync, HTTP client, OTA |
Bluetooth | bluetooth.cpp/h | BLE GATT server (Environmental Sensing, Thermostat, Battery services) |
_Blynk | blynk.cpp/h | Blynk IoT platform integration |
First boot:
Wake from deep sleep:
Variables marked with RTC_DATA_ATTR survive deep sleep:
Managed via PlatformIO:
espressif32 - ESP32 platformzinggjm/GxEPD2 - E-paper display driverbxparks/AceButton - Button debouncingblynkkk/Blynk - IoT platformlvgl/lvgl - Graphics library (git submodule)The hardware/ directory contains KiCad 8 project files for a custom PCB designed to fit inside an existing thermostat housing. Key components:
MIT
No comments yet. Be the first to ask about this board.