Posted by John Haine on 04/08/2023 10:39:31:
I mean that if you deliver period measurements, for example, instead of trying to send optointerrupter on/off signals, then latency should not be a bother. Of course, that means that you must be satisfied with the way those period measurements are made, and that may require another module if you want to do it in a particularly-accurate way, but many such modules are also postage-stamp sized. (BTW, I am not promoting ESP32's and have never used one; it's just an example.)
My approach is to use a picPET07 driven by a 10MHz OCXO to time both edges of the pendulum pulse. Far more accurate than an Arduino can achieve. (In answer to your question about timing approach.) The OCXO takes 5V 300mA continuous to keep its heater on, more like 500mA on startup. That would make it the largest consumer of power in the clock. Also ideally needs a linear regulator which assuming a primary supply of 12V (to give headroon for the escapement drive) gets rather hot! And if the Pi is in the case too it doubles the supply requirement again.
The clock will need mains power and battery backup. I've already done this in another clock so quite familiar with the approach – but putting the OCXO and the Pi in the case means a much bigger battery.
My experience with a headless Pi with WiFi connectivity for logging is not good – they have a habit of dropping off the WiFi and need resetting to recover which stops the log. I prefer to have an MMI on the Pi and map a folder to my Windows file system for data transfer.
I would obviously do some measurements on the 433MHz Tx/Rx to see how they perform – one should arrive soon. Cheap as chips.
Bazyle's question first: does temperature alter the electronics? Potentially yes. Definitely is the electronic clock is based on the computer's oscillator, less so if the electronic clock is a Real Time module, or an OCXO, and not at all if the electronic clock is GPS based. So needs thought.
John's remarks above – my approach is very similar except I use an Arduino rather than a PIC.
Ages ago John drew my attention to the PICPET chips. These use a hardware counter/timer to get high accuracy, and the same technique can be implemented on Arduino (Atmel) and other microcontrollers. The only disadvantage of PICPET is the chip can't be programmed to do anything else: it can only be a Precision Event Timer. Otherwise, they are the bees knees.
Arduino et al. can be programmed to do PET and other functions, but there are ifs and buts. PICPET can be plugged into an accurate 10MHz OCXO, but the Arduino has a 16Mhz uncompensated oscillator. An external clock can be connected to an Arduino pin to do PET, but it's limited to 6.4MHz tops. In practice I run it off a 5MHz OCXO, but this loses a lot of resolution compared with 10 and 16MHz.
My sub-miniature soldering skills aren't up to replacing an Arduino's onboard crystal with an accurate 16MHz source. What I have done is have the Arduino run two PETs off the onboard cytstal. The first measures the crystal frequency once per GPS second, which tells me the oscillators real frequency over the last delta. The second PET measures the pendulum relative to the crystal, whose actual frequency count during the last GPS second ago is known, and can be error corrected. I doubt the trick is better than an OCXO because the crystal may have drifted whilst being counted, but results are in the same ball-park.
The ATMega 16U4 and PIC chips are both 8 bit time predictable with support for counter/timer Input Capture. Other microcontrollers are more or less suitable. Not all support Input Capture. As far as I can tell the ESP8266 has no programmable hardware timer functions at all. The ST32 family (Nucleo) are promising, but the system clock doesn't run at a steady rate – the chip pulls fancy tricks to increase average speed, by running some instructions faster than others. I've not confirmed it's possible to drive an ST32 counter timer with an external clock and get reliable high accuracy timing.
The Raspberry Pi has a multi-user multi-tasking SOC. It pulls even more fancy tricks to increase average speed, and an operating system schedules work, not the programmer. Though possible to get close to real time performance, all processes are regularly or irregularly interrupted by the operating system, which makes accurate sub-second timing of external events difficult. On the other hand, PI supports Network Time Protocol, always within 100 mS of atomic time, usually within 20mS, and it's not difficult to GPS discipline a Pi to get better than 10mS accuracy. Though poor at measuring short external events, a GPS'd Pi is about as good as it gets for long term accuracy. Provided that is the network stays up! I intended to fixed my Pi's network problems by hardwiring it with Ethernet, but moving it closer to the router made WiFi reliable.
I found my 433MHz modules and remembered why they're so slow. I bought a cheap controller pair of the type used to open garage doors. They recognise 5 or 6 'commands', which can be encoded to send data, but the transmission rate is too slow for clock logging. I need to cough up for a proper telemetry pair, about £30. The first one I found only does 9600 baud without error checking. More research needed.
Dave
Edited By SillyOldDuffer on 04/08/2023 21:50:49