This Arduino project implements a hollow clock using an ESP8266, and other libraries. The clock's hands move to display the current time, and it is designed to be configurable for different WiFi networks. The project is based on this project on instructables.
- Displays the time on a hollow clock face using stepper motors.
- Connects to multiple WiFi networks for flexibility.
- Dashboard-based calibration flow (
Hour+Minute+Start Reset) so startup alignment is easier. - Modernized web dashboard UI with improved layout and automatic dark-mode support (
prefers-color-scheme). - Configurable NTP server and intuitive timezone settings via
UTC_OFFSET_HOURSandUTC_OFFSET_MINUTES. - Optional static IP mode via
USE_STATIC_IPand configurable address/gateway/subnet/DNS values. - Modularized code structure for easier maintenance (
web_ui,wifi_service,clock_time).
- ESP8266 microcontroller
- Stepper motors
- Other hardware components as required
-
Clone this repository.
-
Copy
config_CUSTOMIZE_ME.htoconfig.hand update the WiFi credentials. -
Set
UTC_OFFSET_HOURSandUTC_OFFSET_MINUTESinconfig.hfor your local timezone. China Standard Time is8hours and0minutes. -
Set
NTP_SERVERinconfig.hif you want to override the default time source. The default isntp.aliyun.com. -
Optional: enable static IP by setting
USE_STATIC_IPto1and filling these values inconfig.h:STATIC_IP_ADDRESSSTATIC_IP_GATEWAYSTATIC_IP_SUBNETSTATIC_IP_DNS1STATIC_IP_DNS2
Leave
USE_STATIC_IPas0to keep DHCP behavior. -
Open
hollow_clock_wifi.inoin Arduino IDE, or use Arduino CLI.
GitHub Actions also builds the firmware automatically on every push and pull request. The compiled files are uploaded as the firmware-esp8266-nodemcuv2 artifact. When you publish a GitHub Release, the workflow also attaches the generated .bin and .elf firmware files directly to that release.
You can flash the clock in two ways:
-
Install the ESP8266 board package:
arduino-cli core install esp8266:esp8266 \ --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
-
Compile the sketch:
arduino-cli compile --fqbn esp8266:esp8266:nodemcuv2 \ --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json \ /home/uniqueding/Workspace/hollow_clock_wifi
-
Find the serial port:
arduino-cli board list
-
Upload to the board:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp8266:esp8266:nodemcuv2 \ /home/uniqueding/Workspace/hollow_clock_wifi
If your user does not have serial-port permissions yet, either log in again after joining the correct device group or use
sudotogether with the same--additional-urlsvalue used above.
-
Download the
.binfile from the GitHub Actions artifact or GitHub Release. -
Install
esptoolif needed:python -m pip install esptool
-
Find the serial port:
arduino-cli board list
-
Write the firmware directly to flash:
python -m esptool --port /dev/ttyUSB0 --baud 460800 write_flash 0x0 firmware.bin
Replace
firmware.binwith the actual downloaded.binfilename. -
If flashing fails because the board is not in bootloader mode, hold the
FLASHorBOOTbutton while resetting the ESP8266, then run the command again.
-
Power on the ESP8266 with the uploaded firmware.
-
Open the dashboard page from your browser.
-
In
Calibration, enter the current hand position (HourandMinute). -
Click
Start Reset. -
The clock moves from the entered hand position to the current NTP time and then keeps tracking normally.
hollow_clock_wifi.ino- Main application flow and motor control loop.web_ui.h/web_ui.cpp- Dashboard rendering and web route wiring (including calibration endpoint).wifi_service.h/wifi_service.cpp- WiFi connection helper logic.clock_time.h/clock_time.cpp- Time-sync, uptime formatting, and time-to-step calculations.dashboard.h/dashboard.cpp- Reusable lightweight dashboard component and page template.
This project is licensed under the MIT License.

