A compact smart room clock and weather monitor powered by an ESP32 DevKit V1 microcontroller, a 0.96" OLED display (SSD1306), and a DHT11 sensor. The project connects to Wi-Fi, automatically synchronizes accurate time using NTP servers, and displays room temperature with non-blocking screen switching.
- Automatic Time Synchronization: Fetches precise time and date via the internet (NTP protocol) without needing an external RTC hardware module.
- Climate Monitoring: Measures indoor temperature using the DHT11 sensor.
- Adaptive Interface: Smoothly alternates (using non-blocking
millis()) between the weather screen and the time/date screen every 5 seconds. - Clean Code Structure: Written in pure C++ for the Arduino IDE using optimized, industry-standard libraries.
- Microcontroller: ESP32 DevKit V1
- Display: 0.96" OLED Display (I2C, SSD1306, 128x64 resolution)
- Sensor: DHT11 (Temperature & Humidity Sensor)
- Connectivity: Built-in Wi-Fi (ESP32)
1. Connecting the 0.96 OLED Display VCC (or VIN) on the display ➔ to 3V3 GND on the display ➔ to GND SCL on the display ➔ to GPIO 22 (or D22) SDA on the display ➔ to GPIO 21 (or D21)
2. Connecting the DHT11 Temperature Sensor VCC (or +) on the sensor ➔ to 3V3 GND (or -) on the sensor ➔ to GND DATA (or OUT / S) on the sensor ➔ to GPIO 4 (or D4)
Make sure you have ESP32 board support installed in your Arduino IDE (via Boards Manager). Also, install the following libraries via the Library Manager:
Adafruit SSD1306Adafruit GFX LibraryDHT sensor library
- Clone or download this repository to your PC.
- Open the
smart_clock/smart_clock.inofile in the Arduino IDE. - Update your Wi-Fi credentials in the code:
const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD";