Smart Home Automation Forum
RTC stop working with button cell - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A6 (https://www.kincony.com/forum/forumdisplay.php?fid=22)
+--- Thread: RTC stop working with button cell (/showthread.php?tid=3097)

Pages: 1 2


RTC stop working with button cell - jmartin - 07-20-2023

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?


RE: RTC stop working with button cell - KinCony Support - 07-21-2023

(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?


RE: RTC stop working with button cell - KinCony Support - 07-21-2023

#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);
}


RE: RTC stop working with button cell - KinCony Support - 07-21-2023

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)
   
   


RE: RTC stop working with button cell - jmartin - 07-21-2023

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?


RE: RTC stop working with button cell - aminhajali - 09-03-2023

Dear,
I am facing the same issue


RE: RTC stop working with button cell - Jbenzo87 - 09-24-2023

I have the same problem, any suggestions?


RE: RTC stop working with button cell - admin - 09-28-2023

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.


RE: RTC stop working with button cell - admin - 09-28-2023

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)


RE: RTC stop working with button cell - Jbenzo87 - 10-02-2023

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.