RTC with compensated oscillator running fast, what would cause this?
rwgast_logicdesign
Posts: 1,464
So im running a ds1307 with a temperature compensated DS32Khz oscillator. Every time I check the clock it has gained a few seconds, the amount it is gaining actually seems arbitrary I need to do further monitoring to figure out just how off it is.
The reason Im really confused as to why the clock seems to gain up to a second a second a day. vs my time in windows, is because the oscillator is suppose to be accurate up to +/- 2 seconds a year. When I hooked up the oscillator the DS1307 data sheet said to run its output directly to the RTC's xtal input and float the RTC xtal output. The data sheet for the oscillator showed a few resistors/caps on the connection between it and the RTC chip, it said these were to keep current draw down and would need to be adjusted for accuracy depending on the RTC. Not caring much about the current I went ahead and just connected the out pin of the oscillator to the in pin on the RTC (as the ds1307 data sheet directed), figuring this would give the most accuracy.
Secondly I built this clock on a "shield" type module for my board and have unplugged it and plugged it back in many times while working on the board, Im wondering if somehow this could cause the problem? I really need to figure this out, because I am doing another project, which is a clock as a present and I can't have it gaining up to a second a day, thats a bit ridiculous.
If more information is needed I can certainly give it, but I am hoping this is just a problem with me plugging and unplugging the board or something, since it seems to be a bit of an unpredictable time gain.
The reason Im really confused as to why the clock seems to gain up to a second a second a day. vs my time in windows, is because the oscillator is suppose to be accurate up to +/- 2 seconds a year. When I hooked up the oscillator the DS1307 data sheet said to run its output directly to the RTC's xtal input and float the RTC xtal output. The data sheet for the oscillator showed a few resistors/caps on the connection between it and the RTC chip, it said these were to keep current draw down and would need to be adjusted for accuracy depending on the RTC. Not caring much about the current I went ahead and just connected the out pin of the oscillator to the in pin on the RTC (as the ds1307 data sheet directed), figuring this would give the most accuracy.
Secondly I built this clock on a "shield" type module for my board and have unplugged it and plugged it back in many times while working on the board, Im wondering if somehow this could cause the problem? I really need to figure this out, because I am doing another project, which is a clock as a present and I can't have it gaining up to a second a day, thats a bit ridiculous.
If more information is needed I can certainly give it, but I am hoping this is just a problem with me plugging and unplugging the board or something, since it seems to be a bit of an unpredictable time gain.
Comments
What oscillator are you using?
BTW, the coupling technique can't cause error per say, I mean a frequency is a frequency.
It would be hard to add an extra cycle once in a while except due to noise.
2 seconds per day would be about 64K added cycles/day out of the 2,831,155,200 cycles in a day.
The method of coupling may cause the oscillator to "Work Harder" causing an error in the temperature compensator.
What are you using as a time reference. Your PC may have much of the error.
The PC could be pretty good if before you look at the clock you set it using the internet NTP, Network Time Protocol.
I would usually recommend one of the NIST time keepers. (OK, I use the University of Minnesota time keeper because it's pretty close and needs less time delay compensation.)
The NTP method should be accurate to a few mS of error.
Duane J
As far as a time reference Ive just been opening the clock in win xp and setting the time to the second that way, I figured a computer would keep time via NTP just like a cell phone ETC. I will check out a better time reference and see if the PC is the problem, hopefully that is the issue. I dont mind some drift it is going to happen, but a second a day sometime is a bit much, that would be a full minute every two months.
Hopefully there is not a problem with the way I wired the oscillator becuase there is just no room to go in and add the schematic for reduced current, I doubt this is the issue though as I followed the DS1307 data sheet instructions for using an oscillator , instead of crystal, and the DS32khz data sheet does not say anything about the reduced current schematic being more "accurate". When I finish the board today I will use NTP to set the clock and leave the module plugged in, and check for drift in a few days. I was thinking maybe the plugging and unplugging could cause error because it causes the oscillator to switch from back up power to VCC power every time, but this would also happen whenever the board is turned off..
Edit: If you had the power budget, I'd steer you to a fabulous used SC-cut OCXO (made by Isotemp Research) that is currently available on eBay for only $20. There are also a variety of ways you can roll your own OCXO and get considerably better stability than the DS32KHz.
One second a day is ~ 11.574ppm, so you need to be sure you have a reference better than that.
A PC Clock, will not be super stable, use it as a ball park only.
OCXO are nice, but you can also get TCXO (FOX924B) from Digikey for under $4, good to < 1ppm/day, or you can get GPS modules that give 1pps with even better long term stability.
I just checked the NIST site above and my PC is most likely the culprit here, it is almost a full minute off from that time. I never realized how inaccurate a PC clock was..
If you want accurate time, it is easier to just check with the internet everyday or every few hours.
Thanks for the time widget.
Jim
I appreciate the low power and low cost of TCXOs, but simply touching my FOX TCXO for several seconds (I have hot hands) causes a detectable frequency shift on even an inexpensive frequency counter. Probably fine for many things. Distressingly unacceptable to me.
@Loopy: Please see post #5.
I use the ISL12020M TCXO RTC with embedded crystal. It by default measures temperature at 10 minute intervals, but that can be configured to 1 minute. Same consideration for a stable environment. The temperature compensation itself is done by a combination of digital trimming, which adds or removes pulses from the 32kHz stream, and analog trimming that pulls the crystal frequency by means of capacitors in the oscillator circuit. There are registers (factory or user programmable) that compensate for the parabolic curve of the nominally 32768 Hz xtal, while operating at 1µA supply current for timekeeping.
So, without realizing it, every time you checked your clock reference you would actually be changing the reference!