A drifting clock suddenly doesn't drift? - Page 1
Forum section: electronics / general

author: ToBeFrank
author_rank: Regular Contributor
timestamp: July 29, 2013, 03:15:50 pm
content: I bought a new microwave about a year ago. It has a clock display, which is nice, but it was fast by about 15 minutes a week. It was annoying, but I wasn't too worried about it since the oven below also has a clock. I just assumed the oscillator they were using for their time was off.However, about 3 weeks ago during a storm, the power went out. When the power came back on, we reprogrammed the clocks. Lo and behold, the clock on the microwave is now spot on and doesn't drift at all. How can that be? Could they be doing a calibration step that got messed up the first time I powered up the microwave?

author: KJDS
author_rank: Super Contributor
timestamp: July 29, 2013, 03:32:26 pm
content: It is very unlikely to be a calibration issue. It's possibly a dry joint around the crystal, or else the crystal has started again at a slightly different frequency when powered back up. That normally happens, though it's not normally as substantial as 15 seconds a week.

author: David_AVD
author_rank: Super Contributor
timestamp: July 29, 2013, 10:17:14 pm
content: Some clocks use the crystal for the timing, while others use the mains frequency. If the latter type, I wonder if the drift could have been caused by interference on the mains (extra counts)? Then if so, is whatever was causing that interference now absent?Of course the real cause could be something quite different, but it never hurts to think beyond the usual ones.

author: Paul Moir
author_rank: Frequent Contributor
timestamp: July 30, 2013, 01:58:53 am
content: I'll bet it's line frequency derived, after all why wouldn't it be?If so, imagine this: you need to read the 50 or 60Hz line frequency, so you look at the AC wave coming off the electronics power transformer using say a diode. Since the voltage is a bit high and unregulated, to get that into your micro you go through a resistor divider into the base of a transistor. Say the gain on the transistor is poor and/or the resistor divider isn't quite driving the transistor adequately, so that it gets a half decent signal out the collector but every time there's a bit of noise from the fridge coming on during a high cycle it drops out and gets an extra count. (BTW - last week I was messing around with a line derived clock signal in this fashion, and that's exactly what happened when my biasing was off.)A nasty spike comes out down the power lines and gives the lower resistor (lower value) on the divider a zap, increasing it's value a bit. Now the transistor is getting a stronger signal and it doesn't count the dropouts anymore.One can easily see how something like that can slip past QC at the plant. Maybe a combination of marginal components, marginal design and a little extra noise on your personal power lines caused the initial issue. Anyway I've learned not to complain when problems fix themselves.

author: John Coloccia
author_rank: Super Contributor
timestamp: July 30, 2013, 11:17:17 am
content: There's almost certainly an oscillator in there to drive the clock for whatever logic is running the microwave, and that logic is almost certainly running the clock as well. If I had to guess, I would guess that you have some configuration pin in there somewhere that's floating and causing the wrong timebase to be used.

author: David_AVD
author_rank: Super Contributor
timestamp: July 30, 2013, 11:28:10 am
content: The 15 mins gain over a week is only 0.15 of one percent error. The long term accuracy of the mains frequency is better than a typical crystal oscillator.

author: John Coloccia
author_rank: Super Contributor
timestamp: July 30, 2013, 11:42:00 am
content: Even the crappiest quartz watches aren't off by 15 minutes per week....or even 15 seconds per week. It would seem crazy to me to go through the trouble of using mains frequency when there's a perfectly good clk already in the logic.Anyhow, it can be anything, I suppose. That's just a guess.

author: ToBeFrank
author_rank: Regular Contributor
timestamp: July 30, 2013, 03:36:52 pm
content: Quote from: John Coloccia on July 30, 2013, 11:17:17 amThis was my thought as well, which is why I was so confused how it could be so far off and then suddenly be spot on.

author: Paul Moir
author_rank: Frequent Contributor
timestamp: July 30, 2013, 06:47:16 pm
content: Quote from: John Coloccia on July 30, 2013, 11:42:00 amBut it is substantially cheaper than a ~0.17 crystal, and the uC clock can therefore be a simple RC oscillator. It's also deadly accurate (over time). And the microwave has to be plugged in for it to work anyway.For nice accurate quartz operation you'll likely have to do a bit of trimming anyway. Before NTP set clocks in everything, I'm sure you remember computer motherboard clocks drifting quite bad since they never bothered trimming them too well.

author: SeanB
author_rank: Super Contributor
timestamp: July 30, 2013, 08:24:26 pm
content: PC clocks still drift, as they always pick up stray pulses from the rest of the logic, which is worse as the current method is to have the RTC as a part of a chipset with high speed clock pulses running on the traces next to the clock crystal, and the crystal being quite far away from the BGA package electrically speaking. They all gain time unless you use NTP to do correction.

author: Unknown
author_rank: Unknown
timestamp: July 30, 2013, 11:20:44 pm
content: A good NTP implementation will correct for this however: it will change the effective clock rate (time increment per tick) to minimize drift. So as long as the number of stray pulses is fairly constant, it should reduce in a fairly low drift rate as long as the computer is on. Of course the hardware RTC is too stupid to correct for this, so the clock will still drift when the power is off.