• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeRaspberry PiShield for RPiHow to Add RTC to Raspberry Pi
Previous Next

How to Add RTC to Raspberry Pi

Posted by: admin , April 30, 2014

Designed to be used in Raspbian and It is a highly accurate real-time clock which connects via the GPIO port on a Raspberry Pi. It uses the GND, SDA and SCL pins.

x100_3
It utilises the highly accurate NXP PCF2127AT / PCF2129AT chip and features:

  •     Very accurate timekeeping (typically ±3ppm or <2 minutes deviation per year)
  •     Integrated crystal that compensates for temperature and age
  •     The supplied battery will keep the time for a very long time if the device isn’t used and considerably longer if it is
  •     512 bytes of static RAM protected by the backup battery
  •     Coin Battery Included!

 

Set-up with LXTerminal

1. Download the latest version operation system of  Raspbian “wheezy” and install.
http://www.raspberrypi.org/downloads

2. Make sure we’ve got the latest firmware drivers.
sudo apt-get update

3. Download the RTC driver
wget http://www.suptronics.com/downloads/rtc-3.6.11.tar.gz

4. Extract the RTC driver
tar xzvf rtc-3.6.11.tar.gz

5. Install the RTC driver
sudo dpkg -i rtc-3.6.11.deb

6. Copy the RTC module’s boot file to the Raspberry Pi boot directory.
sudo cp /boot/vmlinuz-3.6.11-atsw-rtc+ /boot/kernel.img

7. Open the ‘modules’ file in the nano text editor
sudo nano /etc/modules

8. Add the following text
i2c-bcm2708
rtc-pcf2127a

9. Press ‘CTRL + X’ to exit, Type  ‘Y’ to save those changes, Press ‘Enter’ to return 

10. Open ‘rc.local’  for editing
sudo nano /etc/rc.local

11. Register the RTC module and set the system clock from the RTC.
echo pcf2127a 0x51 > /sys/class/i2c-adapter/i2c-1/new_device
( sleep 2; hwclock -s ) &

12. Press ‘CTRL + X’ to exit, Type  ‘Y’ to save those changes, Press ‘Enter’ to return.

13. Reboot
sudo reboot

14. Set the system time.
sudo date MMDDHHMMYYYY.SS (MM= Month, DD= Date, HH= Hour, MM= Minute, YYYY= Year, SS= Second )
Example  2013 Jan 4 , 11:39:00 , sudo date 010411392013.00

15. Copy the system time into the clock module
sudo hwclock -w

16. To read the time from the clock module
sudo hwclock -r

17. To copy the time from the clock module to the system
sudo hwclock -s

Tags: Shield for RPi

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors