CJE Micro’s click here to return to the home page.
About CJE
How to Order
CJE’s Resources
CJE’s Support Pages
Search CJE’s Website
How to contact CJE
CJE's Links
CJE & 4D Blog
Base image

Review your shopping basket

L Top R

Valid HTML 4.01!

Produced on RISC OS

 [ Raspberry Pi ]

 [ ------------------- ]

Raspberry Pi Real Time Clock Module

Raspberry Pi RTC

Fitting Instructions

The Real Time Clock (RTC) Module for the Raspberry Pi has been carefully designed to ensure that it fits within the footprint of the Raspberry Pi models 1-4, and so should fit into most cases.

These fitting instructions apply to all versions of the RTC Module, including those with a temperature sensor fitted. For the temperature sensor only board (ie. no RTC), please skip the section about fitting a battery.

1. Firstly, fit the CR1620 battery supplied with the RTC Module. To do this, carefully remove the battery from its packaging and slide into the battery holder on the underside of the RTC Module. Make sure that the + sign on the battery faces the + sign on the battery holder (see picture).

Putting the battery in
Fitting the RTC Module's battery

2. Plug the RTC Module into the first 12 GPIO pins closest to the SD Card end of the Raspberry Pi, so that the RTC Module is next to the small DSI connector (see picture).
Fitting the RTC
Fitting the RTC Module on the first six GPIO pins

RTC fitted
The RTC Module in place on the Raspberry Pi

3. When you first start your Raspberry Pi after fitting the RTC Module, you will need to set the system date and time in the usual way, but afterwards the RTC Module will retain the date & time when the Raspberry Pi is switched off.

Setting up the RTC

Support for the RTC in RISC OS is already built-in, and just needs configuring to 'Set manually' from the "Time and Date" settings in Configure. Alternatively, if no network time is found, it will default to the RTC time.

Instructions for Raspbian (September 2015 'Jessie' or later)

If you are using an earlier version of Raspbian prior to September 2015 then you will need to follow the instructions here instead.

If you are using Raspian Linux 3.18 or later you need to go into the Raspberry Pi config utility and enable I2C:

sudo raspi-config

Select "(9) Advanced Options" and then "A7 I2C - Enable/Disable automatic loading". A prompt will appear asking "Would you like the ARM I2C interface to be enabled?", select "Yes". After this it will ask you about adding this to the kernal also select "Yes". Exit the utility and reboot your Raspberry Pi.

Install i2c-tools using:

sudo apt-get install i2c-tools

Once you have installed I2C check that the RTC has been detected using:

sudo i2cdetect -y 0 (if using v1 Raspberry Pi) or
sudo i2cdetect -y 1 (if using v2 Raspberry Pi)

The RTC should appear on channel 68 as shown in the screen shot below. If the RTC doe not appear, check that the board is correctly fitted.

i2cdetect results

Edit config.txt to add the following: dtoverlay=i2c-rtc,ds1307

sudo nano /boot/config.txt

At the end of the file add


Add the module to /etc/modules:

sudo nano /etc/modules

Add at the end of the file


Save your changes - To Save Your edits Hold control and Press "X" Then Press "Y" and then Return or Enter

Next edit /lib/udev/hwclock-set

sudo nano /lib/udev/hwclock-set

Comment out the following lines with # Like this:

#if [ -e /run/systemd/system ] ; then
#exit 0

Reboot the Raspberry Pi.

sudo reboot

If the Raspberry Pi is connected to the internet the correct date and time should be set automatically otherwise you can set the current date and time using:

date -s "2 OCT 2015 18:00:00"

DO THIS!: You can check the current linux date with the command (date). To save the date onto the RTC Pi use the following command:

sudo hwclock -w

Verify the date has been saved onto the RTC Pi with:

sudo hwclock -r

If everything worked correctly the RTC Pi should be initialised on boot and the current date and time will be loaded into Linux.

Many thanks to ABElectronics for their notes and instructions which these instructions are based upon.

Setting up the Temperature Sensor

For RISC OS, temperature monitoring software can be downloaded here.
Instructions for Linux are coming soon, we hope!

IIC Addresses

If you wish to access the RTC and/or Temperature Sensor chips directly, their IIC address are:
RTC IIC address: &D0 (write), &D1 (read)
Temperature sensor (MCP9801 or TMP75) IIC address: &9E (write), &9F (read)
By making a solder bridge between the two pads to the left of the this chip and cutting the track between pins 5 & 6, or 6 & 7, or 7 & 8, the address can be changed to &96, &92 or &90 (write), and &97, &93, &91 (read).

Pass-Through and Additional Headers

The RTC Module has support for additional headers, should you wish to fit them, to allow connection of a 5V Power-on LED and the offical Pi4 case fan on J1 and pass-through of the I2C bus on J2. Also available on J2 are the SQW/OUT output from the RTC and Alert output from the Temperature Sensor (if fitted). Details of how to use these outputs can be found on the relevant datasheet for each chip.

For ROHS, WEEE and CE Certification information, click here.

Pass-Through and Additional Header
Pass-Through and Additional Headers

If you have a sales enquiry please email our sales department
Unit 16, Arunside Ind. Est., Fort Road, Littlehampton, BN17 7QU, UK. 01903 523222 (full contact details)
If you have any comments or problems please email sales@cjemicros.co.uk
CJE Micro’s is not responsible for the contents of external internet sites.
Page last updated Friday, 09-Apr-2021 12:15:41 BST