Hi All, I just received a couple of these very cheap, neat DS3231 based real time clock modules from China (ebay specials) and have spent a good while getting them configured with the latest (mid-2016) Jessie based Raspbian. The current info on the internet is mostly out of date, so by piecing together nuggets from here and there, I've established the minimum amount of work necessary to configure latest Raspbian (lite) to get the RTC module working. It's very simple
Once you have a nice shiny clean raspbian (or raspbian lite) image running (I used raspbian lite exclusively), and you've updated it to latest everything (sudo apt-get update; sudo apt-get upgrade; sudo reboot), you're ready to start.
There are only two edits you need to do:
1. put the below line into the /boot/config.txt file: (edit it with your favourite editor and type the line in - or copy and paste it from here
2. edit the /lib/udev/hwclock-set file (sudo nano /lib/udev/hwclock-set) and "comment out" the following lines ("comment out" means put a # at the beginning of each of the lines, so they become comments and are ignored by the system)
if [ -e /run/systemd/system ] ; then
so they become:
#if [ -e /run/systemd/system ] ; then
# exit 0
...and that's it - that's all you need to do. Shut down your system, connect the rtc module, then power up and test with the command:
sudo hwclock -r
this will read the time directly from the rtc module. If a sensible time string comes back, then you're cooking! Fully test by powering off the pi, disconnecting network cable (if you're running wireless, you may need to turn your router off for a bit), plug a screen into the hdmi output of the pi, wait 10 mins, then power it up. Once it's up, using a locally connected keyboard, log in and type "date" - if the time is correct and not 10 mins slow (or however long you had the pi powered down for) then the system has read the time correctly from the rtc module!!
Some posts have recommended de-installing the fake-hwclock package, or the ntp package - there's no need to do that - just do the above.
Before settling on the above steps, I tried lots of things from several web posts, including removing packages, downloading stuff, modifying the /etc/init.d/hwclock.sh file etc. I saw some of the rtc corruption that others have seen. But in the end (after re-flashing a new Jessie lite image several times
) the above was all that was needed. I've done this on a couple of different pis now, and the above seems to work consistently. So, all good.