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

Instructions for Raspbian 'Wheezy', early versions (not 'Jessie')

Setting up the RTC

If you have a Raspberry Pi 2 or firmware later than 29th Jan 2015, you will need to add the following line to your CONFIG.TXT file:

dtparam=i2c_arm=on

To enable support for the RTC in Raspbian 'Wheezy' (2012-10-28 or later), the following lines need to be added to /etc/rc.local above the exit0 line:


modprobe i2c-bcm2708
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
modprobe rtc-ds1307
hwclock -s

It's important to note that if you are using a Rev1 Raspberry Pi then you need to replace i2c-1 with i2c-0

Setting up the Temperature Sensor

Software for RISC OS to display the temperature from the optional Temperature Sensor can be downloaded here.

To enable support for the temperature sensor in Raspian, log in as your usual username and follow the steps below:

  1. Enable I2C in modprobe: (not necessary on Raspberry Pi 2 or with firmware later than 29th Jan 2015)
    Edit the file '/etc/modprobe.d/raspi-blacklist.conf' and comment out the two lines:
    blacklist spi-bcm2708
    blacklist i2c-bcm2708
  2. Load the i2c kernel drivers:
    sudo modprobe i2c-dev
  3. Check that the i2c devices have appeared in /dev:
    ls -l /dev/i2c*
    You should see the items '/dev/i2c-0' and/or '/dev/i2c-1' are listed.
  4. Install the i2c tool chain: (This may not necessary on Raspberry Pi 2 or with firmware later than 29th Jan 2015)
    (You will need to be connected to the internet for this step)
    sudo apt-get install i2c-tools
  5. Add your user to the i2c usergroup:
    This is so you don't need to use sudo to interact with the i2c device.
    sudo usermod -aG i2c yourusername
  6. Talking to the I2C device:
    On Mk.1 boards: i2cdetect -y 0
    On Mk 2/B+/Compute Module boards: i2cdetect -y 1
    You should see devices at 0x4F & 0x68 - these are the temperature sensor and RTC chip respectively.
  7. Read from the temp sensor:
    On Mk.1 boards: echo $(($(i2cget -y 0 0x4F)))
    On Mk.2/B+/Compute Module boards: echo $(($(i2cget -y 1 0x4F)))
    Which should return an integer, eg. 32 = 32C
In future, to read the temperature, type:
sudo modprobe i2c-dev
then proceed from step 7 above.

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 Saturday, 09-Jan-2016 16:42:11 GMT