Real Time Clock Hardware Issue: Incorrect time

Clock does not work with battery installed and does not sync with computer time with or without the battery.

When installed, the serial monitor returns 25:165:85 as a time and does not change. After removing the battery, the clock runs but starts from about 11:27 regardless of actual time. The clock does not appear to be getting updates from the computer. This issue is present even using the code provided with the library.

After hooking up an oscilloscope to the module with the battery installed, it doesn’t seem to be sending the signal to start the clock. Did not try with the battery removed.

Voltage of batt removed: 2.98

Voltage of batt installed: 3.01

I am running Windows 10 on a ThinkPad P50

Arduino version 8.15

Hello kadoat.

There’s a bug in Arduino where it only will grab the time from your computers clock the first time you compile and upload. If you compile and upload a second time, the time on the clock from the previous compile will be used. You have to quit Arduino and restart it to get the current time again.

Our example code sets the clock to the compile time every-time it runs so what you’re going to want to do is get the time set once, disconnect the RTC from the Arduino, modify the sketch to not set the clock again and re upload, then reconnect the RTC. Once you’ve done that, the RTC is set and you should be good to go.

Thanks. I set the time manually. Seems to be working in that regard.

Any ideas about why the board doesn’t work with the battery in? Without it, I’ll have to manually set the clock each time the Arduino loses power.

Hi Kadot.

I’m not really sure why it’s not working with the battery, but I’m going to replace the board for you.

Just bring back the one you have now and I’ll have a tested known good board waiting for you at our front desk.

TS-Chris

Ok, I was an idiot. I had soldered the board to a quick connector (SQW on it’s own wire). The Qwiic connector connects to 3.3v

Paraphrasing from exaustgas’s post in the Arduino Forum: For this chip to work, VCC of the DS1307 must be connected to a voltage that is at least 1.25 times the backup battery voltage. (5v from your arduino).

https://forum.arduino.cc/index.php?topic=189283.15

I cut the VCC wire from the Qwiic connector and plugged it into a 5v pin on the Arduino. Works as advertised - battery in or out.

Chris, thanks for your help and the extra board. I have another pick-up order tomorrow. Happy to pay for the replacement board you provided as the fault was my own.