Posted by Michael Gilligan on 26/12/2020 22:47:39:
This might be worth a look : **LINK**
MichaelG.
It is! Thanks, I'll give that a try.
Latest report, over the holiday I've rushed through various changes designed to improve clock monitoring over at least 24 hours. And silly mistakes bit me on the bum every time!
At present, the clock is set up to measure time in three ways:
- The clock measures each tick internally using the Arduino's 16MHhz crystal oscillator (which will be replaced with a TXCO when I remember where I left it.)
- The clock outputs HHMMSS.ssssss based on counting ticks, where each tick is assumed to be of average length (as determined from a previous run)
- Both of the clock's notions of time are compared with UNIX time (set and updated by NTP)
The graphs from last night show a few problems:

The top graph, showing period measured by Arduino crystal, looks fairly stable apart from 4 glitches, until about 9am when the pendulum runs wild eventually stopping at 11:10am. Cause of stoppage unknown, but it may be due to rising temperature, or this morning's bright sunshine confusing the sensor. Zooming in on the period graph shows more trouble in the detail:

This graph shows the pendulum to be stable at first, except it gradually speeds up. Then period settles at about 0.9324s except it bounces ever more wildly until midnight, then gradually calming down until it stabilises somewhat unpredictably at about 5:15. Again, cause unknown.
Zooming in on one of descending glitches shows these are odd too:

It isn't a single event, rather the pendulum speeds up, does about 40 quick ticks, and then returns to the average. I've no idea what would cause a pendulum to do that!
My next problem is mathematical and although I'm sure the answer is easy I've failed utterly to do the algebra.
At the moment, the Arduino calculates HHMMSS by assuming every tick is average, which isn't true. Apart from the wildness noted above, according to the data the pendulum reacts to heat, air pressure and humidity. (Still to be proven, but I'm fairly certain the Arduino responds to heat, not the pendulum.) A little difficult to disentangle the two, but there's strong evidence the pendulum is influenced by both air-pressure and humidity. Higher air pressure reduces the weight of the bob and increases air resistance slightly. To make a rod, carbon-fibres are embedded in a resin matrix and it's likely the matrix is sensitive to humidity.
As the clock knows what temperature, air pressure, and humidity are, I want to correct the average tick by applying a compensating formula. Linear Regression gives the following y = mx + c values:
ticks = x, temp = y : -19.98002063 35.27297589
ticks = x, humidity = y : 52.18719052 16.32451551
ticks = x, pressure = y : 81.65298034 901.6873213
How do you convert a y = mx + c slope into the corresponding correction? For example, given the period of a tick tick at a known temperature, how do you calculate value of tick for any other temperature?
I thought this was easy until I tried to do it . Brain refused to cooperate as soon as I put pencil to paper…
Dave
Edited By SillyOldDuffer on 27/12/2020 14:16:19
Edited By SillyOldDuffer on 27/12/2020 14:18:16