DS3231 Clock Module 3.3V / 5V High Accuracy For Raspberry Pi
A very compact real time clock (RTC) module is based on the high accuracy DS3231 IC and includes a rechargeable batter backup. The (HCRASP0009) module also has a header with a pinout specifically designed so that it can be plugged directly into the IO header of your Raspberry Pi without any need for additional wires or soldering. The module makes use of the Raspberry Pi's I2C hardware interface. Using our configuration guide available on our support forum it will allow your Raspberry Pi to accurately keep the current time and date without an internet connection making it great for remote data logging application where not internet connection is available.
Although specifically designed for the Raspberry Pi, its ability to with with both 3.3V and 5V logic levels means it can also be used with most types of microcontroller development boards such as the Arduino.Features:
Item number: HCRASP0009
Accuracy: ± 5ppm (± 0.432 sec / day) within -40oC to +85oC temperature range.
Battery backup allowing accurate time keep without a power supply
Low power operation
Clock functions include seconds, minutes, hours, day, date, month and year timing.
Timing valid up to year 2100
Two calendar alarm
High-speed (400kHz) I2C serial bu
+2.3 V to +5.5 V supply voltageRaspberry Pi Setup Guide:Please note: To follow this guide your Raspberry Pi should be connected to a monitor, mouse, and keyboard and will need a working internet connection. This guide has been tested on the Raspbery Pi version 2. Before following this guide we strongly recommend that you backup your data and/or SD card image. We cannot accept responsibility for any loss or damaged caused by not following this advice.
Firstly we need to determine that your Pi can see the RTC module. To do this we need to install the I2C utilities. In a terminal window on your Pi issue the following two commands:
Answer yes (y) to any questions.
Next we need to add support to the Raspian kernal for I2C devices. Issue the following command:
In the menu that opens up use your arrow keys to select the 'Advanced Options' as shown:
Hit enter and then in the next screen select 'I2C'
Answer yes to confirm that you wish to enable I2C support
Select OK on the next prompt and finally when asked if you would like the I2C kernel module loaded by default answer YES. Click OK one final time to confirm.
Once back in the config screen select finish to get back to the command prompt. You should be prompted if you wish to reboot. Select yes. If you're not asked to reboot then just issue the following command at the command prompt:
Wait until your Raspberry Pi has rebooted.
Once it has rebooted we can now check that everythign is working. Open up another terminal windows and issue the following command:For old version 1 Pi's:OR for newer version 2 Pi's:
The command will return a list of all connected I2C devices. You should see something similar to this:
If the RTC module is installed correctly is should be reported as device 68Configuring the module:
We first need to load the RTC module. Issue the following command:
Next switch to a super user with the following command:
Your shell prompt should change to the following:If you have an older version 1 Pi issue the following command:OR if you have a newer version 2 Pi issue the following command:
Exit out of super use by typing:Reading the current time from the module:
Issue the following command:
The command should report back a time and date. However this will be incorrect as the RTC module has not yet been configured to the correct date and time and will probably report a date of Thu 27 Jan 2000.Setting the correct time and date:
Make sure your Pi is connected to the internet and issue the following command:
If your Pi has internet access it should report the correct time and date.
You can simply write this correct time and date to the RTC module with the following command:
Confirm that it has been written connrectly by reading the time out of the RTC module again:
The module should now report the correct time and date.Configuring your Raspberry Pi to read the RTC module at reboot.
You will now need to configure your Pi so that it reads the current time from the RTC module each time it reboots.
The RTC module will need to be added to the modules list so that it is loaded everytime your Pi boots. Issue the following command:
A text editor will open with the module list. Add the RTC module to is as shown in the image below:
Press CTRL-X, then y, then enter to save and exit the editor.
Next we need to edit the rc.local file which will create the RTC module as a new device when your Pi is booted. Issue the following command to edit the rc.local file:
In the text edit add the follwing lines to the bottom of the file, but before the 'exit 0' line:
Exit the editor by pressing CTRL-X, then y, then enter.
We now need to test everything is working by powering down your Pi. Issue the following commandsudo shutdown
Wait for your Pi to shutdown and then remove the power for a few seconds.
Connect the power back to your Pi so that it reboots but this time make sure there is no internet connection.
Once rebooted, open up a terminal window and issue the following command:
If everything is installed and configured correctly it should report back the correct time and date despite not having an internet connection.