HOW TO Install a ChronoDot Real Time Clock (RTC) on Slackware ARM on a Raspberry Pi

This project would suit those who do not wish to depend on NTP servers for time information, or where no Internet connection is available, and accurate time is a factor. There may be other reasons why you might want to rely on an onboard RTC for time keeping purposes but, alas, the Raspberry Pi doesn't come with one. So we thought it would be cool and interesting, as well as good fun, to give our Slackware ARM Linux system a real time clock (RTC) module. For this project we used a Raspberry Pi model B 512Mb rev.2 (Made in China).

What you will need for this project

• Your Raspberry Pi running Slackware ARM 14.1, or 14.0 Linux
• A ChronoDot Real Time Clock (RTC) module and suitable cables to connect it to your Raspberry Pi.
• The i2c-tools Slackware ARM package - i2c-tools-3.1.0-arm-1_SBo_fd.tgz [MD5]

FatDog says ... The RTC module we're using in this project is the ChronoDot v2.1 [DS3231SN] which we acquired from those very helpful people at One reason why we chose this particular RTC is because it comes as a complete unit and we don't need to do any soldering. Another reason was because it's already supported by the rtc-ds1307 module under Slackware Linux. The extreme accuracy of the ChronoDot's Maxim DS3231 controller was also a major factor in selecting this RTC module.

Connecting the ChronoDot RTC module to your Raspberry Pi

With everything powered off, follow the diagram below and connect the ChronoDot to your Raspberry Pi GPIO header. One easy way to do this is by using solderless female-female breadboard jumper cables which simply "plug-in". You can of course make your own connections and cables by using old CD/DVD ROM audio cables, etc. The only important thing is that you ensure the wiring is correct and insulated.

• ChronoDot VCC Raspberry Pi GPIO Pin 1 (3v3)
• ChronoDot SDA Raspberry Pi GPIO Pin 3 (SDA)
• ChronoDot SCL Raspberry Pi GPIO Pin 5 (SCL)
• ChronoDot GND Raspberry Pi GPIO Pin 9 (Ground) - can also be connected to GPIO Pin 6 (Ground)

FatDog says ... NB: Make sure you connect the ChronoDot to the 3.3v power supply and NOT the 5v power. Although the ChronoDot is designed to operate on anywhere between 2.3v and 5.5v, on the Raspberry Pi we need to be powering it from the (3v3) 3.3 volts supply using GPIO Pin 1.

Connect the 3v Lithium CR1632 coin cell battery to the ChronoDot RTC (which comes supplied). Make sure the polarity is correct! Do a final check of the connections between the ChronoDot and your Raspberry Pi, just to be sure.

Now you can power on your Raspberry Pi and boot into your Slackware ARM Linux operating system.

Once you have booted to the login prompt you should login as 'root' user. If the date is not already set to current time you should now set it manually, or use the 'ntpdate' command. It's a good idea to make sure your Slackware ARM software and Raspberry Pi kernel and firmware are fully up to date. Running slackpkg and rpi-update at this point will achieve this and, depending on the number of updates available, may take a while to complete. A reboot may also be required.

Installing & configuring the ChronoDot RTC on Slackware ARM

As 'root' user, you're going to change to the /tmp directory and download the i2c-tools [MD5] package. Type the following commands to achieve this:

root@myrasbox:~# cd /tmp/
root@myrasbox:/tmp# wget
FatDog says ... This i2c-tools Slackware ARM package was created specifically for this project using the i2c-tools.SlackBuild script available from because it didn't seem to be already available for download on the Internet (which we thought was very strange). So a bit of D.I.Y. was required. It goes without saying that i2c-tools for linux is useful for more than just setting up RTCs on a Raspberry Pi.

You may also want to verify the file's integrity with the MD5 checksum: 9b8bacd037cc7e49e9b7de68db966f7c
Or download the file:

root@mynixbox:/tmp# wget

Next you're going to install the i2c-tools package. This software contains a diverse set of I2C tools for your Slackware ARM Linux system: a bus probing tool, a chip dumper, register-level SMBus access helpers, EEPROM decoding scripts, EEPROM programming tools, and a python module for SMBus access. Type the following command to install it:

root@myrasbox:/tmp# installpkg i2c-tools-3.1.0-arm-1_SBo_fd.tgz

Once this has completed you should see the following output.

After installing the i2c-tools package, you're going to edit the rc.local file and instruct the Slackware ARM system to load the required modules and perform commands at boot time in order to communicate with the ChronoDot RTC. Do this with 'nano' by typing:

root@myrasbox:/tmp# nano -w /etc/rc.d/rc.local

You will hopefully see something similar to the screenshot below.

You need to tell the system to load some specific modules. These will be explained later. Enter the following code into the rc.local file below any existing text:

/sbin/modprobe i2c-bcm2708
/sbin/modprobe i2c-dev
/sbin/modprobe rtc-ds1307

Pay attention to the next section because it is important. Whether you are using a Raspberry Pi rev.1 or rev.2 depends on the code you need to enter and this is crucial towards success. If you're not sure which revision you're currently using it's easy to check which Raspberry Pi board revision you have from this link.

• For Raspberry Pi rev.1 boards you need to enter the following code into the rc.local file below the text you have just entered:

echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
/sbin/hwclock -s

• For Raspberry Pi rev.2 boards you need to enter the following code into the rc.local file below the text you have just entered:

echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
/sbin/hwclock -s

The last thing you need to do before saving the rc.local file is to comment out the sntp line by putting a #hash in front of it. This stops the system from attempting to grab the date from a NTP server over the Internet at boot time. It would be a little pointless to have our system get a time reference from a NTP server when there's a highly accurate ChronoDot RTC available! :-D

Now you should have a rc.local file looking very similar to the one below.

Once you've finished editing the rc.local file press CTRL+X keys to exit, press "Y" (yes) when asked if you wish to save any changes and then press Enter to save the file.

FatDog says ... The i2c-bcm2708 module is the low level i2c subsystem driver. The i2c-dev module allows access to devices through the /dev interface. The rtc-ds1307 module contains the drivers for many RTC controllers, such as the DS1337 and MCP79410. Using the 'modinfo rtc-ds1307' command shows you that the DS3231 (i.e. the ChronoDot) is supported within the rtc-ds1307 module, and that's why it's needed at boot time.

The 'echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device' command is telling the i2c subsystem that there's a new 'ds3231' device available (the ChronoDot) and where it is on the bus. It's worth noting that this command only works the first time you use it. Any repeated usage will result in an error message.

The '/sbin/hwclock -s' command is asking the real time clock (the ChronoDot) for a time reference and subsequently writing that date and time to the Slackware ARM Linux system.

It's time to get it all working

So now your rc.local file should be configured to initialise the ChronoDot RTC and use it at boot time. You could 'reboot' at this point to test your setup but there's no real need to do so.

Instead of rebooting your Raspberry Pi, you can simply run the rc.local file to load the modules and perform the commands required to get the ChronoDot RTC working with the system. Type the following code to run the rc.local file:

root@myrasbox:/tmp# /etc/rc.d/rc.local

After running the rc.local file you need to make sure the ChronoDot RTC is being recognised by the system and, most importantly, set the correct time and date on it. So, depending on whether your Raspberry Pi is a rev.1 or rev.2 board (check it with this link), type the following:

• For Raspberry Pi rev.1 boards use this command:

root@myrasbox:/tmp# i2cdetect -y 0

• For Raspberry Pi rev.2 boards use this command:

root@myrasbox:/tmp# i2cdetect -y 1

The screenshot below is the result you're looking for. It shows that the device has been detected and recognised.

FatDog says ... Instead of '68' being displayed you might see 'UU' in its place. This is perfectly fine because it just means that a software driver (the rtc-ds1307 module) has been loaded and is currently using the 0x68 address. In both cases it indicates the ChronoDot RTC has been detected.

So you can go right ahead and find out what time and date is set to on your ChronoDot RTC. If this is the first time you have used it don't expect the current settings to be anywhere near accurate. Type the following command:

root@myrasbox:/tmp# hwclock -r

The result should be something similar to what you see below. Notice that in our screenshot the current date and time is years out on the ChronoDot. Yours may also be the same. However, this is just a transient error because it's the first time the ChronoDot RTC has been powered on. ;-)

Setting the ChronoDot RTC to the correct time & date

This can be achieved in two ways: manually using the 'date' command, or by utilising a NTP server on the Internet with the 'ntpdate' command. The latter is preferred for accuracy reasons alone.

• Set the time and date on the ChronoDot RTC manually by using the following command (pay attention to the date format):

root@myrasbox:/tmp# date MMDDHHmmYYYY && hwclock -w

The month (MM), day (DD), hour (HH), and minute (mm) values are always specified in 2 digits and have a leading zero '0' when applicable. The time is always specified as the 24 hour clock. The year (YYYY) value is always specified by 4 digits.
Example: if the time is 9:17am on August 14, 2013 then the command would be as follows:

root@myrasbox:/tmp# date 081409172013 && hwclock -w
FatDog says ... In our example above the 'date 081409172013' command sets the time and date on our Slackware ARM Linux system and the 'hwclock -w' command which follows then writes that date and time to the hardware clock (the ChronoDot RTC).

• Set the time and date on the ChronoDot RTC using a NTP server with the following command:

root@myrasbox:/tmp# ntpdate && hwclock -w
FatDog says ... The 'ntpdate' command grabs the current date and time from a NTP server and writes it to our Slackware ARM Linux system. The 'hwclock -w' command which follows then writes that date and time to the hardware clock (the ChronoDot RTC). The NTP server you use does not have to be the same one as in our example.

NB: The above 'date' and/or 'ntpdate' command(s) can be used at any time (as 'root' user) to set the time & date on the ChronoDot RTC.

Now type 'hwclock -r' to see if you have successfully set the ChronoDot RTC to the correct date and time. You should check the output to make sure it's accurate.

FatDog says ... After you have set the date and time the ChronoDot RTC will retain it, even when your Raspberry Pi is turned off, because of the 3v Lithium CR1632 coin cell battery. The ChronoDot real time clock is the most accurate RTC module that we've ever come across and it's really impressed us with ease of use, cost effectiveness, and a totally cool design!

The final countdown reboot? (optional)

As final confirmation that you've done everything right you can power off your Raspberry Pi (disconnecting any Ethernet cable or wireless Internet device) and power it back on, booting into your Slackware ARM Linux system. Once again, login as 'root' and type the 'hwclock -r' or 'date' command, or both. If the result is accurate to current time then it's perfect.

When we rebooted our Raspberry Pi, and disconnected it from any Internet connection, a few minutes later we logged in as 'root' and typed the following:

The section of output above from the 'dmesg' command tells us that the i2c modules have been loaded successfully and are working, and that our ChronoDot RTC (ds3231) has been recognised and is configured correctly for use by our Slackware ARM Linux system. We also checked that the date and time was still current and accurate by typing:

The date and time were spot on! If you found the same results, WELL DONE! 100% success. Happy days once again. :-D


Thank you for reading and/or taking part in this fun little project. We hope others find it as interesting and educational as we did.

Credits: a massive thank you to Phenoptix for selling us the awesome ChronoDot RTC v2.1, Matteo Bernardini for his i2c-tools.SlackBuild script which allowed us to build the i2c-tools-3.1.0-arm-1_SBo_fd.tgz Slackware ARM package and, as always, Stuart Winter for his ceaseless efforts towards Slackware ARM. Without you all this project would not have been successful, or even possible. <3

Back to Top