How to Build a Rocket Launch Alarm Clock with ESP32
Morning alarm with countdown animation, launch lights, and liftoff sound
Updated

What you'll build
In this guide you will build a rocket-launch alarm clock using an ESP32, a DS3231 real-time clock module, a WS2812B LED ring, a piezo buzzer, an OLED display, and a pair of buttons for setting the time and alarm. When the alarm triggers, instead of a boring beep you get a full 10-second launch countdown -- the OLED displays large descending numbers, the LED ring fills up segment by segment like a fuel gauge, and at zero the LEDs burst into a fiery orange-and-white liftoff animation while the buzzer blasts an ascending rocket roar. A snooze button gives you five more minutes of pre-launch hold, and a dismiss button cuts the engines immediately.
The DS3231 is the gold standard for battery-backed real-time clocks in maker projects. Its temperature-compensated crystal oscillator maintains accuracy to within a couple of minutes per year, and it keeps ticking through power outages thanks to a coin-cell backup. In this project you will learn how to communicate with the DS3231 over I2C, set and read time registers, configure its built-in alarm interrupt to wake the ESP32 from deep sleep, and synchronize the displayed time on the OLED. You will also implement a simple two-button time-setting interface with long-press detection for fast-scrolling through hours and minutes -- a useful UX pattern for any embedded device with limited inputs.
The finished alarm clock is a genuinely useful bedside device that makes waking up a little more entertaining. Because the DS3231's alarm interrupt drives a hardware pin, the ESP32 can spend the night in deep sleep drawing microamps until launch time, making the project practical for battery-powered operation. From here you could add Wi-Fi time synchronization via NTP to eliminate manual time setting, integrate a light sensor to auto-dim the display at night, or swap the buzzer for a small amplifier and speaker to play actual rocket launch audio. It is a beginner-friendly project that teaches RTC interfacing, low-power design, and sequenced multimedia output in one satisfying build.
Wiring diagram
Wiring diagram
Components needed
Assembly
Set up timekeeping
Connect DS3231 RTC to I2C pins GPIO21 and GPIO22.
- Set correct time once before relying on alarm schedule.
Add launch feedback hardware
Connect LED ring on GPIO4, buzzer on GPIO26, and snooze button on GPIO27.
- Tune countdown tones for a more dramatic launch feel.
Pin assignments
| Pin | Connection | Type |
|---|---|---|
| GPIO 21 | rtc-1 SDA | I2C |
| GPIO 22 | rtc-1 SCL | I2C |
| GPIO 4 | launch-led-ring-1 DIN | DATA |
| GPIO 26 | launch-buzzer-1 SIG | PWM |
| GPIO 27 | snooze-button-1 SIG | DIGITAL |
Code
#include <Wire.h>
#include <RTClib.h>
#include <FastLED.h>
#define LED_PIN 4
#define NUM_LEDS 16
#define BUZZER_PIN 26
#define BTN_SNOOZE 27
RTC_DS3231 rtc;
CRGB leds[NUM_LEDS];
int alarmHour = 7;
int alarmMinute = 30;
bool alarmFiredToday = false;
void setup() {
Wire.begin(21, 22);
rtc.begin();
FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, NUM_LEDS);
pinMode(BTN_SNOOZE, INPUT_PULLUP);
pinMode(BUZZER_PIN, OUTPUT);
}
void runLaunchSequence() {
for (int t = 10; t >= 0; t--) {
fill_solid(leds, NUM_LEDS, CHSV((10 - t) * 20, 255, 180));
FastLED.show();
tone(BUZZER_PIN, 700 + t * 90, 120);
delay(220);
}
}
void loop() {
DateTime now = rtc.now();
if (now.hour() == alarmHour && now.minute() == alarmMinute && !alarmFiredToday) {
runLaunchSequence();
alarmFiredToday = true;
}
if (now.hour() == 0 && now.minute() == 0) alarmFiredToday = false;
if (!digitalRead(BTN_SNOOZE)) {
tone(BUZZER_PIN, 550, 120);
delay(300);
}
}
// Run this and build other cool things at schematik.ioReady to build this?
Open this project in Schematik to get the full wiring diagram, pin assignments, and deployable code for the Rocket Launch Alarm Clock.
Open in Schematik →


