M5StickC (ESP32) controls the accuracy of a small pendulum clock. The pendulum has a small magnet attached to it. The CPU detects pendulum vibration with a Hall sensor
(A3144), and determines the rate of the clock. It then compares with
the internet time, and depending on the difference, the coil under the pendulum pulls down
or push up the pendulum. This has the same effect as adjusting the
gravity.
Here is the close-up of pendulum, magnet, coil and Hall sensor.
The accuracy chart of the clock displayed on the M5StickC.
The chart below shows accuracy and current for about 4 hours. The blue line is clock accuracy (left scale in seconds). Once it gets stable, the deviation is within +/- 0.2 seconds. The red line is relative coil current. As the clock's mainspring gets unwound, the coil current is gradually changing.
Below is the schematic diagram. The clock has a tiny pendulum which weighs only 3.3 grams including the magnet, thus does not require much magnetic force
to change cycle time. So the coil is connected directly to the M5StickC GPIO with a series resistor of 100ohm.
Here is the video. The clock accuracy chart and the relative coil current chart are alternating every 5 seconds.