English | 日本語 (README.JP.md)
A Wi-Fi NTP-synchronized digital clock and indoor environment monitor designed for ESP32 boards equipped with a 1.9-inch IPS TFT LCD (ST7789 driver).
Powered by ESP-IDF's native esp_lcd driver and internal DMA frame buffering to deliver flicker-free, smooth, and high-performance UI rendering.
- NTP Time Synchronization: Automatically fetches and synchronizes accurate date, day of week, and time over Wi-Fi (JST / UTC+9 default).
- SwitchBot + Sensor Web API Integration:
- Periodically fetches environmental metrics via mDNS from local network sensor nodes (
http://esp32-switchbot.local/api/sensor). - Room Temperature (TEMP): Prominently displayed in extra-large scale font with dynamic color mapping based on temperature range.
- Ambient Illuminance (BRIGHTNESS / LUX): Real-time illuminance monitor in the lower card section.
- Periodically fetches environmental metrics via mDNS from local network sensor nodes (
- 6-Hour Temperature History Graph:
- Records temperature every minute (up to 360 data points) in a ring buffer.
- Displays a live polyline graph with filled area and auto-scaling Y-axis at the bottom of the screen.
- Color of the graph line dynamically matches the temperature range color scheme.
- Seconds Progress Bar:
- A slim progress bar below the clock header visually counts elapsed seconds (0–59s) within the current minute.
- Hardware PWM Auto-Dimming:
- Automatically adjusts LCD backlight brightness smoothly based on ambient lux readings for comfortable day/night viewing.
- Modern & High-Contrast UI:
- Sleek dark theme layout optimized for 320×170 landscape resolution with a unified bitmap font.
+-------------------------------------------------------------+
| 08:34 2026/09/27 (SATURDAY) | <- Time (left) & Date/Day (right)
| [████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] | <- Seconds progress bar (0-59s)
|-------------------------------------------------------------|
| +-------------------------------------------------------+ |
| | ROOM TEMP | |
| | | |
| | 2 5 . 3 C | | <- Main: Extra-large temperature
| | | |
| +-------------------------------------------------------+ |
| | BRIGHTNESS 28.5 lx | | <- Compact ambient lux row
| | TEMP GRAPH ___/‾‾‾‾\___/‾‾‾‾‾\__ 28C 25C | | <- 6-hour history graph
| +-------------------------------------------------------+ |
+-------------------------------------------------------------+
- MCU: ESP32 (Xtensa Dual-Core 240MHz, 16MB Flash, CH340 USB-Serial)
- Display: 1.9-inch IPS TFT LCD (Resolution: 170×320, Driver: ST7789)
| LCD Pin | ESP32 GPIO | Description |
|---|---|---|
| VCC | 3.3V | Power Supply |
| GND | GND | Ground |
| DC | GPIO 2 | Data / Command Selection |
| RST | GPIO 4 | Reset |
| CS | GPIO 15 | Chip Select |
| SCLK | GPIO 18 | SPI Clock |
| MOSI | GPIO 23 | SPI Data Output |
| BLK | GPIO 32 | Backlight Control (LEDC PWM) |
ESP32SensorMonitor/
├── CMakeLists.txt # Project root CMake configuration
├── sdkconfig.defaults # Default configuration (16MB Flash, etc.)
├── .gitignore # Git ignore rules
├── README.md # English documentation
├── README.JP.md # Japanese documentation
└── main/
├── CMakeLists.txt # Component dependencies
├── idf_component.yml # Component dependencies (mDNS, etc.)
├── font_32x64.h # High-resolution 32x64 bitmap font for temperature
├── main.c # Main application source code
├── secrets.example.h # Wi-Fi credentials template
└── secrets.h # Wi-Fi credentials (excluded from Git)
- ESP-IDF v5.x (v5.4 recommended)
source $HOME/esp/esp-idf/export.shCopy secrets.example.h to secrets.h and provide your Wi-Fi credentials:
cp main/secrets.example.h main/secrets.hEdit main/secrets.h:
#pragma once
#define WIFI_SSID "YOUR_WIFI_SSID"
#define WIFI_PASS "YOUR_WIFI_PASSWORD"idf.py set-target esp32idf.py buildidf.py -p /dev/ttyUSB0 flash monitor(Press Ctrl + ] to exit the serial monitor)
MIT License