ESP32 Flip Clock for ESP32-C6
An ESP32 display project for ESP32-C6 involving TFT display, Touchscreen, Addressable LED strip.
Parts and sourceBefore you start
Check the exact TFT display, Touchscreen, Addressable LED strip configuration against the upstream wiring or parts list.
Upstream README
ESP32 Flip Clock
A 1970s-style split-flap ("flip") clock for the Waveshare ESP32-C6-LCD-1.47, styled after a Bodet flip clock: two wide flaps — hour and minute — each showing its full two-digit value and flipping as one mechanical unit, in a silver frame sized to hug the flaps tightly rather than floating them in a sea of black.

How it works
The flip animation. Each flap is really two half-images (top/bottom) composited at runtime from a shared glossy-card background and ten pre-rendered digit masks (0–9) — no per-value bitmaps are stored, a two-digit flap value is just its tens and ones digit masks drawn side by side. A digit change plays as two phases, each a vertical "squish": the old top half collapses upward into the hinge line (revealing the new top, which is already the background underneath), then a new bottom half grows downward from the hinge to cover the old one. Both phases sample the same half-height image compressed to a shrinking/growing row count, which is what a card's foreshortening looks like as it rotates — only the anchor point (hinge-fixed top edge vs. hinge-fixed bottom edge) differs between the two phases.
Time. This board has no RTC chip, so the time is read fresh from an NTP server at every boot and every 6 hours; there is nothing to fall back on across a power loss. Wi-Fi and the timezone (with its DST rule, so daylight saving needs no network) are set from your phone: with no Wi-Fi saved, or after holding the BOOT button for 2 seconds (this board has no touchscreen), the clock hosts a temporary Wi-Fi network and a captive-portal setup page. The same page also has a 12-hour (with AM/PM) vs. 24-hour style switch.
Hardware
Waveshare ESP32-C6-LCD-1.47: ESP32-C6 (RISC-V, native USB), 1.47" ST7789 172×320 display (no touch), 8 MB flash, no PSRAM, one onboard WS2812 RGB LED (unused here). Pins (from Waveshare's own schematic, not guessed):
| Function | GPIO |
|---|---|
| Display MOSI / SCLK | 6 / 7 |
| Display CS / DC / RST | 14 / 15 / 21 |
| Backlight | 22 |
| BOOT button | 9 |
hardware_check/hardware_check.ino is a small sketch that shows colour bars and cycles
the RGB LED — a quick way to confirm a board before flashing the clock onto it.
Build and flash
You need arduino-cli (the Arduino IDE's
bundled copy works), the ESP32 Arduino core 3.3.x, the GFX Library for Arduino
library, and Python 3 with pillow:
arduino-cli lib install "GFX Library for Arduino"
pip install pillow
cd FlipClock
tools/build.sh /dev/cu.usbmodemXXXX # leave the port off to only compile
tools/build.sh bakes the flap graphics (tools/bake_flip.py, generating
flip_assets.h, not committed) from a bold font already on your system, then compiles
and uploads. Two build settings matter, both already in the script: CDCOnBoot=cdc
(without it Serial produces no output at all over this board's native USB port — easy
to mistake for a hang) and the huge_app partition (Wi-Fi plus the web server code
in clock_net.h don't fit the default one).
If you don't have a bold condensed font like DIN handy, edit FONT_CANDIDATES at the
top of tools/bake_flip.py — any bold sans-serif works, it just won't look quite as
authentically split-flap.
Setup and controls
| Action | Effect |
|---|---|
| Hold BOOT 2 seconds | (Re)open the Wi-Fi/timezone/clock-style setup page |
Serial P (115200 baud) |
Same, from a computer |
Serial X |
Forget saved Wi-Fi |
Serial ? |
Print time source, timezone, clock style, saved Wi-Fi name |
Limitations
- No RTC: a power loss means no correct time until the next Wi-Fi/NTP sync.
- The setup Wi-Fi network is open (no password), and your home Wi-Fi password crosses it once, in plain HTTP. It's up only during setup and only in Wi-Fi range, but treat it the same as any other unencrypted-setup IoT gadget.
- This panel has no readback line (SPI in only), so there's no way to grab a screenshot from the device itself the way some of the other projects here can.
Credits and licences
Code is MIT (see LICENSE). Nothing else is stored in the repo:
- The digit font is whatever bold font you already have installed (see
tools/bake_flip.py); none is bundled here. - Libraries: GFX Library for Arduino
and the ESP32 Arduino core's own
WiFi,WebServer,DNSServer,Preferences(all bundled with the core, no separate install).