CJE Micro’s click here to return to the home page.
About CJE
Products
Prices
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
LL RL
Bottom

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, and so should fit into almost any case.

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 six GPIO pins closest to the SD Card end of the Raspberry Pi, so that the RTC Module is above 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.

Raspbian 'Jessie'

If you are using an earlier version of Raspbian prior to 'Jessie' 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

dtoverlay=i2c-rtc,ds1307

Add the module to /etc/modules:

sudo nano /etc/modules

Add at the end of the file

rtc-ds1307

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
#fi

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.

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 IIC address: &9E (write), &9F (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 Power-on LED (either 3.3V or 5V) on J1 and pass-through of the IIC bus on J2. Also available 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
78 Brighton Road, Worthing, West Sussex, BN11 2EN, UK. 01903 523222 (full contact details)
If you have any comments or problems please email webmaster@cjemicros.co.uk
CJE Micro’s is not responsible for the contents of external internet sites.
Page last updated Saturday, 09-Jan-2016 16:42:11 GMT