RTC just keep time the first time

Ok, this is a weird issue which I have never experimented until now and because english is not my mother tongue, I don't know how to search it on the internet.

I tried the example given by the RTCLib library. I set the time and date of the system and arduino show it ok on the serial monitor.

I disconnected the rtc (always with a battery. New battery cr2032 3v). After a few hours, I connected it again and I checked the time. it gives me the correct date (today) but hour and minutes are the same as the time I connected first.

So it keeps the time but not increment it, just keep the time it is saved.

Any idea? My rtc are tinyRTC from goodluckbuy but they worked fine in past. I have 3 of them and all with the same problem.

The example code sets the RTC to the time that the code was compiled. If you restart the Arduino without reloading the code, it just sets it back to that same time. If you recompile the code and upload it, the time will now be updated. But what you need to do is upload the code once to set the date/time, and then modify the code to remove the part that resets the date/time. After that the code should use the correct time from the RTC.


I know. I upload the code with set time function. Then, I upload the code again without it. But After power off the arduino, if I power on it again, the hour in rtc is the hour when I upload code for the first time (with set time function).

I read about it on the internet and I found it can be a problem of the rtc board. Something about less voltage than needed or so. I don't know. It worked fine some months ago but not now.

In that case, post your code (in code tags) and have you checked that the backup lithium battery in the RTC is still at least 3V?