Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RTC stop working with button cell
#1
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?
Reply
#2
(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?
Reply
#3
#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);
}
Reply
#4
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)
   
   
Reply
#5
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?
Reply
#6
Dear,
I am facing the same issue
Reply
#7
I have the same problem, any suggestions?
Reply
#8
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.
Reply
#9
if can't work, try to use this A6 board test program, that have include DS1307 RTC function.

.zip   KC868-A6-ALL_CODE.zip (Size: 1.92 KB / Downloads: 154)
Reply
#10
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.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)