Hi, I am working on a project that will track how accurate each second of a pendulum clock is to track how the time drifts. Ideally I want it to an accuracy of about 0.1ms. So my rough plan is to have a GPS, possibly with a repeater as it'll be inside, to get a 1PPS signal and then some method for between this (either RTC 32K signal or just using the arduino). I don't particularly want to have to connect to WiFi either. Does anyone have suggestions on how to get time to that level of accuracy? I probably will need to test a few methods to compare the accuracy of the second on each so even just suggestions on different methods to test would be helpful
You seem to be ignoring the pendulum clock. How will you detect the pendulum time?
A pendulum clock with a display of 1/10,000th of a second... ![]()
Surely not made for humans.
Leo..
On ATmega chip running 16MHz (classic old UNO, nano etc) you can set timer to run at system clock speed and then read it. It gives you accuracy of 1/16 uSec. To detect change on IO pin you can use interrupt on change (or rise/fall ..) and tight loop of RJMP jumping to itself which is 2 clock loop and so the accuracy is 1/8 uSec (if you use the timer) with constant latency, which can be enumerated. It is 0. 000 000 125 sec or 0. 000 125 ms precision.
So you may be able measure intervals with this precission.
It is up to you, how to use this insane accuracy and what inputs you have.
Probabelly you will first measure one second interval from GPS to calibrate your measurments, then measure intervals of the pendulum. As we talk about 8MHz precision, you may need to consider your circuit and your pendulum sensors too, to know, what noise it takes into the system.
(And ofcourse you cannot have any other interrupts interfering with it, like Serial, wifi or others)
Nor can you have temperature changes during your test period.
Yes, all that depends on how precise you want to be. But small temperature fluctuation will make less inaccuracy then unexpected inerrupt ![]()
And the method of measuring the pendulum may have even more inaccuracy inside, or not, who knows? ![]()
Agreed. Perhaps the OP will report back in a year or so.
It just clicked.
I think OP wants to measure the tick time (one pendulum swing),
to instantly see if the clock runs fast or slow.
Leo..
I did read it the same way.
One of the challenges could be a slot sensor for the pendulum.
Or maybe use a contact microphone, to listen to the tick of the escapement.
It might need several swings or ticks to reach that accuracy.
Clocks and watches have a measurably inaccuracy between tick times.
I worked once with a tick time sensor for wrist watches (Timegrapher).
You could clearly see that expensive watches did much better than cheap ones.
There are timegrapher apps for a mobile phone.
Leo..
You could using an Arduino with a Crystal oscillator, or even replace that with a higher-accuracy crystal oscillator of some kind.
Or an inductive proximity switch?
I would look for a board that has a clock crystal input (32768). Then purchase a precision crystal.
I would use a LED Interrupter to insure you sensing does not interfere with the pendulum. Or perhaps a microphone or vibration sensor to “listen” for the ticks.
You will have to measure the cycle and have some ability to collect a lot of data or capture the longest and shortest cycle as the cycle is going to change over a day.
A 32.768kHz oscillator is good for counting seconds, which makes it useful for an RTC.
However it doesn't do milliseconds very well.
A higher frequency divisible by 1000 or 10000 would be a better option.
Hi, @jammie_dodger
Welcome to the forum.
This may help, it had quite a few links to "watch analysers".
Tom....
![]()
Why would you want to time a single "tick"? To get a "precise" measurement of the timing it would make sense to count a LOT of ticks, and measure the time taken.
Pendulum swings may not be exactly regular;
The ESP32 comes with four 64bit hardware timers which could be used for timing 0.1mSec events
e.g. generating a 10kHz square wave
// ESP32 10kHz square wave print *
#define pin 19
hw_timer_t *timer = NULL;
volatile int counter = 0;
void ARDUINO_ISR_ATTR onTimer() {
counter++;
digitalWrite(pin, !digitalRead(pin));
}
void setup() {
Serial.begin(115200);
pinMode(pin, OUTPUT);
// Set timer frequency to 1Mhz
timer = timerBegin(1000000);
// Attach onTimer function to our timer.
timerAttachInterrupt(timer, &onTimer);
// Set alarm to call onTimer function every second (value in microseconds).
// Repeat the alarm (third parameter) with unlimited count = 0 (fourth parameter).
timerAlarm(timer, 50, true, 0);
}
void loop() {
if (counter >= 2000) {
Serial.print('*');
counter = 0;
}
}
oscilloscope display
if you wish to count events have a look at ESP32 Pulse Counter (PCNT)
GPS or one of the "atomic" clock signals like MSF (UK) or DCF77 (Germany) will give you a source of an accurate time.
The MSF signal is generated from the National Physical Laboratory time standard.
For GPS, I parked a module on a roof with a wide field of view.
The 1-second output was sent back to where I needed by a couple of XBee's.
MSF and DCF77 modules and antennas are available.
For a 24-hr time check, hacking an MSF wall clock alarm output is good enough to correct a DS3231 which on it's own is good for 1-second drift per month.
One of the things I want to measure is specifically how temperature effects the time of the pendulum so I think I will need the external reference of GPS or something else as it would get quite messed up otherwise. The changes in temperature should hopefully have a small enough effect, but that is something to remember
