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.

  • Is the power supply to your RTC chip good while the Pi's shut down?
    – goobering
    Mar 2, 2017 at 17:33
  • Just checked that with my multimeter, chip was getting a steady 3.3v. Mar 2, 2017 at 18:50
  • All you have to do is dtoverlay=i2c-rtc,ds3231 do NOT fiddle with anything else. You should say which module. Some which use a "supercapacitor" rather than a battery don't run for long.
    – Milliways
    Mar 2, 2017 at 22:58

1 Answer 1


Same problem occured a year+ ago for me, here is the reason: most modules are 5V tolerant for a RTC chip, but the battery charger is strictly 3.3V! So if you power it on 5V - it will start choking battery with 5V(checked it with my multimeter) - and it dies. Use strictly 3.3V and check your battery - one of my modules had a faulty one, I've replaced it and it's still ok for 1year+, another module has a badly inserted one, but the battery was good - it just loosed it's contact sometimes: I just removed it and replugged it firmly - and it's OK still too, for 1year+ time.

  • Interesting, that might be the problem. I used this as the guide for where to plug in the RTC chip: thepihut.com/blogs/raspberry-pi-tutorials/… Mar 2, 2017 at 18:03
  • can you send a pic of your module(s) ? Mar 2, 2017 at 18:04
  • My images won't link for some reason, so here's the Imgur URL: imgur.com/a/lTBkl Also, according the the GPIO pin-out, it seems that I had the RTC plugged into the 3.3v pin, so I don't think that this is the problem. Mar 2, 2017 at 18:19
  • these ones are having one more "problem" - the chip on top seems to attract the statics to itself from all the surroundings and it flushes itself on. Battery issue is applicable too - my friend used to experience it. You better use the ones looking like this(I'm using it) - potentiallabs.com/cart/image/cache/catalog/New%20Components/… - and it's a glitch-proof, only replug the battery before starting and check the battery itself. Mar 2, 2017 at 18:23
  • 1
    Is there a version that has GPIO headers installed? Mar 2, 2017 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.