Posts: 2
Threads: 1
Joined: Jul 2023
Reputation:
0
I am having problems with the DS1307 RTC. It works fine when it is not used with the CR1220 button cell backup. When the CR1220 button cell is inserted the time cannot be set up and it always read 2165/165/165 (Saturday) 165:165:85. I have tried two CR1220 button cells, one of them new, and I have checked that they provides 3 V. Any suggestion?
Posts: 291
Threads: 234
Joined: Jan 2021
(07-20-2023, 05:30 PM)jmartin Wrote: I am having problems with the DS1307 RTC. It works fine when it is not used with the CR1220 button cell backup. When the CR1220 button cell is inserted the time cannot be set up and it always read 2165/165/165 (Saturday) 165:165:85. I have tried two CR1220 button cells, one of them new, and I have checked that they provides 3 V. Any suggestion?
can you post your code?
Posts: 291
Threads: 234
Joined: Jan 2021
#include <Wire.h>
#include <RTClib.h>
RTC_DS1307 rtc;
void setup() {
Serial.begin(9600);
Wire.begin(4,15); //SDA is GPIO4 SCL is GPIO15
rtc.begin();
// Set initial time
// rtc.adjust(DateTime(2023, 7, 21, 9, 53, 50));
// You only need to set the initial time once. After setting the initial time, you should comment out the
//above line when uploading the code again to avoid resetting the time every time you start.
}
void loop() {
DateTime now = rtc.now();
// Print the date and time
Serial.print("The time is: ");
Serial.print(now.year(), DEC);
Serial.print("-");
printDigits(now.month());
Serial.print("-");
printDigits(now.day());
Serial.print("-");
printDigits(now.hour());
Serial.print("-");
printDigits(now.minute());
Serial.print("-");
printDigits(now.second());
Serial.println();
delay(1000);
}
void printDigits(int digits) {
if (digits < 10) {
Serial.print("0");
}
Serial.print(digits);
}
Posts: 291
Threads: 234
Joined: Jan 2021
1.download the code the serial port print the time
2.power off and install CR1220
3.power on and read the time again(before power off the time is 10:02:45,and power on the time is 10:03:57)
Posts: 2
Threads: 1
Joined: Jul 2023
Reputation:
0
Thai you for the recommendations. I have followed the steps, uncommitted the set up the time and I get :
The time is: 2165-165-165-165-165-85
When I remove the cell everything is fine. I get:
The time is: 2023-07-21-09-53-51
Anything else I can try?
Posts: 1
Threads: 0
Joined: Sep 2023
Reputation:
0
09-03-2023, 08:57 PM
(This post was last modified: 09-03-2023, 09:09 PM by aminhajali.)
Dear,
I am facing the same issue
Posts: 2
Threads: 0
Joined: Sep 2023
Reputation:
0
I have the same problem, any suggestions?
Posts: 6,325
Threads: 808
Joined: Oct 2020
Reputation:
155
09-28-2023, 05:06 AM
(This post was last modified: 09-28-2023, 05:09 AM by admin.)
what's your battery voltage now?
when you intsall or change battery, do you have turn OFF the power of board? it should turn OFF power , install battery, power on board again.
Posts: 2
Threads: 0
Joined: Sep 2023
Reputation:
0
After checking the DS1307 datasheet, I found a note mentioning the chip malfunctioning when using a diode in series with the "Vbat" pin. I removed diodes D5 and D7 from the board, and put a Jump in place of D7, and now it's functioning normally.