This ESP32 smartwatch design demonstrates how to build a functional wearable device with a small OLED display and physical button controls. The project combines an SSD1306 128x64 pixel display with two push buttons to create an interactive interface capable of displaying time, running a stopwatch, and adjusting settings.
The guide includes a complete wiring diagram showing how to connect the OLED screen via I2C and wire up the two control buttons to GPIO pins on the ESP32. Readers will receive the full firmware with debounced button handling, a multi-page interface system, and real-time clock functionality, along with step-by-step assembly instructions for mounting and powering the prototype.
Wiring diagram

Gather all the parts
Assemble it in 3 steps
1. Connect the OLED screen
Unplug USB. Connect VCC to 3V3 and GND to GND. Connect SDA to GPIO21 (display data) and SCL to GPIO22 (display clock).
- Read the pin labels: some OLED modules swap VCC and GND. Reversed power can damage the screen.
2. Connect the two buttons
Connect the Mode button SIGNAL to GPIO25 and GND to GND. Connect the Action button SIGNAL to GPIO26 and GND to GND. The firmware uses internal pull-up resistors.
- On four-leg switches, use contacts on opposite sides that only connect when pressed; same-side legs are usually already connected.
3. Mount and power the prototype
Mount the board, display, and buttons in an insulated enclosure with no exposed contacts against skin. Power through the board USB socket. Keep the USB socket accessible.
- Mode cycles clock, stopwatch, set hour, and set minute. Action changes the selected setting or starts/pauses the stopwatch. On the clock page, Action resets the stopwatch. Time starts at 12:00 after power loss.
- This is a bulky USB-powered prototype, not waterproof. No battery or charging circuit is included. Never connect a bare lithium battery to the board.
Review all connections
1. Connections between "screen" and "ESP32"
2. Connections between "mode" and "ESP32"
3. Connections between "action" and "ESP32"
Deploy the firmware
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(128,64,&Wire,-1);
struct Button {
int pin; bool raw=true, stable=true; uint32_t changed=0;
bool pressed(uint32_t now) {
bool v=digitalRead(pin);
if(v!=raw){raw=v;changed=now;}
if(v!=stable && uint32_t(now-changed)>=30){stable=v;return !v;}
return false;
}
};
Button mode{25}, action{26};
uint32_t clockSec=12*3600, tick=0, elapsed=0, previous=0;
bool running=false, dirty=true;
uint8_t page=0;
String lastFrame;
void setup(){
Serial.begin(115200);
pinMode(25,INPUT_PULLUP); pinMode(26,INPUT_PULLUP);
Wire.begin(21,22);
if(!display.begin(SSD1306_SWITCHCAPVCC,0x3C)){
Serial.println("OLED failed: check wiring and 0x3C address");
while(true) delay(1000);
}
display.setTextColor(SSD1306_WHITE);
display.setTextWrap(false);
tick=previous=millis();
}
void loop(){
uint32_t now=millis(), delta=now-previous; previous=now;
if(running) elapsed+=delta;
uint32_t seconds=(now-tick)/1000;
if(seconds){clockSec=(clockSec+seconds)%86400;tick+=seconds*1000;}
if(mode.pressed(now)) {page=(page+1)%4;dirty=true;}
if(action.pressed(now)) {
if(page==0){elapsed=0;running=false;}
if(page==1) running=!running;
if(page==2) clockSec=(clockSec+3600)%86400;
if(page==3) {clockSec=(clockSec/3600)*3600+((clockSec/60+1)%60)*60;tick=now;}
dirty=true;
}
char text[24];
if(page==1) snprintf(text,sizeof(text),"%02lu:%02lu:%02lu",(unsigned long)(elapsed/3600000),(unsigned long)(elapsed/60000%60),(unsigned long)(elapsed/1000%60));
else snprintf(text,sizeof(text),"%02lu:%02lu:%02lu",(unsigned long)(clockSec/3600),(unsigned long)(clockSec/60%60),(unsigned long)(clockSec%60));
String frame=String(page)+text+(running?"R":"S");
if(dirty || frame!=lastFrame){
dirty=false;lastFrame=frame;
display.clearDisplay();display.setTextSize(1);display.setCursor(0,0);
const char* titles[]={"SCHEMATIK WATCH","STOPWATCH","SET HOUR","SET MINUTE"};
display.print(titles[page]);display.setTextSize(2);display.setCursor(0,22);display.print(text);
display.setTextSize(1);display.setCursor(0,49);
const char* hints[]={"A: reset stopwatch","A: start / pause","A: hour +1","A: minute +1"};
display.print(hints[page]);display.setCursor(0,57);display.print("M: next page");display.display();
}
delay(5);
}Remix this project
Make it yours in one click
Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.




