1
\$\begingroup\$

I am building an Arduino based project with DS1307 RTC clock module and storing an offset value, rarely updated though, in its EEPROM. But I am observing drift in the time as well as the offset value in the EEPROM over time. The stored value of -18 in the EEPROM changed to 104 after 3-4 days. I suspect the time is changing more rapidly, about one minute in a day. I am also using AltSoftSerial to communicate with a GSM Mini 900A module. I suspect some issue in the Arduino, as the project works flawlessly in some other hardware. I wrote two bytes on address 0 and 1 and after the drift I tried on address 100 but no improvement. The change in the EEPROM stored value is very surprising. What are the general characteristics of a faulty Arduino UNO board?

\$\endgroup\$
8
  • \$\begingroup\$ Please specify which RTC module you are using, quantify the drift you are observing and tell us how you are updating the the "offset" (which I understand is a kind of correction for the stored time, but if not, please also explain). \$\endgroup\$
    – devnull
    Apr 3 at 17:51
  • \$\begingroup\$ "The change in the eeprom stored value is very surprising." Yes, it is. Basically it is stored in RAM powered by the same source that keeps the RTC running. Serial communication errors and a bad backup power come to mind. Not to mention firmware bugs. \$\endgroup\$
    – devnull
    Apr 3 at 18:18
  • \$\begingroup\$ The variable value in the RAM was updated from the eeprom and the value shouldn't change even after a power reset. \$\endgroup\$
    – seccpur
    Apr 3 at 18:23
  • \$\begingroup\$ yes, when you update it, it is copied and stored in RAM inside the IC, which is powered by the backup power and should not be corrupted. \$\endgroup\$
    – devnull
    Apr 3 at 18:33
  • \$\begingroup\$ "...and storing an offset value" - where does this offset value come from? "....to communicate with a gsm mini 900A module" what happens if you don't include the GSM module? \$\endgroup\$ Apr 3 at 19:21
2
\$\begingroup\$

Any RTC that depends on an internal oscillator will drift with respect to time, the only question is how fast. As well as inherent drift, temperature changes, voltage changes and noise can affect the timekeeping. According to the chip datasheet:

enter image description here

A drift of 1 minute per day (700ppm) is much more than one would expect from a crystal by maybe 50 or 100x so maybe the issue is noise coupled from the Arduino reads and poor layout or circuit arrangement in your implementation or in the design of your module (presumably an inexpensive hobbyist-oriented product).

If the clock is running fast, this is most likely the issue. If it's running slow, then it may be something else.

\$\endgroup\$
1
  • \$\begingroup\$ "A drift of 1 minute per day (700ppm) is much more than one would expect". As a reference, I've been using the same IC for a long time and it has been drifting around 5 seconds a week. \$\endgroup\$
    – devnull
    Apr 3 at 18:12
1
\$\begingroup\$

You seemingly have different thinking principle than most of us.

The only general sure thing of faults is that they can cause something which differs from the specs. I wrote can - it's well possible that nothing noticeable has still happened and if some anomalies have been seen, they can be caused by misuse or errors in other parts of the system.

So: You cannot get a short general checklist that you can work through and can decide "the board is ok because all steps in the checklist gave OK".

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.