|
| 1 | +# SPDX-FileCopyrightText: 2026 Pedro Ruiz for Adafruit Industries |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: MIT |
| 4 | + |
| 5 | +# MatrixPortal S3 Analog Clock |
| 6 | + |
| 7 | +An analog clock for the Adafruit MatrixPortal S3 with a 32x32 RGB LED |
| 8 | +matrix panel. The clock displays hour and minute hands over a gradient |
| 9 | +background that shifts through four color palettes across the day. |
| 10 | +Designed for use with a diffuser panel for a soft, blurred aesthetic |
| 11 | +inspired by LED artwork behind thick resin. |
| 12 | + |
| 13 | +## Hardware |
| 14 | + |
| 15 | +- [Adafruit MatrixPortal S3](https://www.adafruit.com/product/5778) |
| 16 | +- [32x32 RGB LED Matrix - 4mm Pitch (PID 607)](https://www.adafruit.com/product/607) |
| 17 | +- LED matrix diffuser panel (optional, recommended) |
| 18 | +- USB-C power supply |
| 19 | + |
| 20 | +No Address E jumper is needed for the 32x32 panel. |
| 21 | + |
| 22 | +## CircuitPython Libraries |
| 23 | + |
| 24 | +Install the following from the |
| 25 | +[CircuitPython Library Bundle](https://circuitpython.org/libraries) |
| 26 | +into the `/lib` folder on your CIRCUITPY drive: |
| 27 | + |
| 28 | +- `adafruit_ntp.mpy` |
| 29 | + |
| 30 | +These are only required for WiFi/NTP mode. The clock also runs in |
| 31 | +offline manual mode without them. |
| 32 | + |
| 33 | +## Installation |
| 34 | + |
| 35 | +1. Install [CircuitPython](https://circuitpython.org/board/adafruit_matrixportal_s3/) |
| 36 | + on the MatrixPortal S3 |
| 37 | +2. Copy the required libraries to `/lib` on the CIRCUITPY drive |
| 38 | +3. Copy `settings.toml` and `code.py` to the root of the CIRCUITPY drive |
| 39 | +4. Edit `settings.toml` with your WiFi credentials and standard UTC |
| 40 | + offset (e.g. `-5` for US Eastern, `-8` for US Pacific) |
| 41 | + |
| 42 | +## Usage |
| 43 | + |
| 44 | +### Boot Modes |
| 45 | + |
| 46 | +**WiFi mode** — If valid WiFi credentials are in `settings.toml`, the |
| 47 | +clock connects to WiFi, syncs time via NTP, and starts the clock |
| 48 | +automatically. Time re-syncs every hour. |
| 49 | + |
| 50 | +**Offline mode** — If no WiFi credentials are found or the connection |
| 51 | +fails, the display shows a message and enters a manual time-set screen: |
| 52 | + |
| 53 | +- **UP button (short press)** — Increment the blinking value |
| 54 | +- **DOWN button (short press)** — Toggle between hours and minutes |
| 55 | +- **Long press either button (1.5s)** — Confirm time and start clock |
| 56 | + |
| 57 | +### Controls (Clock Running) |
| 58 | + |
| 59 | +- **UP button (short press)** — Toggle wave animation speed (calm / fast) |
| 60 | +- **UP button (long press 1.5s)** — Cycle display rotation (0° → 90° → |
| 61 | + 180° → 270°) for different USB cable mounting directions |
| 62 | +- **DOWN button** — Cycle background palettes (morning → day → evening → |
| 63 | + night → auto) |
| 64 | + |
| 65 | +### Time Periods |
| 66 | + |
| 67 | +The background gradient changes automatically based on the time of day: |
| 68 | + |
| 69 | +| Period | Hours | Gradient | Hand Color | |
| 70 | +|---------|-------------|---------------------------------|------------| |
| 71 | +| Morning | 6 AM–12 PM | Purple → Gold → Olive Green | Cyan | |
| 72 | +| Day | 12 PM–5 PM | Blue → Pale Blue → Sandy Tan | Orange | |
| 73 | +| Evening | 5 PM–8 PM | Teal → Salmon → Periwinkle | Yellow-Green | |
| 74 | +| Night | 8 PM–6 AM | Pink → Purple → Blue | Yellow | |
| 75 | + |
| 76 | +Color palettes are inspired by the Florida Arts License Plate. |
| 77 | + |
| 78 | +### Daylight Saving Time |
| 79 | + |
| 80 | +US Daylight Saving Time is computed automatically from the NTP date |
| 81 | +(2nd Sunday in March through 1st Sunday in November). Set |
| 82 | +`TZ_STD_OFFSET` in `settings.toml` to your standard UTC offset (e.g. |
| 83 | +`-5` for Eastern) and `DST_AUTO = "true"`. The clock adds +1 hour |
| 84 | +during DST with no external API dependency. |
| 85 | + |
| 86 | +For non-US timezones or locations that don't observe DST, set |
| 87 | +`DST_AUTO = "false"` and use the correct fixed offset. |
| 88 | + |
| 89 | +### Features |
| 90 | + |
| 91 | +- Animated wave effect on the background gradient |
| 92 | +- Radial glow vignette (brighter center, dimmer edges) |
| 93 | +- Soft glow halo around clock hands |
| 94 | +- Twinkling yellow stars during nighttime mode |
| 95 | +- Plus-shaped hour markers at each 5-minute position |
| 96 | +- NTP time sync with offline fallback |
| 97 | +- Manual time set for use without WiFi |
| 98 | + |
| 99 | +## Customization |
| 100 | + |
| 101 | +Key values to adjust at the top of `code.py`: |
| 102 | + |
| 103 | +- `WAVE_SPEED` / `WAVE_SPEED_FAST` — Animation speeds |
| 104 | +- `WAVE_AMP` — Wave intensity (row displacement) |
| 105 | +- `GRAD_*` — Background gradient color stops per period |
| 106 | +- `HAND_*` — Hand colors per period |
| 107 | +- `MARKER_*` — Hour marker colors per period |
| 108 | +- `MORNING_HOUR`, `DAY_HOUR`, `EVENING_HOUR`, `NIGHT_HOUR` — Period |
| 109 | + boundaries (24-hour format) |
| 110 | +- `BG_MULTS` — Radial glow brightness tiers |
| 111 | +- `GLOW_RADIUS` — How far the center glow extends |
| 112 | +- `STARS` — Star positions and twinkle phase offsets |
| 113 | + |
| 114 | +Key values in `settings.toml`: |
| 115 | + |
| 116 | +- `TZ_STD_OFFSET` — Standard UTC offset (e.g. `-5` for Eastern) |
| 117 | +- `DST_AUTO` — Enable/disable US DST computation |
| 118 | +- `DISPLAY_ROTATION` — Default rotation (0, 90, 180, 270) |
0 commit comments