A look inside the DS3231 RTC

External hardware connected to the STM32 board
Post Reply
User avatar
Pito
Posts: 1502
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

A look inside the DS3231 RTC

Post by Pito » Fri Aug 11, 2017 5:39 pm

What is inside the DS3231 RTC (the cheap boards we use frequently):

https://blog.heypete.com/2017/07/29/a-l ... ime-clock/
Pukao Hats Cleaning Services Ltd.

User avatar
ahull
Posts: 1578
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: A look inside the DS3231 RTC

Post by ahull » Fri Aug 11, 2017 6:41 pm

I spotted that. I have some of those modules on my raspis. Its actually quite an interesting device, and with a bit of tweaking is pretty accurate. I wonder how accurate you could make it with a bit of oven control and a GPS reference to tune it.
- Andy Hull -

User avatar
ddrown
Posts: 133
Joined: Sat Jan 09, 2016 4:49 am

Re: A look inside the DS3231 RTC

Post by ddrown » Sat Aug 12, 2017 1:51 pm

ahull wrote:
Fri Aug 11, 2017 6:41 pm
I spotted that. I have some of those modules on my raspis. Its actually quite an interesting device, and with a bit of tweaking is pretty accurate. I wonder how accurate you could make it with a bit of oven control and a GPS reference to tune it.
No oven control, but I did get around 1 second per year (-0.038ppm +/-0.085 ppm) in my test: https://blog.dan.drown.org/rtc-comparison/

User avatar
Pito
Posts: 1502
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: A look inside the DS3231 RTC

Post by Pito » Sat Aug 12, 2017 3:12 pm

Unless you measure 1y long you cannot get precise results (aging, temperature).
I got 4secs in 6months with DS3231 (temp 19-28degC, stock reg period) - that is great as well.
Pukao Hats Cleaning Services Ltd.

User avatar
ddrown
Posts: 133
Joined: Sat Jan 09, 2016 4:49 am

Re: A look inside the DS3231 RTC

Post by ddrown » Sat Aug 12, 2017 6:44 pm

Pito wrote:
Sat Aug 12, 2017 3:12 pm
Unless you measure 1y long you cannot get precise results (aging, temperature).
I got 4secs in 6months with DS3231 (temp 19-28degC, stock reg period) - that is great as well.
That is true, aging is probably around +/-1ppm/year. And my results were under a much narrower temperature range than the chip is rated for. Both of those factors would lead to larger errors in other tests.

Still, these were much better results than I was expecting.

Your result of 4s/6months is around 0.25ppm which is about right for an average change of 1ppm/year.

User avatar
Pito
Posts: 1502
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: A look inside the DS3231 RTC

Post by Pito » Sat Aug 12, 2017 7:15 pm

Also the GPS 1pps outputs are not precise (especially with cheapo modules), the jitter could be huge short time.
You need a quality OCXO disciplined by the 1pps output with a large time constant in the loop, like several hours or more, to get a good precision out of it..
Pukao Hats Cleaning Services Ltd.

david.prentice
Posts: 109
Joined: Wed Nov 16, 2016 8:52 am

Re: A look inside the DS3231 RTC

Post by david.prentice » Sat Aug 12, 2017 10:36 pm

Surely you can synchronise a clock to a GPS signal over a time period. And get an accurate time with averaging.

There is no need to wait for a year. You can measure any phase difference between the DS3231 pulse output and the synchronised "accurate" clock.
A 1 second error in 365 days is 0.03 ppm. You should be able to measure the phase difference within 30 seconds.
The absolute accuracy is not very important. The short term stability of a regular HF crystal is good. You are only measuring the phase difference.

I quite agree that it is simpler for a human to compare whole seconds after a year. But it is not very practical.
It s my bedtime. I may have the maths wrong but the argument seems valid.

David.

User avatar
ddrown
Posts: 133
Joined: Sat Jan 09, 2016 4:49 am

Re: A look inside the DS3231 RTC

Post by ddrown » Sun Aug 13, 2017 12:04 am

Pito wrote:
Sat Aug 12, 2017 7:15 pm
Also the GPS 1pps outputs are not precise (especially with cheapo modules), the jitter could be huge short time.
You need a quality OCXO disciplined by the 1pps output with a large time constant in the loop, like several hours or more, to get a good precision out of it..
The GPS signal can jitter 30ns for this module (RMS measure, while in 3d lock). So I did have to use longer time periods than 1 second to measure what I did. Averaging over longer time periods works for time keeping, but I would need to use your GPSDO suggestion if I was testing a clock source for radio use.

User avatar
ddrown
Posts: 133
Joined: Sat Jan 09, 2016 4:49 am

Re: A look inside the DS3231 RTC

Post by ddrown » Sun Aug 13, 2017 7:01 pm

Pito wrote:
Sat Aug 12, 2017 3:12 pm
Unless you measure 1y long you cannot get precise results (aging, temperature).
I got 4secs in 6months with DS3231 (temp 19-28degC, stock reg period) - that is great as well.
To go into more detail about your point about aging, this is a few months of data from two TCXOs (not the DS3231, but it should be somewhat similar). I've somewhat controlled for temperature effects so the majority of the graph's week to week motion should be from aging. The datasheet spec for these TCXOs are +/-1ppm/year.

Image

I turned both TCXOs off for a week in July and you can see that caused its own change as well. The two lines have a slope of 0.71ppm/year as my estimate of their aging rate. Aging isn't a straight line, but makes an ok fit.

Assuming this aging rate stays constant and linear (and it won't, but it's a useful estimation) this would result in a 11.2s drift this year. I've read that crystal aging rate slows down after the first year, so that's something else to expect.

User avatar
Pito
Posts: 1502
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: A look inside the DS3231 RTC

Post by Pito » Mon Aug 14, 2017 6:44 am

Nice measurements!
I messed with OCXOs a decade or more back, while I was lucky and had real Cesium based equipment handy (not GPS based nor the stuff from ebay, but real calibrated Cesium stuff, part of the ww network - the national standard). I saw how the crystal cracks (the layers of atoms move) while running in the oven for 2 weeks and I saw the various effects (temperature, gravity, ..) you cannot see when not having such precise equipment handy.. ;)
Pukao Hats Cleaning Services Ltd.

Post Reply