Hi all
I have an issue with a Grove RTC clock connected to a Grove Shield on Arduino Uno.
I can set the clock via the official code, but after unplugging the board it always resets, here an example output:
Set time :
|10:35:35|12/15/2021 15TUE |
|10:35:35|12/15/2021 15TUE |
|10:35:35|12/15/2021 15*TUE |
Upload some code to read time :
12/15/2021 10:35:44
12/15/2021 10:35:45
12/15/2021 10:35:46
Unplug / plug board :
RTC is NOT running!
1/1/2000 0:0:0
1/1/2000 0:0:0
1/1/2000 0:0:0
1/1/2000 0:0:0
The code used for reading the time is the following
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
Serial.begin(9600);
Wire.begin();
RTC.begin();
// Check to see if the RTC is keeping time. If it is, load the time from your computer.
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");
// This will reflect the time that your sketch was compiled
// RTC.adjust(DateTime(__DATE__, __TIME__));
}
}
void loop () {
DateTime now = RTC.now();
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print('/');
Serial.print(now.year(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
delay(1000);
}
I have tried with 2 RTC chips and 2 different batteries, what could be the reason for the RTC not storing the time?
thanks