A customizable 4-digit seven-segment WS2812/NeoPixel clock for ESP8266 (WeMos D1 mini), with a built-in web UI, MQTT automation, OTA updates, and LDR auto-dimming.
- 4-digit seven-segment clock with optional colon LEDs
- Web UI for live control and persistent setup
- WiFiManager captive portal for first-time WiFi setup
- NTP sync (public internet NTP or local NTP server)
- Timezone offset and 12h/24h display mode
- 10 display effects:
- Solid
- Rainbow Sweep
- Rainbow Cycle
- Breathing
- Theater Chase
- Twinkle
- Fire
- Meteor
- Per-Digit Cycle
- Minute Wipe
- MQTT telemetry publishing
- MQTT command control (color, effect, brightness, time format)
- MQTT temperature override display (
###Ffor configurable duration) - LDR-based 3-step brightness automation
- mDNS hostname + DHCP/static IP support
- OTA firmware updates from web UI
- Persistent config via LittleFS (
/config.json)
- WeMos D1 mini / ESP8266
- LED data pin:
D4 - LDR analog input:
A0
- Supported:
WS2812/WS2812B(5V, 800kHz, GRB order) - Firmware driver mode:
NEO_GRB + NEO_KHZ800 - Other RGB strips may work only if they use the same timing and color order
The clock supports configurable physical segment chain order from the UI (Segment Chain Order (A-G)), so you can match different wiring layouts without code edits.
UI segment labels are:
A= upper-left verticalB= top horizontalC= upper-right verticalD= lower-right verticalE= bottom horizontalF= lower-left verticalG= middle horizontal
Default chain order: ABCDEFG
Total LEDs used:
total = (segmentPixels * 28) + (hasColon ? colonPixels : 0)
This repository includes the CAD files used to build this clock enclosure.
- Folder:
CAD Files/ - Clock body material: 3/4 in MDF (CNC routed)
- Lens material: translucent white acrylic (laser cut)
CAD Files/clock-face.dxf- Main clock face/profile for CNC routing.
CAD Files/lens TEST SIZES.dxf- Contains 4 different lens size options for fit testing.
- Recommended workflow: laser-cut one of each size first, test fit, then select the best size.
CAD Files/lens size 1.dxfCAD Files/lens size 2.dxfCAD Files/lens size 3.dxfCAD Files/lens size 4.dxf- Final lens cut files for each tested size.
Note: the lens sheets were prepared for making multiple clocks (about 4), so some files may contain more lens parts than needed for a single build.
- Clone this repo and open it in PlatformIO.
- Build firmware:
pio run
- Flash firmware:
pio run -t upload
- Open serial monitor (optional but recommended):
pio device monitor -b 115200
- On first boot, connect to the WiFiManager AP and configure your WiFi.
- Open the web UI at:
http://<device-ip>/http://<mdns-name>.local/(default mDNS:largeclock)
- In Setup, configure:
- Pixels/segment and colon pixel count
- Segment chain order
- NTP/timezone/time format
- LDR thresholds/brightness steps
- MQTT settings (optional)
- Save settings and verify live output on Dashboard.
- Live clock + pixel preview
- Runtime controls for color/effect/brightness/colon blink
Apply Dashboard Settingsfor immediate (non-persistent) changeSave As Boot Defaultto persist dashboard values
- Hardware layout and chain mapping
- Time and network setup (including mDNS and IP mode)
- Auto-dim calibration
- MQTT setup and command reference
- OTA firmware upload
Enable MQTT in Setup first.
Default base topic:
clock/large
Topic:
<baseTopic>/telemetry
Typical payload fields:
timesolidColoreffectuse24HourbaseBrightnessappliedBrightnessldriptempDisplayActivetempF
Topic:
<baseTopic>/cmd/set
Payload example:
{
"solidColor": "#00AEEF",
"effect": 1,
"effectSpeed": 120,
"baseBrightness": 140,
"use24Hour": false,
"save": false
}Notes:
solidColoraccepts hex string (#RRGGBB) or integereffectrange:0..9baseBrightnessrange:1..255save: truewrites changes to persistent config
Topic:
<baseTopic>/cmd/tempF
Accepted payload formats:
- Raw number:
72 - JSON object:
{ "tempF": 72, "durationMs": 8000 }
Behavior:
- Displays up to 3 digits plus
F - Holds for
durationMsthen returns to clock mode - If
durationMsomitted, uses configuredTemp Display Duration (ms)
To adapt this project to your own hardware:
- Set your segment pixel count accurately.
- Set colon LEDs installed + colon count.
- Adjust segment chain order to match physical wiring.
- Calibrate LDR thresholds and dim levels at day/night light.
- Set your timezone offset and preferred 12h/24h format.
- Set your default effect/color/brightness.
- Optionally connect MQTT and automate with Home Assistant or broker scripts.
- Incorrect digits/segments: verify
Segment Chain Order (A-G)and pixel counts. - MQTT commands not working:
- Confirm base topic and topic case
- Confirm UI shows
MQTT: online - Use valid JSON payloads for object commands
- Device reboots after network config edits: expected behavior when mDNS/IP mode/address changes.
- Brightness limits: valid range is
1..255.
src/main.cppfirmware + embedded web UIui-preview.htmlbrowser preview of UI designCAD Files/CNC and laser DXF files for enclosure and lensesimages/README assets and build photosplatformio.iniPlatformIO configuration
This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license (CC BY-NC-SA 4.0).
See LICENSE for details, or read the full legal code at:
https://creativecommons.org/licenses/by-nc-sa/4.0/