I’m using the PCF8563 (PCF8563T) RTC Breakout Board (connected via I²C) in a robot build. My goal is to log timestamps for events during robot operation. But I’ve noticed that the RTC drifts quite noticeably over periods of hours / overnight even when the robot is off or in sleep. I thought RTCs held fairly steady, but mine appears to lose somewhere between 30-90 seconds every 12 hours.
Here’s what I’ve setup and checked so far:
Powered the RTC with stable 5 V from the main supply.
SCL and SDA lines have pull-ups (10 kΩ) to the 5V line.
Microcontroller periodically reads current time from PCF8563 at startup and logs it.
Checked for any code bugs: time set is correct initially; afterward, reading simply shows drifting time.
Is this kind of drift typical for PCF8563 modules, given temperature changes or power cycling? Would adding a precision external crystal help, or is the onboard quartz good enough for moderate accuracy? Does keeping the module powered even when the robot is “off” (but still connected to power) help reduce drift?
If anyone has used the PCF8563 in robotics or logging projects, I’d love to hear what your drift numbers have been and how you handled them.
This type of drift is orders of magnitude too large, and makes using this module practically useless. The accuracy here comes in large part from the external crystal. Have you got a second module you can cross check with? There might be something off with this crystal. If you happen to have another 32.768kHz crystal you can try swapping these out. If you really want to start debugging you can remove the crystal and feed an external signal of the same frequency. See if that fixes it (if yes, it was the crystal, if no, it’s something else).
This particular RTC is impacted by temperatures. E.g. at 50 C, you can expect a drift due to temperature about 1s in 12 hrs. However, even in extreme temperatures it does not explain the large drift you are measuring. Something else is going on here…
One last guess, though I suspect this is highly unlikely, but… if the backup coin battery is failing, it could cause the RTC to stop intermittently, which is not drift in itself (which is making the oscillator run slower or faster), but manifests as large chunks of lost time. Quick check, swap out the coin battery.
If all else fails, maybe ditch this particular board and go with a more reliable one. We have a product that uses the DS3231 and it is by far more accurate. It also contains an internal temperature-compensated crystal oscillator (TCXO) and so temperature is not going to impact the drift like other RTCs.