DS3231 - Extremely Accurate 32,768 Hz

TelephoneBill

Well-known member
Frank, I thought this DS3231 topic worthy of a new thread. Many thanks to you for pointing this device out to me. (For other readers - This is a temperature compensated 32KHz real time clock).

I bought four DS3231 devices on eBay which arrived yesterday. They were part of a module known as ZS-042 and very cheap. Tonight I thought I would test one of these just to see how well it performs. I borrowed some code from this site to test (https://tronixstuff.com/2014/12/01/...-ds3231-real-time-clock-modules-with-arduino/) and I modified it slightly to write to the AGE REGISTER (address 0x10). The test was to see just how accurate I could set this up manually. I also use a Teensy 3.6 to drive the I2C bus, but the other Teensy devices will work equally good.

To make an accurate comparison, I am using a UBLOX M8N GPS module set to 32768 Hz on Channel 4 as the trigger trace of my Rigol scope, and display the DS3231 32KHz output signal on Channel 1. I'm looking for minimum drift between the two signals. I discovered that normally any changes to the AGE REGISTER do not take effect immediately - in fact it looked at first to make no difference. But reading the data sheet, you must also initiate a temperature conversion by setting/writing the CONV bit in register 0x0E to force the device to update promptly.

After a little juggling with values, I discovered for this first device that "0b11110000" was required to give minimum drift at ambient temp of 21.4 degC. This is a negative (2's complement) constant and makes the device marginally slower than the UBLOX signal. Any further negative value caused it to drift faster than the UBLOX.

I then measured 24 seconds as the time for the DS3231 to drift 200 nS slower than the GPS signal. This means that the drift was 8.3 nS per second, or roughly 1 part in 10e8. So its about 0.01 ppm.

That is truly amazing. It probably won't keep that over a wider ambient temp range, but is still quite exceptional for a 32KHz crystal. I need to do more work to test it thoroughly over an expected ambient range. It will be interesting too to see how the other three devices perform against each other.

By the way, I'm not using the Battery Backup option yet. Apparently there are issues if you insert a CR2032 so best not to during these tests - but more of that later...
 
Use a rechargeable battery LIR2032
This seems to be a question in dispute (https://forum.arduino.cc/index.php?topic=326153.0). I'm running from the Teensy 3.6 3v3 pin so that may be preferable to 5v. But I'm still cautious. Last week, after carefully checking correct polarity, I plugged an "elderly" 100uF 16v Tantalum across a 12 volt rail with spectacular/frightening effect. The holes in the dining room tablecloth reminded me of what can happen.
 
Back
Top