Seen the new high accuracy RTC for $1.99?

Discussion in 'General Electronics Chat' started by THE_RB, Jul 25, 2014.

  1. THE_RB

    Thread Starter AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I recently got one fo these from ebay for $1.99;

    [​IMG]
    http://www.ebay.com.au/itm/DS3231-A...ck-module-memory-module-Arduino-/400503978923

    It uses the DS3231 high accuracy RTC chip.

    Unlike the old DS1307 which needed a 32kHz watch xtal, this one has internal oscillator so it doesn't need the xtal, and even better, has precise timekeeping to give <2 PPM precision at room temps.

    I used to use the old DS32kHz modules, which were big and clunky (and expensive) to get <2PPM freq output, but this is a complete clock on a chip, that already has the <2PPM precision.

    There is a programmable squarewave output pin that can be set at 1 Hz, so I'm thinking this really cheap little chip could be a nice reference clock for a high precision frequency meter project? ie; use it to gate the freq meter at 1 second or 5 second intervals and instantly get better than 2 PPM precision.
    :)
     
    MMcLaren likes this.
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,607
    Very strange, very strange indeed. I stopped using the DS3231 chip 4-5 years back when NXP came out with the PCF2129A chips that perform a very similar function for less then half the price.

    What is strange indeed is how cheap this board is: it is half the cost of the bare IC itself in 1,000 unit quantities.

    I call shenanigans here, either counterfeit or stolen devices have been used.
     
    Last edited: Jul 25, 2014
  3. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    +1. I've been reading about the DS323x and would love to incorporate some into future projects as they're supposed to be much better than the DS1307 I currently use at keeping time over long periods. However, I too question the quality of this specific offering. I tend to stay away from IC's sold on eBay, especially ones that are pricey from the manufacturer but dirt cheap from eBay. I find it funny the part number on the RTC IC appears to be rubbed off/blurry.

    Thank you for sharing the find though RB - let us know how it performs.

    ErnieM, may I ask you for the NXP part number? I'd love to look into a less expensive alternative for the DS3231.
     
  4. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,771
    971
    Counterfeit stuff on Ebay.. <sarcasm>.. no that never happens :rolleyes: </sarcasm>
    That is a 100% fake IC
     
  5. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    I think the vendor is relying on the fact that nearly no one who'd be interested in purchasing this would have the instrumentation or skill to confirm this spec.

    It'd be interesting to buy 10 of them, and run them in parallel for a long time to see how long the 1 second pulses stay synchronized. Any deviation beyond about 0.17 seconds per day would disprove the spec.
     
    atferrari likes this.
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,607
    Oops... it is the PCF2129A, available at Digi Key for $3.08 in single quantities. Even for 25 pieces it drops to $2.48 (both USD).

    (I edited my post after mech questions this.)
     
    elec_mech likes this.
  7. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,607
    They could be counterfeit, or cheaply bought surplus, or fallout out of spec (but still working), or they could have a fantastically good deal with Maxim (a company notorious for dealing with no one).

    Hey, for a couple bucks they are worth it for a breadboard, but they ain't going in any of my products.
     
  8. THE_RB

    Thread Starter AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I do. :)

    I've done projects calibrating the PIC xtal against a GPS timepulse. You can get <1PPM measuring precision in a second and after 1/2 hour get precision in the "parts per billion" range;

    [​IMG]

    [​IMG]

    http://www.romanblack.com/onesec/High_Acc_Timing.htm


    It should be no problem at all to use the same code to test the 1 pulse per second squarewave output of this RTC module.

    Re the counterfeit issue, I have found China manufacturers can buy brandname ICs for a fraction of what the brandname company sells them to western manufacturers. It allows brandname chip makers to get bulk quantities of their chip in consumer products. It's one of those dirty little China secrets. Same thing happens with brandname medicines.

    But that is not to say this IC is genuine, because China is also full of cheap fakes.

    Laser marking on the IC;
    DS3231SN
    0931A3 (2009, week 31, I believe)
    243AC (unknown?)
    # (weird, marks pin 1 instead of a dot)

    Anyway, proving it's accuracy should not be that hard. :)
     
    Last edited: Jul 26, 2014
  9. MrAl

    Well-Known Member

    Jun 17, 2014
    2,440
    492
    Hello there,


    Is that you Roman? If it is, nice to see you here.
    Looks like an interesting project there.

    To the OP mostly:
    It could also be a part from a production overrun where not as many units were sold as projected. This could happen when a new part comes out that supersedes the old part. The older part could end up in the surplus market, which means the part is often a lot less costly.
     
  10. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    I said most. You're the exception. :D

    Running a few in parallel would be cheaper, assuming you don't already have such a project already built. It wouldn't prove absolute accuracy, but it would disprove relative accuracy, which should be sufficient.
     
  11. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,607
    However, it is expected that same same parts would tend to have the same inaccuracies... say one runs a bit faster as the temperature rises then the next one probably does the same.

    Thus a different and preferably much more accurate standard shound be the basis of comparison. The GPS signal is a very good example of such a timebase.
     
  12. THE_RB

    Thread Starter AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    OK, here's an update. I plugged in the RTC module and couldn't do the test because it defaults to 8kHz output on SQW pin. I tried the MikroC compiler I2C library to set its registers but couldn;t get the I2C to work, I assume because it was too fast with my PIC at 40MHz.

    I wrote some manual I2C functions running about 80kHz and that seemed to do the trick. The DS3231 datasheet says its good for 100kHz I2C and also "fast" I2C at 400kHz, but I did not test that.

    Anyway i got the comms going and was able to set it to 1Hz output pulse, and read the clock etc.

    I plugged in the SmartGPS module (just a Ublox LEA6) and used the timepulse out of that, as I had done in other projects for precise xtal speed testing; (see photo 1).

    The code procedure was the same as I used before;
    * capture 1Hz pulse / edge with PIC 16bit TMR1 CCP
    * subtract with last capture, giving difference for 1 second
    * comparing that to XTAL 10MHz (timer1)
    * subtracting 10 million from the difference to give PPM *10
    * summing the last 10 values to give an average; PPM *100

    So the two values shown are accurate to 0.01 PPM, more or less. (see a couple of LCD images in photo 2).

    Running it for an hour confirmed that all was still ok, giving these additional readings;
    After 20 minutes;
    RTC -105.70
    GPS -105.28

    After 40 minutes;
    RTC -105.54
    GPS -105.15

    After 60 minutes;
    RTC -105.56
    GPS -105.17

    My PIC 10MHz XTAL was known to run approx 105 PPM slow, it is an old stable XTAL and I tested it months ago. So again this time against the GPS timepulse the XTAL read approx 105.2 PPM slow.

    The (really pleasant) surprise was the cheap DS3231 module! It started off at approx 0.42 PPM fast (compared to the GPS) and stabilised into the 0.35 to 0.39 range for most of the readings. Wow! :)

    Another good thing was the temperature compensation. The DS3231 datasheet says that it checks its temp every 64 seconds, and recalibrates its internal xtal. I put my finger on it to warm the DS3231 IC, and the RTC PPM error crept up by another 0.5 to 0.6 PPM, (DS3231 xtal getting faster) then BAM the temperature correction kicked in and over a few seconds it went back to the usual 0.35 PPM like when it was cold. Then removing my finger the same thing, a slide in freq, then the temp correction kicked in and very quickly it became accurate again. That was really nice to see.

    It looks like the real thing, or at least it's more accurate than advertised AND also has the temperature compensation that a ripoff clone might have left out.

    The datasheet shows a "ageing" register that can be adjusted by approx 0.1 PPM per bit. So ideally I could now adjust it from 0.35 PPM error to maybe as good as 0.05 PPM error. Very cool.

    I've also attached the MikroC source code in case you want to check my procedure or test this out for yourselves. I left the RTC clock reading code in place, it is just commented out.
    :)
     
    Last edited: Jul 26, 2014
    MMcLaren likes this.
  13. THE_RB

    Thread Starter AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Hi MrAl, yep it's me (and I'm the OP too haha). ;)
    Great to have someone of your calibre here! Did you get sick of the changes at the ETO forum?

    Yeah the 2009 date code looks like someone might have scored a few thousand ICs as end of production run or something.
     
  14. THE_RB

    Thread Starter AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I did some more tests and wrote some values to the "aging" calibration register. The datasheet said each bit would give approx 0.1 PPM adjustment to the timebase, but I found it to be about twice as fine as that.

    The error with no calibration was between 0.35 and 0.40 PPM, but I found it took a value of 6 to 7 in the aging register to bring that error down.

    I also changed the software to read and display the temperature register. This is a pretty cool featur of the DS3231 IC, it is actually a decent thermometer and the temperature register gives a readout in actual degrees C, with resolution of 0.25 degrees per bit.

    The other change I made in the software was to display the difference between the RTC and GPS values, to save me doing it mentally (subtracting GPS from RTC). So you can see in the LCD photos the bottom line shows the calibration value I was testing, and the error which was hovering around -0.06 PPM.

    It wasn't worth trying to get the timekeeping better than that. The GPS timepulse fluctuates around 0.05 PPM based on how mny satellites it gets, and which ones, where they are etc. And once I could see the DS3231 temperature value I could see it change 0.25'C and the timekeeping was a bit off because that was the smallest adjustment the temperature compensation could do.

    I left it running for a couple of hours and the PPM error was usually around -0.06 PPM, and varied maybe +/- 0.10 PPM but usually less. Some of that would have been the GPS variation.

    I was pretty happy with that, but I only saw temperature variation of a couple degrees C in total. Maybe it would have greater error if the temperature swung though a larger range? It was interesting being able to see the temperature register and its effect on the timekeeping.

    The new source code is below, with writing the calibration value and showing the temperature register etc.
     
  15. camerart

    Active Member

    Feb 25, 2013
    517
    30
    Hi,

    Is this the sort of clock that could be used in laser measuring devices?

    One day when I get time, I would like to investigate, thanks,

    Camerart.
     
  16. THE_RB

    Thread Starter AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Hi Camerart. I'm not sure about the laser measuring devices.

    Normally the ebay RTC module is used to give a 24 hour clock function to a device that gets turned off, because the module has a tiny CR2023 3v battery (cell). So it keeps time even when the main device is turned off or has a blackout.

    This DS3231 RTC is different from most of the common RTCs (like the DS1307) because it has precision timekeeping, so not only does it keep the time when the power is turned off but it keeps really accurate time. :)

    The GPS was only used as a reference, to test the timekeeping accuracy of the ebay RTC module.

    I hope that explains it. :)
     
  17. camerart

    Active Member

    Feb 25, 2013
    517
    30
    Hi Roman,

    It does explain it, thanks.

    Regarding Laser measuring. If you flash a laser (Low powered) very quickly and check the time it takes to bounce of an object and return, and accurate measuring device could be made. [Some other time perhaps:)]

    Camerart
     
  18. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    You do not need high ppm accuracy for that. Rather you need high resolution. Light can travel a foot in ns, so you would need resolution to ns. RTCs often use watch crystal, which has only about 30us resolution.
     
  19. camerart

    Active Member

    Feb 25, 2013
    517
    30
    OK, thanks.
     
Loading...