Monday, August 18, 2014

Raspberry Pi Install - SunFounder DS3231 RTC Real Time Clock

SunFounder DS3231 RTC Real Time Clock Module High Precision for Raspberry Pi Arduino R3 Mega 2560

SunFounders RTC Clock is cheap ($8.99) and easy to use, but the instructions are a little weird, especially of you are a beginner on Linux/Raspberry Pi/Arduino. Here are the steps I did to get this low cost RTC functional on my Raspberry Pi.






#De-Blacklist the RTC
sudo sed -i 's/blacklist i2c-bcm2708/#blacklist i2c-bcm2708/' /etc/modprobe.d/raspi-blacklist.conf

# Load the module now 
sudo modprobe i2c-bcm2708

# Notify Linux of the Dallas RTC device
sudo bash
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
exit

# Test whether Linux can see our RTC module. 
sudo hwclock

# Use to see if the RTC shows on the i2c bus
sudo i2cdetect -y -a

# Set the time on the RTC
sudo hwclock --systohc

# Update config to get time from RTC on boot
sudo nano /etc/rc.local
     # Add the following lines, before the "Exit"
     sudo modprobe i2c-bcm2708
     echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device          
     hwclock -s

# Check the RTC Vs Local Time (After a reboot)
sudo hwclock -r
date


No comments:

Post a Comment