Thursday, 29 June 2017

Clock - Mk II reviewed

I've re-arranged some code, removed the second-by-second logging, and added a bit of minute-by-minute logging instead, and tweaked the adjustment delays again (968 and 48). I left the clock running for 24 hours, and this time found it had lost 2.5 seconds. The logging showed that the figures at the end of each minute were reasonably constant, but it seems that I can count on averages drifting over time, and variations of around 5ms.  I'm thinking I might need to add in an hourly adjustment now, and tweak the other delays again to make sure it gains rather than loses (if it gains time - i.e. the loops are shorter than 1 second, I can add in extra compensating delays after predetermined periods - like every 10 minutes or every hour).

I've been doing a little bit of research, and I think I might be pushing the limits of the available technology anyway.  From what I've read, it looks as though even the timing crystals used on the genuine Arduino boards are at best what you might call mediocre quality, with a reported accuracy of just +/- 0.5% , and the ones on Chinese clones are most probably not even that good.  I've read quite a few accounts of people 'upgrading' their boards with better quality crystals, to get a more accurate millisecond timing capability (presumably after going through the same kind of exercises that I am trying).

It seems that temperature is also a factor in the potential accuracy of these crystals, though I haven't seen any figures on the degree of variance (pardon the pun) or just how different the temperatures need to be, in order to have any affect (hmm - if only I had a temperature sensor - say, like an LM35 - I could use it to plot the ambient temperature against the timing drift... Oh darn, that's right, mine's broken - LOL). However, I have read that you can get timing crystals that are enclosed in a heated thermostatically controlled enclosure (called a Crystal Oven), in order to eliminate any temperature induced variations - now that really is taking timing seriously!  I won't be soldering one of those beasts onto my $5 Arduino clone!!

No comments:

Post a Comment