A week or so ago I purchased the Sparkfun Real Time Clock Module “that uses the DS1307 to keep track of the current year, month, day as well as the current time”. Yesterday I created a prototype data logging project similar to the DS1307_RTC_Demo to serial print (as well as LCD print the time & date every minute) and over the course of 12 hours I’ve noticed that once or twice an hour it displays a random time and date. I don’t see any pattern to this behavior and it only lasts for a one minute cycle, but I thought that I would ask this forum if anyone has seen this and can point me to my issue or remedy. There is one comment under the hardware review that another user found that this problem has to do with a bad/outdated library, but the comment was no more specific than that. I have tried to find a solution, but so far nothing. If someone knows how to fix this please let me know.
Intermittently faulty wiring is a possibility, especially if this is on a breadboard (try moving or reinserting wires). Check for poor solder joints on modules.
I2C pullups that are too weak or connections that are too long (more than a few cm) can lead to I2C data transmission errors. So can faulty programming, for example interrupts interfering with communications timing.
All sensors and communications channels are subject to measurement and data transmission errors, and if it happens often enough to matter, your code should be able to recognize and ignore or correct the errors. It is easy to check for time and date errors, as from one reading to the next, quantities change subject to known constraints.