Case Study
Smart Environment Dashboard
ESP32 environmental monitoring system with SPI data logging to microSD, I2C LCD display, and interrupt-driven button navigation.
Built a modular embedded monitoring system on the ESP32 that periodically samples temperature and humidity via a DHT11 sensor and persistently logs readings in CSV format to a microSD card over SPI. A 16x2 I2C LCD provides real-time display of live and historical entries, with physical button navigation and an auto-follow mode that automatically tracks the latest log entry unless overridden by the user. The firmware is architected in non-blocking, cooperative layers, demonstrating deterministic task scheduling through interval-based timing.
Role
Embedded Systems Engineer
Timeline
March 2025 – May 2025
Status
Complete
Platform
ESP32

01
Overview
An ESP32-based firmware system that continuously samples temperature and humidity via a DHT11 sensor, logs readings in CSV format to a microSD card over SPI, and displays live and historical data on a 16x2 I2C LCD with physical button navigation.
02
Technical Design
Hardware is wired with the DHT11 on a GPIO pin, the microSD module on SPI, the LCD on I2C, and two buttons on pull-up inputs — all initialized and validated in setup() before the main loop begins. Correctness was verified by confirming log entries on SD matched expected sensor output at the correct intervals, and that button navigation and auto-follow transitions produced no missed or duplicated entries under continuous logging.
- —Periodic DHT11 temperature and humidity sampling.
- —Persistent CSV log to microSD card.
- —16x2 I2C LCD displaying live or historical sensor readings with auto-follow mode that tracks the latest entry by default.
- —Physical button navigation allowing the user to scroll backward through stored log entries, with auto-follow pausing on manual scroll and resuming on return to the latest entry.
Non-Blocking UI During Concurrent SD Writes
SD card write operations on the ESP32 can introduce brief blocking delays that, if not handled carefully, cause the LCD to stutter or miss button input. Structuring writes as fire-and-forget operations within a timed interval isolated the latency and kept the UI consistently responsive. This reinforced the importance of treating each peripheral as an independent timed task rather than a sequential step.
03
Outcomes
- —System logs temperature and humidity readings to microSD at consistent intervals with no missed samples observed during continuous bench runs.
- —Button navigation correctly pauses auto-follow and allows full backward scroll through stored log entries without interrupting background logging.
- —Auto-follow resumes correctly on return to the latest entry in all tested interaction sequences.
- —Firmware operates fully non-blocking — no delay() calls in the main loop.
Next Steps
- —Add RTC or NTP-based timestamping to replace index-based log entries.
- —Migrate periodic task scheduling to FreeRTOS for more deterministic multi-task timing.
- —Add SD card error detection and graceful recovery on write failure.