Pages: [1]   Go Down
Author Topic: rtc crystal accuracy  (Read 999 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 2
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

concerning rtc's, and the crystals. is it correct to say (im trying to understand) that clocks lose time because of the crystal accuracy? and if so, is the crystal accuracy affected by temperature? if this is a true statement, then if my clock crystal was kept at a constant temperature in theory, my clock should keep time pretty well, right? are all rtc's created equal? perhaps accuracy is not the correct word for this maybe tolerance? im not sure. are some crystals (manufacturers) better than others? my ds1305 has lost quite a bit of time over the last 2 months, but it resides in a room that has 15 degree minimum temperature swings daily. is the 1305 just a piece of cr@p? or is it the crystal. any help in understanding this from an rtc person greatly appreciated. thank you.
Logged

San Diego, CA
Offline Offline
Jr. Member
**
Karma: 1
Posts: 63
A sociable geek chemist
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

concerning rtc's, and the crystals. is it correct to say (im trying to understand) that clocks lose time because of the crystal accuracy? and if so, is the crystal accuracy affected by temperature? if this is a true statement, then if my clock crystal was kept at a constant temperature in theory, my clock should keep time pretty well, right? are all rtc's created equal? perhaps accuracy is not the correct word for this maybe tolerance? im not sure. are some crystals (manufacturers) better than others? my ds1305 has lost quite a bit of time over the last 2 months, but it resides in a room that has 15 degree minimum temperature swings daily. is the 1305 just a piece of cr@p? or is it the crystal. any help in understanding this from an rtc person greatly appreciated. thank you.

While temp swings can cause an issue, in general that's not really most of the error. Most devices (crystals, voltage refs, etc.) are spec'd at a specific temp, often 20oC, 23o or 25oC. Any change from that temp results in a change in the value. This change is typically called the temperature coefficient. This coefficient plays a much larger role, than would a temp swing. In general I wouldn't imagine a temp coefficient of much more than a 20-50ppm change for the crystal. That being said if a cheap crystal is used it could be significantly off value. Some list acceptable ranges of 100-10000ppm (the later is a 1% error). So a constant temp will make the results more precise but won't necessarily make the results more accurate. What i mean by this is say you have a 20Mhz crystal with a listed accuracy of +/- 200ppm. That the temp swing may cause the crystal to fluctuate between 20.0044 and 20.0048 but the bulk of the error is still in the initial accuracy.
« Last Edit: July 06, 2013, 11:38:53 pm by PedroDaGr8 » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

concerning rtc's, and the crystals. is it correct to say (im trying to understand) that clocks lose time because of the crystal accuracy? and if so, is the crystal accuracy affected by temperature? if this is a true statement, then if my clock crystal was kept at a constant temperature in theory, my clock should keep time pretty well, right? are all rtc's created equal? perhaps accuracy is not the correct word for this maybe tolerance? im not sure. are some crystals (manufacturers) better than others? my ds1305 has lost quite a bit of time over the last 2 months, but it resides in a room that has 15 degree minimum temperature swings daily. is the 1305 just a piece of cr@p? or is it the crystal. any help in understanding this from an rtc person greatly appreciated. thank you.

Unless the RTC chip has an internal crystal resonator (some do, see below link) any accuracy variation of the RTC is almost solely because of the external crystal resonator and the internal circuitry that interfaces with the external crystal resonator. Also keep in mind that there are many crystal parameters that contribute to accuracy variations, but temperature variation is the largest contributor. Also the actual frequency of the crystal is not guaranteed to be at any specific frequency even at a specific temperature, but rather will be somewhere within a given range depending on the quality of the crystal and the manufacture's process of selecting and testing any give batch.

 Some of the better RTC modules uses an internal crystal and an internal active temperature compensation function to offer much better accuracy when can be obtained with using an external crystal and RTC IC:

https://www.sparkfun.com/products/10160

Lefty

Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11718
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The cheap 32768Hz watch crystals are designed for use in watches and assume a fairly
constant temperature is maintained by the wearer of the watch!

As the last poster said for better accuracy you will need a temperature-compensated crystal oscillator
(TCXO for short).  These take more power to run than RTC's though.  Some RTC modules have temperature
compensation built-in (while retaining the low power requirement), I think if you Google "chronodot" you'll
find an example of one.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Full Member
***
Karma: 2
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have been eyeing the ds3234. but at least i have a better understanding of what seems to be with my projects, and important part. i thank you all for replies and tutelage. i will reset my ds1305 and consider these options. some projects exact time isnt an issue with me, but some are shaping up to be. as usual you guys rock, but my wife doesnt like lefty and mark too much, i told her you guys said i gotta hit up sparkfun for a new clock!! smiley-eek-blue
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5351
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm just looking at some radio clock receivers. It seems really easy to do and you get the accuracy of an atomic clock...

http://playground.arduino.cc/Code/DCF77


Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Edison Member
*
Karma: 64
Posts: 2488
The last thing you did is where you should start looking.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
my ds1305 has lost quite a bit of time over the last 2 months
After 24(or 48 ...) hours how much time it lost/gained?
Readjust the RTC every 24 hours by that amount.
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2865
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The issue with the European DCF77 system (in the US it's DCF60 similar but slightly different and the real problem is propagation, Like MW stations at night there is a great fading of the signal during the day and the night.It's the time at dawn and dusk when the 77 KHz signal in your case from Germany ours is 60 KHz and from Boulder Colorado, The frequency is accurate too @ 1 part in 10-12 and 60 KW of power. Easier and what I'm in the process of doing is to use GPS time in an effort to have an accurate clock 24 hours a day. Most "Watch" crystals are designed for an accurate temperature controlled environment... The Human Body.
There are those like the DS3231 and it's family that have some temp comp built in to do a better job at overall accuracy, The DS1302 and 1307 use nearly identical oscillator circuits and are not very accurate. As a point of fact the accuracy or lack of it caused me to buy a DS3231, that I've not used yet. As long as the GPS can see an unimpeded view (no heavy cloud cover) of the sky it's a most accurate device.
C-MAX CMMR-6P-60 WWVB 60kHz Receiver is the part # for the 60KHz part... IHTH

Bob
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

want less noise with a DCF77 ?
check this version from Udo Klein -  http://forum.arduino.cc/index.php?topic=175092.0 -
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5351
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The issue with the European DCF77 system (in the US it's DCF60 similar but slightly different and the real problem is propagation, Like MW stations at night there is a great fading of the signal during the day and the night.

Yep.

I'm wondering if you could calibrate the Arduino clock against it at night time and make adjustments. With the right software you can probably always be within 1 second (maybe...I'm still waiting for my module to arrive).

I've seen some other hacks on the Internet which claim to improve reception a lot. You put some foil around 180 degrees of a toilet roll, put the antenna inside then aim the open side towards the transmitter.

http://www.fact4ward.com/blog/meteotime/

« Last Edit: July 07, 2013, 02:36:56 pm by fungus » Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5351
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also...even if you only get a partial signal with lots of error, you still know where the seconds begin so you can keep track of time. I think smart software can compensate a lot for bad signal.

All this is theoretical of course, I didn't try it yet. :-)

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 525
Posts: 26523
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think if you put a better crystal on the board, the right software can have very little drift each day.
For example
http://www.digikey.com/product-detail/en/9C-16.000MEEJ-T/887-1274-1-ND/2207856
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 93
Posts: 3968
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Just a little data if you like that sort of thing. I've been using Microchip MCP79412 RTCs with this Citizen crystal. So not the typical inexpensive no-name 32kHz cylindrical crystal. The crystal accuracy spec (tolerance) is ±20ppm, and my experience has been that most run well within that. My gut feel is that this is considerably better than DS1307s with the cylindrical crystal, of which I have quite a few, but have not made measurements, so no data on those.

Here are measurements from eight different MCP79412 RTC breakout boards; this is a measurement of the entire circuit, not just the crystal. The oscillator frequency was measured to 0.01Hz using a GPS time base and ppm error calculated from that. The MCP79412 has a calibration register that can be used to adjust for inaccuracies in the crystal and other components. After calibrating the one with the -5ppm error, it has run in my basement workshop (fairly constant temperature) for 90 days and is only off by one second. So some real world data, small sample size, strictly FWIW:

Code:
RTC ID              ERROR, PPM
0004A30279020830    -14
0004A3027602087E    -8
0004A302770208AD    -8
0004A302770208F6    -5
0004A30276020811    -3
0004A3027A0208A8    -1
0004A3027902083D    -1
0004A302760208C4     0
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 53
Posts: 1777
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think if you put a better crystal on the board

Agreed.
The RTC 32.768khz crystals are not all equal.  To add insult to injury, the load capacitance can be very different, too.  Refer to the IC spec sheet and try and match the specs to the crystal you purchase.  With a little luck and patience, you should be able to get within a second or so per day.  On my last build, I went through 3 crystals and got to within a second every 12 hours (fast) so the software drops 2 seconds every day at midnight.  

You can also try "pulling" the crystal off frequency if fast with a small variable cap of a few pF to ground on one xtal pin.

Ham radio folks may remember using two twisted wires to adjust HF gear - called a gimmick.
Ray
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5351
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just got my DCF77 receiver.

OUCH! That signal is noisy...
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Pages: [1]   Go Up
Jump to: