On Raspberry Pi 3 and later Rasbian OS information you must to enable the I2C hardware.
From terminal: sudo raspi-config
-select “5 interfacing option”
-select “P5 I2C”
after that it is possible to configure the RTC IC with the terminal
- Login as root
- install i2c-tools apt-get install i2c-tools
- install libi2c-dev apt-get install libi2c-dev
- edit blacklist file nano /etc/modprobe.d/raspi-blacklist.conf
- Add # before blacklist spi-bcm2708
- Add # before blacklist i2c-bcm2708
- Edit nano /etc/modules
- Add rtc-ds1307
- Edit nano /etc/rc.local
- Add echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device (Rasp Pi Revision 1) or echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device (Rasp Pi Revision 2 and B+)
- Add hwclock -s
or with a compiled program. The DS1307Z (DS3231) is a device I2C, and then we must install i2c-tools and libi2c-dev before use it.
The Real Time clock powered by a 12 mm battery CR1216 (Battery is not included), the datasheet declares a battery life of more 20 year… We can’t confirm this battery life, on our boards it is possible to mounth a small CR1216.