Arduino Data Logger Shield RTC Drifts Backwards

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
JackInz
 
Posts: 1
Joined: Sat Jan 09, 2021 12:56 pm

Arduino Data Logger Shield RTC Drifts Backwards

Post by JackInz »

Hi. My Adafruit Data Logger Shield RTC drifts backwards after taking the correct time from my pc. After about 3 minutes of not advancing it settles down to a time about 8 minutes earlier that the time it started running. Has anyone ever heard of this and is there a solution? I've been playing with this code for calibrating through the Arduino Example from the RTClib > pcf8523 with no success. Thanks for any help.

float drift = -64; // seconds plus or minus over oservation period - set to 0 to cancel previous calibration.
float period_sec = (7 * 86400); // total obsevation period in seconds (86400 = seconds in 1 day: 7 days = (7 * 86400) seconds )
float deviation_ppm = (drift / period_sec * 1000000); // deviation in parts per million (μs)
//float drift_unit = 4.34; // use with offset mode PCF8523_TwoHours
float drift_unit = 4.069; //For corrections every min the drift_unit is 4.069 ppm (use with offset mode PCF8523_OneMinute)
int offset = round(deviation_ppm / drift_unit);
//rtc.calibrate(PCF8523_TwoHours, offset); // Un-comment to perform calibration once drift (seconds) and observation period (seconds) are correct
//rtc.calibrate(PCF8523_TwoHours, 0); // Un-comment to cancel previous calibration
rtc.calibrate(PCF8523_OneMinute, offset);
Serial.print("Offset is "); Serial.println(offset); // Print to control offset

User avatar
tuttles_mower
 
Posts: 23
Joined: Tue Nov 19, 2013 8:48 pm

Re: Arduino Data Logger Shield RTC Drifts Backwards

Post by tuttles_mower »

Ive had wonky things very similar to this. I found the problem to go away if I reloaded the sketch. sometimes its helpful to hold your breath while standing on your left foot.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”