Software apps and online services
A while ago, I mentioned to some of my co-workers that is it possible to make a simple split-flip display. (I actually made one with cardboards and toothpicks, and it looks...not pretty.) A guy digged out this clock set and give it to me, which he bought a few years ago for research but never assembled.
This is in fact a DIY radio clock called パタパタ電波時計 ("pa-ta pa-ta (flapping sound) radio clock") back in April 2013 from a Japanese magazine 大人の科学 ("Science for Adults"). A translated Chinese version was published in Taiwan in 2014. This magazine always give you something to build: mini electric guitar, planetarium, phonograph, little automation robot, vacuum tube AM radio, small printing press machine, etc.
The translated version never sell well, as far as I have heard.
As the name suggested, the radio clock is calibrated via radio signal. However the signal is way too weak to receive in Taiwan and making it useless. Some people use apps to artificially generate the signal, in very close range and very quiet environment. But it is not really practical.
The two split-flip displays of the clock are driven by two DC motors. I realized that the principle is pretty simple: when one motor is powered, a lever would push the outer gear forward, however the it would be immediately stopped by another lever. Cut off motor power, and the first lever would fall back to the original position. So every time you give and cut power to one motor, it would turn the display exactly one notch forward. There are also two metal contacts outside the gears, which can be used to determine when they have reached the default positions (zeros).
So I decided to modified it into a web clock. (I actually bought my own clock set, so that I can finish the modifications and experiments at home. Luckily they never sell well, so still available 6 years later...) The motors are be controlled by a LS9110S drive board, and the metal contacts are connected to the pins of the microcontroller board. I also installed two buttons which I bought for another project but didn't used, to replace the original ones.
At first I tried to use a ESP8266 board...and found out they don't have enough GPIO pins for this. So I used one of my ESP32 boards instead, a NodeMCU-32S. (It's slightly longer than ESP8266 NodeMCU V2 with the same width, which can be fitted into the half breadboard, and pin numbers are written underneath the board.)
I also added a DS3231 RTS (real time system) module I bought some time ago, to store and count the time more accurately, and add a TM1637 4-digit LED display and a RGB LED module to display some system status.
A power supply module (~700mA) powered most of the external components, because the ESP32 itself eats a lot of power for WiFi alone! (and due to some reason I cannot power it directly via the 5V pin. So right now two separate power source is required.)
This project is coded and tested in MicroPython v1.11. The DS3231 library I used can be found here and the TM1637 library is here. For more information of the World Time API, check out my another project Very Simple MicroPython ESP8266/ESP-12 Web Clock.
This is how the web clock runs:
1. Turn both motors until both display reached default positions, thus synchronize the hardware and software (hour and minute variables also set to 0).
2. Initialize DS3231 and TM1637 module. (Do it now to avoid potential voltage drop in step 1.)
3. Connect to WiFi. (the RGB led would blink in different colors to indicate the progress of the first 3 steps.)
4. Now into the main loop:
a. for every 3600000 ms (1 hour), query web time API, retrieve JSON data and extract time, then update system software RTS as well as the DS3231 module.
b. for every 250 ms, read time from the DS3231 (if possible; otherwise use the system RTS time) and see if the displays are needed to be turned.
c. turn the motors if the user press the buttons (manual calibration).
d. the RGB led would change color every time the motors are turned.
e. the TM1637 displays the actual RTS time, so that user can manually calibrate the clock if needed. Its brightness will be dimmed if the ESP32 loses WiFi connection.