Arduino Processor Reference Clock Accuracy

Of late I have been going round in circles on a project to keep our local church clock roughly on time. I say roughly as my idea of timekeeping does not accord with the aspirations of the village residents. Quote ‘ I only need to know when it is the time to go inside for a brew’ / ‘knock off for the day’ / ‘get my skates on or I will be late for work’ etc. I was thinking sub seconds and they were thinking a minute or so as being perfectly adequate. The exception is at 11am on the 11th of November when it has to be exact.

That as it may be, the project is moving along. The first problem was what to measure on the clock to reference the time adjustment. The pendulum (1.25s rate) is clearly the easiest choice and a sensor beam being broken by the pendulum swing will solve this problem. The slight problem is that the sensor will not necessarily ‘switch’ at the same time when being approached from the two directions of the pendulum swing. My Arduino skills might struggle to come up with some code to discriminate this so I reverted to simple CMOS logic. An ICM7555 acts as a monostable that has a period greater than one swing. This is triggered by the falling edge of the swing pulse derived from a simple differentiator network. The monostable extended period pulse is then gated with the incoming pulse using a CD4001 Quad NOR to always give me half the pulse rate regardless of the swing direction. That probably makes no sense at all so here is my back of an envelope waveform diagram and circuitry.

The circuit has turned out quite useful for other applications. I also refined it to have a CD4024 ripple counter fed from the output at E. This allowed extended logging periods to be achieved. I also utilised the unused gates on the CD4001 to provide an isolating buffer on the input signal. This meant the differentiating network would always see the same drive signal regardless of the incoming waveform and its source impedance.

Progress indeed. I now had a pulse train representing the clock beat period. All I had to do was measure the time taken between pulses and I could compare and adjust the pendulum rate.

Having got a reliable 2.5s pulse it was time to reverted to an Ardiuno UNO to measure the period. With some help from a friend we ran a sketch using millis to record the time between pulses. This minimalist sketch did not seem all that repeatable. I also did some tests with Frequency.h sketch code from the PJRC website (very useful source) and had similar poor results. I was using a FY6900 as my reference 1.25Hz signal and to get a 1.25Hz reading I had to offset the FY6900 quite a way from nominal. What to believe?

In a bid to get a known good reference I powered up my Arduino GTU-7 GPS module and measured the 1 second output pulse using both of the above sketches and the results were not much closer to the truth. I tried an Arduino MEGA instead of the UNO and got a different set of inaccurate results

This led me to think that the UNO and the MEGA must be the cause. Looking at these two boards, both have a 16MHz crystal which I (foolishly) believed was the processor reference and therefore could not be that much off frequency. Totally wrong. The crystal is for the USB interface, not the processor. Instead the processor has a basic 16MHz resonator – not a crystal. I got out the magnifying glass and discovered this piece of surface mounted wizardry. Low and behold if I put my finger on the resonator to warm it up, off it went into dodgy stability land. It was pretty awful. I could make my readings whatever I wanted them to be just by timing how long my finger was in contact with the surface mount resonator package. Chocolate fire guard indeed.

What to do ?

I downloaded the ATmega258P datasheet and found that I could replace the resonator with a crystal. This looked complicated with references to fusible links and reprogramming of the processor all of which made me twitch. The processor had been running on a wobbly 16MHz source so why not a less wobbly one?

Rather than hack the UNO board, I eased the processor out of its socket and bent pins 8 (ground),9 (xtal) and 10 (xtal) out horizontally and plugged the processor back into its socket. Using a three pin socket pushed onto the pins as a mounting, I assembled the crystal across pins 9 and 10 and two shunt capacitors (approx 33pF) to the ground pin. The crystal came from RS Components (#8149440) and was a 30ppm spec. This socket mounted lash up was then pushed into place on the floating process legs – very healthy, no damage done to the processor or the board. Here is the ugly mess.

Switched on. It worked.

Suddenly all my test source readings took on a very stable repeatability and the readings were very close to what I expected. The GPS referenced 1s pulse was reading 0.999936 and my SY9600 was reading 0.999958. It looked like my new crystal reference must be slightly off frequency but a tweak of the shunt capacitor values will fix this. I think the SY9600 has a 10MHz TCXO so it should be good but I think I tend to believe the GPS pulse as being more accurately delivering a 1Hz rate.

The experts will tell me I should be adjusting the fusible links but I am inclined to stick with what I have got, it is working.

The result is I now have an ability to measure the pendulum rate and from this I can derive an advance and retard flag.

I am currently designing the front end circuitry as shown above into a PCB ‘shield’ to plug into the UNO. This will take the sensor input and give a slow or fast command pin output. More on this and general progress to follow.

Update (30/9/2024)

I changed the two crystal oscillator shunt capacitors to be a 22pFSMD in parallel with 1p8 caps when using the RS crystal as mentioned. Below is a suitable layout for the crystal and shunt caps. There are positions for two caps on each leg of the crystal. 15pF in parallel with 6.8pF would also work. I checked the frequency was close using a GPS derived 1pps signal feeding pin 8 on the UNO while running the frequency.h demo sketch.

The board can be connected using the mounting holes or it can be cropped and the residual pcb tracks used as direct connections using pins 10 and 9 both of which are bent out from the IC body. Pin 8 was left plugged into the IC socket and bridged and soldered across with a wire clipping to the crystal board. The crystal mounts on the rear. The board is so simple you could mill it on single sided copper clad with a burr in a Dremel.

The picture below shows the first milled version in place on the UNO. The layout above is a later tweaked version to better match the pcb pads to pins 9 and 10.

Links to similar or related post are listed below : –

3D Printed Length Gauge for In Barrel Mainsprings

I had received a clock to repair and wasn’t sure if the mainspring was correctly dimensioned. I remembered that William Smith had described a gauge for checking this in his book ‘Clockmaking & Modelmaking Tools and Techniques’ (pages 21 – 26). This gauging tool consists of two profiled plates that slide together to overlay the end view into the clock barrel. Bill’s design used 1/16″ brass plate but it struck me that a 3D printed version would be equally suitable and much quicker and easier to make.

In use the gauge is overlaid on the end view of the barrel as shown below. The point A is aligned with the outer diameter of the barrel arbor. The top plate is then slide until the inside edge of the barrel wall is aligned with point B. For a correctly chosen mainspring it should align with the corners C and D.

I sketched Bill’s design in Fusion 360 and extruded the two component parts to have a 2mm thickness before printing on my Qidi X Smart 3 in PLA. The two parts are fastened together to be a sliding fit with two M4 screws. The threads for these are modelled in the 3D print. A handling knob can be added in a similar fashion.

Here is my PLA printed equivalent.

The STL print files can be downloaded on the link below. It is not something that you will use every day but just a ‘useful to have when needed’ item. “Better to have it and not need it, than need it and not have it” (Jimmy Diresta).

Links to similar or related post are listed below : –

The “Modern Clock” by Goodrich

I have been working on a John Wilding ‘Scroll Frame Skeleton Clock’ which has been somewhat entertaining. Getting the clock in beat has caused some frustration. The pendulum crutch is elbow hinged to allow the beat to be adjusted but the adjuster sits behind the pendulum rod. It is easy to tweak the hinge angle but the pendulum rod then masks access to the tightening screw. In the end I resorted to getting the beat somewhere near and then fine adjusting it using the levelling adjuster feet on the base. It now seems to be running nicely, the beat sounds strong and timekeeping is looking good so far. As shown below I’ve got the light sensor of the Microset Timer on it at the moment so we’ll see how well it performs long term.

To revert back to the post title, John Wilding’s book on this particular skeleton clock makes reference to two books as being worthy of any clockie bookshelf – Britten’s ‘Clock and Watchmaker’s Handbook’ and ‘The Modern Clock’ by Goodrich. The latter is a bit of misnomer in that it was published in 1905 but it is a very detailed book and worth a read.

Not having either of these books I did a search. The Britten book is available from Amazon. The Goodrich book is available as a free download from the Gutenberg library. The download is possible in various digital formats, one of which is EPUB3 which is Kindle friendly.

To load third party documents into your Kindle you have to email the document as an attachment to your personal Kindle upload email address. This address can be found in the Settings section of your Kindle. I use this quite regularly to store interesting documents such as technical PDFs. I now have quite a collection of personal and third party techie documents stored alongside John Le Carre, Gerald Seymour and others. You never know when you are going to be bored while sitting on a beach and in need of some technical stimulation.

Links to similar or related post are listed below : –

Microset Timer interface using Fusion 360 3D model with Fusion Electrical

Sorry it has been a bit quiet but we had a few weeks in France and got distracted catching up on jobs there.  A minor update on this will follow.

I brought back a 30 day rope driven clock to work on for a fellow engineer who lives in France.  The movement has a 1 second pendulum and is marked as being made by Lawson of Bingley.   I haven’t found much wrong with it other than the hands were a loose fit on their arbors and were rubbing against each other and the dial.

In the course of working on the clock I needed a different style pendulum sensing optical sensor to interface to my Mumford Microset Timer.   This evolved before being modelled in Fusion 360 and then 3D printed.   A small sensor interface PCB module was also created in Fusion Electrical and milled on my Tormach CNC mill.  The body integrates the laser emitter, detector and PCB.   Below is a visual image from Fusion.   The pendulum swings through the U channel to break the optical beam and give pendulum timing pulses.

There are various M6 modelled mounting holes around the body.   The complete unit is powered from the Microset internal 5V supply.

A complete write up is available for download on the link below.

Interface to Microset Timer v4

Update : – I could not get the clock to accurate time while using a 3600 beat reference in the Microset.   I did a train count and discovered that the clock is actually a 3584 beat movement.  The clock is now doing very well with a few seconds per day error.

Similar or related subjects : –

Clock adjuster rod for measuring spring and fusee drive power

 I was presented with a clock that seemed to be low on drive power and it was proving difficult to diagnose where the fault lay. I remembered seeing articles by both William Smith and John Wilding about a device that could give a relative measure of the drive power from the fusee.  There is also a brief mention of this in Donald de Carle’s – Practical Clock Repairing.

This will be difficult to describe but in essence it is an adjustable balancing rod that is mounted on the fusee winding square.  The movement’s centre wheel and second wheel are left in place but the escapement is removed.   The rod has a sliding weight that can be adjusted to counter the drive power from the spring through the fusee chain to the fusee itself.    By winding the fusee one step at a time and resetting and noting the counter weight position it is possible to derive a graph of fusee turns against drive power.  Here is a pictorial view of the device and below that a picture of my version.

A sketch of the principle of the balance rod for fusee drive checking
A sketch of the principle of the balance rod for fusee drive checking
Image of my version of the balance rod
My version of the balance rod. The winding socket is interchangeable for different fusee square sizes.

William Smith suggested making the mass of the sliding weight equal to 1lb and measuring the weight position in inches from the balance centre to the centre of the weight.   This results in a graph of drive in lbs/inches.

In practice the balance point is a little subjective to set.   You need to move the weight back and forth such that the rod remains horizontally balanced against the drive from the fusee square.  Once a balance point is achieved the distance from the moveable weight centre to the winding axis centre is recorded.

On this particular clock I plotted the results of the each turn of the full wind range of the fusee and the balance distance seemed to be reasonably repeatable and overall fairly flat. This suggested that perhaps there was not an individual fusee positional problem but something that was common mode across the range of the winding.   To me this indicated that the drive transfer through the centre wheel and the second wheel was potentially the issue.

Checking the arbors against the plate pivots did not reveal a great deal of wear but on dismantling and checking more closely one of the centre wheel pivots had a worn curved profile.   I re-made the pivot and re-bushed the plate and reassembled the movement. On re-running the test with the rod I found I had gained an extra 1″ movement of the balance weight along the rod.  This suggested that more power was now being transmitted to the train, that is the train was not presenting such a high resistance to motion and more power was being created to drive the clock.  

This appeared to solve the problem with the clock having a much stronger beat.   This result is indicative of the value of this simple tool.

William Smith also suggests that the balance rod is useful as a temporary drive source.  Suppose you have a clock stripped down and want to quickly check the train.  Without fitting the barrel and fusee chain, the balance rod and balance weight can be mounted on the fusee square to provide quite a few minutes of drive to quickly exercise the train without having to undertake a full movement rebuild.

Similar or related subjects : –

Verified by ExactMetrics