Skip to content

rybitski/Pixel-Clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pixel Clock

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.

Project Gallery

Web UI

Pixel Clock UI Dashboard Pixel Clock UI Setup

Finished Look

Pixel Clock Rainbow

Wiring Reference

Pixel Clock Wiring

Segment Build Detail

Segment Detail

Lens Fitment

Lens Fitment

Features

  • 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 (###F for 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)

Hardware

Controller

  • WeMos D1 mini / ESP8266

Pins

  • LED data pin: D4
  • LDR analog input: A0

LED Protocol

  • 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

Segment Layout and Chain 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 vertical
  • B = top horizontal
  • C = upper-right vertical
  • D = lower-right vertical
  • E = bottom horizontal
  • F = lower-left vertical
  • G = middle horizontal

Default chain order: ABCDEFG

LED Count Formula

Total LEDs used:

total = (segmentPixels * 28) + (hasColon ? colonPixels : 0)

Fabrication (CAD Files)

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 File Guide

  • 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.dxf
  • CAD Files/lens size 2.dxf
  • CAD Files/lens size 3.dxf
  • CAD 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.

Quick Start (New Builder)

  1. Clone this repo and open it in PlatformIO.
  2. Build firmware:
    pio run
  3. Flash firmware:
    pio run -t upload
  4. Open serial monitor (optional but recommended):
    pio device monitor -b 115200
  5. On first boot, connect to the WiFiManager AP and configure your WiFi.
  6. Open the web UI at:
    • http://<device-ip>/
    • http://<mdns-name>.local/ (default mDNS: largeclock)
  7. In Setup, configure:
    • Pixels/segment and colon pixel count
    • Segment chain order
    • NTP/timezone/time format
    • LDR thresholds/brightness steps
    • MQTT settings (optional)
  8. Save settings and verify live output on Dashboard.

Web UI Overview

Dashboard

  • Live clock + pixel preview
  • Runtime controls for color/effect/brightness/colon blink
  • Apply Dashboard Settings for immediate (non-persistent) change
  • Save As Boot Default to persist dashboard values

Setup

  • 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

MQTT Integration

Enable MQTT in Setup first.

Default base topic:

  • clock/large

Telemetry Publish

Topic:

  • <baseTopic>/telemetry

Typical payload fields:

  • time
  • solidColor
  • effect
  • use24Hour
  • baseBrightness
  • appliedBrightness
  • ldr
  • ip
  • tempDisplayActive
  • tempF

Command Topic: Display Control

Topic:

  • <baseTopic>/cmd/set

Payload example:

{
  "solidColor": "#00AEEF",
  "effect": 1,
  "effectSpeed": 120,
  "baseBrightness": 140,
  "use24Hour": false,
  "save": false
}

Notes:

  • solidColor accepts hex string (#RRGGBB) or integer
  • effect range: 0..9
  • baseBrightness range: 1..255
  • save: true writes changes to persistent config

Command Topic: Temperature Override

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 durationMs then returns to clock mode
  • If durationMs omitted, uses configured Temp Display Duration (ms)

Customizing for Your Build

To adapt this project to your own hardware:

  1. Set your segment pixel count accurately.
  2. Set colon LEDs installed + colon count.
  3. Adjust segment chain order to match physical wiring.
  4. Calibrate LDR thresholds and dim levels at day/night light.
  5. Set your timezone offset and preferred 12h/24h format.
  6. Set your default effect/color/brightness.
  7. Optionally connect MQTT and automate with Home Assistant or broker scripts.

Troubleshooting

  • 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.

Project Structure

  • src/main.cpp firmware + embedded web UI
  • ui-preview.html browser preview of UI design
  • CAD Files/ CNC and laser DXF files for enclosure and lenses
  • images/ README assets and build photos
  • platformio.ini PlatformIO configuration

License

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/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors