I'm assembling a Smart Mirror for an applied project for college. This mirror has a Raspberry Pi 3 on the back. How this all started is that the campus' network blocks NTP, so we had to buy an RTC chip for the Pi to be able to keep track of time properly. We bought a DS3231.
So, I install the chip, install the i2c interface, and "sudo i2cdetect -y 1" let me know that the address of the DS3231 is "UU", at the 0x68 spot. I then tried various tutorials to try and get the Pi to take time from the RTC. I come to find out from reading this forum that a lot of the tutorials out there are inaccurate and contradictory, and that the only thing I should need to do is add the "dtoverlay=i2c-rtc,ds3231" line to /boot/config.txt. However, I had already screwed up the Pi beyond repair at this point, so I just re-installed Raspbian to a spare SD card I had lying around, and tried the one-step solution on this new installation.
It seemed to work. I used NTP (at home) to sync the system time, then wrote that time to the DS3231. I disabled NTP at startup with the "sudo update-rc.d ntp disable" command, and disabled Wi-Fi before power-down. I unplugged the power to the Pi and let it sit for about 5 minutes and then turned it back on. The Pi had the proper system time, and the RTC had the same time as well. Since I disabled NTP at startup, it would seem that the system is getting its time from the RTC. Awesome. Or......
The guy I'm working with said I should shut it off and let it sit for about an hour and then turn it back on. So I did. The system time was about 40 minutes behind where it should have been, and the RTC time was set to 1999. It seems that the RTC isn't storing time for extended periods of time. Is there any specific steps I should take to get it to store time properly?
UPDATE: The DS3231 is not not keeping time after shut down of ANY period of time. I just did a shutdown and turned the Pi back on after only 10 seconds, and "sudo hwclock -r" showed the DS3231 clock at 1999.