Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsThe pomodoro technique alternates 25 minutes of work with 5 minutes of rest. This timer counts down on an OLED, beeps when the period ends and switches to the next one automatically. One push button starts, pauses or resets it. It uses millis() so the countdown is steady, and the ESP32's built-in pull-up keeps the wiring to a single button.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB power bank or charger.
pomodoro.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const int BTN = 14, BUZ = 25;
const int WORK_MIN = 25, BREAK_MIN = 5;
bool working = true, running = false;
long remaining = WORK_MIN * 60;
unsigned long lastTick = 0, pressedAt = 0;
bool wasDown = false;
void beep(int n) { for (int i = 0; i < n; i++) { digitalWrite(BUZ, HIGH); delay(150); digitalWrite(BUZ, LOW); delay(150); } }
void draw() {
oled.clearDisplay(); oled.setTextColor(WHITE);
oled.setTextSize(1); oled.setCursor(0, 0); oled.print(working ? "WORK" : "BREAK"); oled.print(running ? "" : " (paused)");
oled.setTextSize(4); oled.setCursor(0, 24);
oled.printf("%02ld:%02ld", remaining / 60, remaining % 60);
oled.display();
}
void setup() {
pinMode(BTN, INPUT_PULLUP);
pinMode(BUZ, OUTPUT);
Wire.begin(21, 22);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
draw();
}
void loop() {
bool down = digitalRead(BTN) == LOW;
if (down && !wasDown) pressedAt = millis();
if (!down && wasDown) {
if (millis() - pressedAt > 2000) { running = false; working = true; remaining = WORK_MIN * 60; }
else { running = !running; lastTick = millis(); }
draw();
}
wasDown = down;
if (running && millis() - lastTick >= 1000) {
lastTick += 1000;
if (--remaining <= 0) {
working = !working;
remaining = (working ? WORK_MIN : BREAK_MIN) * 60;
beep(3);
}
draw();
}
}
Wire it between GPIO 14 and GND; the code uses the internal pull-up.
Keep delays out of loop() so the one-second tick stays accurate.
Check the pin and whether your module is active or passive.
Yes, WORK_MIN and BREAK_MIN at the top of the sketch.
Yes. Use a power bank.
Yes. Add a counter and show it on the screen.
6 parts: ESP32-WROOM-32 38-Pin Development Board, 0.96" OLED Display 128x64, Tactile Push Button Switch, Buzzer Module 3.3–5V, Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 1 hour. The build on this page has 6 steps.
No. This page has the complete, tested code (pomodoro.ino).
About ₹629 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Building a state machine for work and break; Reading a button with a pull-up; Formatting minutes and seconds.
Ideas that reuse this build: ESP32 knob countdown timer. They are listed under Take it further on this page.
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Press to roll: the pips tumble and slow down before landing on a number.
Wait for the light, hit the button: how many milliseconds can you beat?
A bright 4-digit clock that keeps time through power cuts.
Learning project. Check every circuit and the datasheet of each part before you power it up.