Electronics > Projects, Designs, and Technical Stuff
DS3231M - Improve accuracy with Aging register?
tooki:
--- Quote from: Peabody on April 07, 2023, 08:02:49 pm ---Because I don't have an ESP32. And others who might want to do this might not have an ESP32. Of course they might not have an Arduino either, or Windows.
--- End quote ---
You should try them. They’re cheaper than Arduino, about 100x as powerful, with vastly more RAM and flash, built in Wi-Fi and Bluetooth (in all the common variants), and are widely supported in the Arduino ecosystem. :)
Peabody:
The package arrived today from the Far East, and the traditional DS3231 module with the charging circuit and EEPROM did have the M part, as expected. However, the little round module has an SN part. Of course I don't know if they are all like that, but they might be.
https://www.ebay.com/itm/401482226870?var=671154997502
The round module is just the DS3231SN and a capacitor. There's no charging circuit, no power indicator LED, no EEPROM, and no pullup resistors on anything - but there are places to add through-hole pullups for SDA and SCL. There is one big disadvantage. The battery holder is for a CR1220, which has about 1/6 the capacity of the CR2032 used on the big board. But if I can find a solution for that, this would be the module to buy unless you need the EEPROM for some reason.
I bought both modules from the same seller, and there was one combined shipping charge of $3. Arrived in 11 days.
So now I'll start playing with the M and see how it behaves.
elecdonia:
I bought several inexpensive Chinese DS3231 boards 6 years ago. The devices on these boards are labeled DS3231SN.
Recently I discovered one of these boards which had been untouched for >4 years. Battery still good. Date/time had last been set 4 years ago. When I connected it to an Arduino last week, I found it had drifted <2 minutes from the correct time. Not bad for running off battery, stored in a bag at the rear of my workshop, for that long.
Peabody:
I've since confirmed that the part marked SN on the little round module is indeed an SN. But the one I've been using for several years, marked SN, is a fake M. You can tell if you set the square wave output to anything other than 1Hz - the SN will do that, but the M will stay at 1Hz.
I rigged up a calibration method for setting the Aging register to the optimum value, at least for the current temperature. It uses the PPS output of a GPS module as compared to the 1Hz square wave output of the RTC. With an Arduino Nano running at 16Mhz, it counts the number of processor clocks that elapse between the two. Then it does the same thing five minutes later, and adjusts Aging based on the difference. The first such adjustment gets it pretty close, but it can run as long as you like to fine tune it.
The one genuine SN that I have ends up with an optimum setting of +1. If all SN parts are like that, there's really no need to calibrate them. But the two M parts - one possibly genuine and one definitely fake - ended up with optimum settings of -44 and -19. They come from the factory with Aging set to zero. So they are off a good bit.
Based on my limited sample of parts, I think the SN parts are much better than the M's. They are just more capable of keeping near-perfect time. For example, I confirmed that for the M a change of +/- 1 in the Aging setting changes the RTC clock by 0.12ppm. But for the SN the change is 0.055ppm. And it appears the M's need to be calibrated, while the SN's don't.
What I don't have a good feel for is how well the two parts adjust for temperature changes. They both have processes for doing that, but do it differently, and I just haven't tested the difference. I need to do that.
But yes, the SN in particular I think is capable of keeping near-perfect time. At least at constant temperature, getting it to 0.055ppm would be 1.7 seconds per year.
Peabody:
I wanted to report the results of my experiments with the aging register of my DS3231 parts. As described above, I compare the 1Hz square wave output of the RTC with the PPS output of a GPS module, and adjust the aging register until the difference between those two stops changing, or until the rate of change is minimized.
I found that the optimum setting changes over time as the RTC, uh, ages. And in all cases aging makes it run slower. My only genuine DS3231SN started out optimizing at an aging register setting of +1, but after a couple months it now optimizes at -5.
My several-years-old part marked DS3231SN, but which behaves like a DS3231M, started at -44, and is now at -46. So it was already old when I started these tests. I think the changes diminish as the parts get older, but I don't think they ever stop.
And my new official DS3231M part started off at -19, but is now at -24. In all cases the RTCs have been kept running. I don't know if aging slows down if they are powered down most of the time.
One complicating factor is temperature. All of the tests were done at room temperature, but that has changed about 7 degrees F as we've moved into summer. Both SN and M parts have built-in temperature adjustments, but I don't know how well they work, or if there's any difference in how well they work.
So I believe I've answered my original question, and it seems the DS3231M can indeed be made significantly more accurate via aging register adjustments. But based on my limited sample, the M parts are more likely to be way off in the beginning than the SN parts. I think the SN parts can ultimately be more accurate because it appears a change of +/-1 in the register produces a smaller speed change in the SN than in the M, so in theory you could get closer to perfect with an SN.
I think the bottom line is that while the M is in theory an inferior chip, it can be made to keep time very well if the aging register is properly set, subject to the temperature adjustment question.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version