Back to All Blog Posts
Tutorial •EltroNerd Engineering

ESP32 Smartwatch with OLED Display

A smartwatch is a wearable device that displays time and other information on a compact screen.

šŸ“Œ 1. Introduction

A smartwatch is a wearable device that displays time and other information on a compact screen.
In this project, we design a basic smartwatch prototype using an ESP32 microcontroller and a small OLED display (128Ɨ64, SSD1306 driver).

The ESP32 provides:

  • Wi-Fi & Bluetooth for IoT connectivity.
  • Low-power modes for wearable applications.
  • Compatibility with small OLED displays to create a smartwatch-style interface.

šŸŽÆ 2. Objectives

  • Design a wearable device prototype using ESP32.
  • Display time, date, and basic notifications on OLED.
  • Demonstrate use of RTC (Real-Time Clock) with ESP32.
  • Provide a base for extending features like fitness tracking, Bluetooth notifications, and IoT integration.

āš™ļø 3. Hardware Requirements

  • ESP32 Development Board (NodeMCU-32S, WROOM32, etc.)
  • OLED Display (128Ɨ64, I²C, SSD1306 driver)
  • DS3231/DS1307 RTC Module (optional, for accurate timekeeping)
  • Push buttons (for menu navigation)
  • Small Li-Po battery + charging module (TP4056) (for wearable power)
  • Wrist strap/case (3D printed or DIY)

šŸ”Œ 4. Circuit Connections

ESP32 → OLED (I²C)

  • SDA → GPIO21
  • SCL → GPIO22
  • VCC → 3.3V
  • GND → GND

Optional (ESP32 → DS3231 RTC)

  • SDA → GPIO21
  • SCL → GPIO22
  • VCC → 3.3V
  • GND → GND

šŸ“œ 5. Arduino Code (ESP32 + OLED Watch)

c
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "time.h"

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

// Wi-Fi (for getting NTP time)
const char* ssid     = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";

const char* ntpServer = "pool.ntp.org";
const long  gmtOffset_sec = 19800;   // GMT +5:30 for IST
const int   daylightOffset_sec = 0;

void setup() {
  Serial.begin(115200);

  // OLED init
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;);
  }
  display.clearDisplay();
  display.display();

  // Wi-Fi setup
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("WiFi Connected");

  // NTP setup
  configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);

  // Initial Screen
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);
  display.println("ESP32 Smartwatch");
  display.display();
  delay(2000);
}

void loop() {
  struct tm timeinfo;
  if (!getLocalTime(&timeinfo)) {
    display.clearDisplay();
    display.setCursor(0, 0);
    display.println("Failed to get time");
    display.display();
    delay(2000);
    return;
  }

  // Display time and date
  display.clearDisplay();
  display.setTextSize(2);
  display.setCursor(10, 10);
  display.printf("%02d:%02d:%02d", timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec);

  display.setTextSize(1);
  display.setCursor(20, 40);
  display.printf("%02d/%02d/%04d", timeinfo.tm_mday, timeinfo.tm_mon + 1, timeinfo.tm_year + 1900);

  display.display();
  delay(1000);
}

šŸ”Ž Working Principle

The ESP32 smartwatch works on the following principle:

  1. Wi-Fi Connectivity

    • The ESP32 connects to a Wi-Fi network and fetches the real-time clock data from an NTP (Network Time Protocol) server.
    • This ensures accurate timekeeping without requiring a dedicated hardware RTC module (though one can be added for offline use).
  2. Time Synchronization

    • Using the time.h library, the ESP32 synchronizes the system clock with the NTP server.
    • The GMT offset is applied to adjust the time according to the local time zone.
  3. Display Handling

    • An OLED display (SSD1306, 128Ɨ64 pixels) is used to show the time and date.
    • The display is refreshed every second to update the clock.
    • A graphical interface (text size, position, formatting) makes the output resemble a smartwatch screen.
  4. Low-Power Operation

    • The ESP32 can enter sleep modes to save battery, waking up at intervals to update the display.
    • With a Li-Po battery and charging module, the device can work as a wearable prototype.

šŸ Conclusion

The ESP32 smartwatch with OLED display demonstrates a low-cost, IoT-enabled wearable device prototype.
By leveraging the ESP32’s Wi-Fi connectivity and an OLED screen, the system successfully displays real-time time and date information in a compact form factor.

This project highlights the following:

  • Integration of IoT (NTP time sync) with embedded systems.
  • Practical use of ESP32’s connectivity and low-power features.
  • A foundation for extending into smart features such as Bluetooth notifications, fitness tracking, and cloud-based health monitoring.

Thus, the project provides students with both theoretical knowledge and hands-on experience in wearable electronics, embedded programming, and IoT applications.

Try this project in your browser

Compile code and simulate hardware output with EltroNerd Cloud IDE.

Launch Cloud IDE