Story
⏰ ESP32 × Nextion Display — Smart Pomodoro Clock with Real-Time Display
A complete Nextion-powered Pomodoro and clock system built on ESP32. It combines real-time clock synchronization (via NTP), a fully interactive Pomodoro timer, and non-blocking LED alerts, all managed through a sleek touchscreen interface.
???? Overview
This project turns your Nextion HMI display into a productivity dashboard:
- Displays current time, date, and day (synced from the internet).
- Features a custom Pomodoro timer with start, stop, reset, and time adjustment.
- Includes a non-blocking LED blink alert when the Pomodoro session ends.
All touch interactions are handled via raw Nextion serial packets — no external libraries needed.
⚙️ Features
✅ Real-time clock synced from NTP ✅ Dual-screen interface (Home & Pomodoro) ✅ Adjustable Pomodoro duration (1–60 mins) ✅ Start, stop, pause, and reset timer controls ✅ LED alert (non-blocking) after timer completion ✅ Robust Nextion event parser with noise filtering
???? Hardware Setup
| Component | Description | 
|---|---|
| ESP32 | Handles logic, NTP sync, and LED control | 
| Nextion Display | UI for clock & Pomodoro | 
| Built-in LED (GPIO 2) | Visual alert indicator | 
Wiring:
| ESP32 Pin | Nextion Pin | Description | 
|---|---|---|
| 16 | TX | Display → ESP32 | 
| 17 | RX | ESP32 → Display | 
| 5V | 5V | Power | 
| GND | GND | Common ground | 
????️ Nextion Pages
Page 0 — Home Screen
| Component | ID | Purpose | 
|---|---|---|
| bLed | 6 | Trigger LED test (3s blink) | 
| bPom | 7 | Go to Pomodoro page | 
| tTime,tSec,tDate,tDay | — | Display time and date | 
Page 1 — Pomodoro Screen
| Component | ID | Purpose | 
|---|---|---|
| bHome | 3 | Return to Home | 
| bInc,bDcr | 4,5 | Adjust duration ±1 min | 
| bStart,bStop,bReset | 6–8 | Timer controls | 
| tTimer | — | Show countdown | 
???? Core Functionalities
???? Clock System
- Wi-Fi + NTP-based time sync
- Updates every second on Nextion
- Shows hour, minute, second, date, and weekday
???? Pomodoro Timer
- Default 25:00 minutes
- Adjustable 1–60 mins
- Non-blocking countdown
- Smooth updates every second
- State transitions: IDLE → RUNNING → PAUSED → ALERT
???? LED Alert
- Blinks automatically after timer ends
- 10-second non-blocking alert
- Fully handled using millis()for multitasking
???? Code Architecture
| Section | Function | 
|---|---|
| setupTime() | Connects WiFi & syncs time | 
| updateClockDisplay() | Updates time/date/day on Nextion | 
| runPomodoro() | Handles countdown & transitions | 
| runLedAlert() | Manages non-blocking LED blinking | 
| handleNextionEvents() | Parses and processes touch events | 
???? Event Flow
- Home page loaded → Real-time clock updates every second
- User presses Pomodoro button → Switches to Pomodoro page
- Start button pressed → Timer begins counting down
- Timer ends → LED alert blinks for 10 seconds
- Back to Home → Clock display resumes
???? Libraries Used
- WiFi.h
- time.h
- HardwareSerial.h
???? Highlights
- Fully non-blocking system (no delay()used in logic loops)
- Efficient, byte-level parsing of Nextion touch events
- Modular functions — easy to expand with new pages or features
 
    
 
                                         
                                         
                                         
                                         
                                         
                                         
                                         
                                         
                                         
                                         
                                        


 
                             
                            
 
                                                 
                                                                                         
                                     
                                     
                                     
                             
                             
                             
                             
                     
                                                 
                                                 
                                                 
                                         
                                                 
                                         
                                         
                                                 
                                         
                                                 
                                         
                                                 
                                         
                                         
                                                 
                                         
                                                 
                                         
                                                 
                                         
                                                 
                                         
                                         
                                                
