Go Down

Topic: My DS1302 RTC gets ahead of real time (Read 15470 times) previous topic - next topic

liuzengqiang

I meant "to get rid of drift, use gps or network". Right, more power consumption and more costly.
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter

magnetman

I ordered a DS3231 from China via Ebay. We'll see how that goes.
Now I got 2 DS1302 modules and no use for them. Should I try to change the crystals to see how that goes? Or just scrap them?

Thank you all for the help in this thread.

JimboZA


Should I try to change the crystals to see how that goes? Or just scrap them?


That depends on the answer to my reply at #9.... Do you have crystals of not only the right frequency, but the right capacitance?
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

magnetman

Well I was planning to go search them at the local electronics shops after you guys tell me what crystal should i get, cause on the one that's now on the board I can't see any markings, and my module didn't come with a datasheet. I guess all crystals for the ds1302 should be the same, right?

JChristensen


Well I was planning to go search them at the local electronics shops after you guys tell me what crystal should i get, cause on the one that's now on the board I can't see any markings, and my module didn't come with a datasheet. I guess all crystals for the ds1302 should be the same, right?


It needs to be a 32.768kHz crystal with a 6pF load capacitance. This is not the same as crystals for DS1307, which need a 12.5pF load capacitance. See the datasheet (p4, 5) for more info:
http://datasheets.maximintegrated.com/en/ds/DS1302.pdf

JimboZA


my module didn't come with a datasheet.


Nothing comes with a datasheet.... you can find them all on the 'net.

I don't see any markings on my crystal either, I just know it's the wrong one from the invoice. Your symptoms are consistent with the wrong capacitance.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

magnetman

I got my cheap ds3231, this one is loosing 1-2 seconds a day. I remember you guys telling me this one can be calibrated by code. Where should I research that. Any pointers?

As far as stuff from ebay goes I finally understood. They are good at cheap stuff but not precise stuff. I still can't understand how cheap electonics can have precise time chips, but this ones that are sold separately for arduino hobby are so bad at keeping time.
Thank you very much for the help.

JChristensen


I got my cheap ds3231, this one is loosing 1-2 seconds a day. I remember you guys telling me this one can be calibrated by code. Where should I research that. Any pointers?


Everything is in the datasheet.

DS3231 has an aging offset register that allows the oscillator to be adjusted in approximate 0.1 ppm steps. It's an 8-bit register, so maximum adjustment is less than 13 ppm.
Stated accuracy for DS3231 is ±2ppm from 0°C to +40°C. This is about 0.17 seconds per day.
One second per day would be 11.6ppm, way out of spec.
The aging offset register can compensate for that, but not much more.
Good luck.

magnetman

Thank you very much.
After checking time once again, surprise, it's within 1 second of real time again. That led me to belive the temperature compensation does't work so great. I need to leave it running more before calculating the offset.
Now, another problem regarding the ds3231 breakboard I bought. It has a place on board for a rechargeable lithium ion battery that is hard to get around here. Is there any simple way to make it compatible to a regular battery or maybe use a bigger lithium ion battery soldered instead of the coin cell port?
This is the board model i have:
http://www.ebay.com/itm/DS3231-AT24C32-IIC-module-precision-Real-time-clock-module-memory-module-Arduino-/400503978923

JChristensen

Temperature compensation seems to work very well here, although I haven't done any extreme tests. I have a couple gadgets with DS3231s sitting on window sills. They catch direct sun and in the winter probably are cooler than the rest of the house. They've been operating continuously since last fall sometime and are both within 5-10 seconds. Like I said, that's not an extreme test, but I've tried non-temperature compensated RTCs in those same locations and they drift a lot farther than the DS3231s, and also a lot farther than non-temp compensated RTCs in other parts of the house where temperature is more constant.

I use regular lithium coin cells for all my RTCs, including DS3231 and DS3232. I use CR2016 mostly, but also some CR1220 (which may be a bit on the wimpy side, but should still last for years). I hardly see the point in a rechargeable cell, estimates I've seen indicate that the regular lithium coin cells should last 5-7 years.

magnetman

#25
Jul 11, 2014, 06:14 pm Last Edit: Jul 11, 2014, 07:26 pm by magnetman Reason: 1
Could i use regular battery in my breakboard, which is made to use a rechargable coin cell? That is what i am asking, how to go about not using a rechargable coin cell battery.
Multimeter on battery pins on the board gives me 4.75V, so i guess i can't.
Or, could i use a 3.7 v li-ion 1090 mAh battery pack?

JChristensen

#26
Jul 11, 2014, 07:45 pm Last Edit: Jul 11, 2014, 07:48 pm by Jack Christensen Reason: 1

Could i use regular battery in my breakboard, which is made to use a rechargable coin cell? That is what i am asking, how to go about not using a rechargable coin cell battery.
Multimeter on battery pins on the board gives me 4.75V, so i guess i can't.
Or, could i use a 3.7 v li-ion 1090 mAh battery pack?


Depends on what else is in the circuit. Would really need to have a schematic for the board. DS3231 is fine with a 3V backup battery. See the circuit on the first page of the datasheet. Very simple, the battery just goes from the VBAT pin to ground. Again, not knowing the circuit for this particular board, but it may be possible to just remove whatever circuitry was involved with the rechargeable battery and connect a regular lithium coin cell directly to the DS3231 VBAT pin.

Datasheet says the VBAT voltage can be anywhere from 2.3V to 5.5V, with 3.0V being "typical". So a pair of AA or AAA cells would also work. But that would be gross overkill, as would a Li ion pack with 1090mAh capacity.

Go Up