Real time clock to Raspberry Pi not installed. Because they increase the cost of the computer. But information about the date and time desired. Raspbian operating system pulls the required data from the global network. When you turn off the system writes information about the time and date in a special file so that after reboot to read it again and use. If there is a network connection, the OS will check with the global time-servers. If there is no network, we will use the data from the file. But if you need the clock to be accurate and not dependent on a network connection, you need to purshase a separate module real time clock. There are hours on the battery-"tablet", and I chose a module with supercapacitor.

For the first time with super capacitor technology I encountered in the late eighties, when the Soviet load capacitance of 250 μf were the size of a army grenade. Brought me from Japan, Sony cassette player with AM/FM tuner. The tuner has memory for 18 radio stations. Memory was kept at full charge AA batteries and even by their complete withdrawal. But in those years, flash memory was. Therefore, the frequencies could be stored only in RAM, but it requires power. Somehow the player was disassembled for cleaning and lubrication mechanics. From the depths of the Japanese miracle of technology to me indifferently watched the super capacitor with a diameter of a penny coin, a height of about 5 mm and a proud inscription "1F, Made in Japan". Then the capacitance of the capacitor of one Farad was shocking. And now ten Faraday no surprise.

The supercapacitor compared with other sources of electricity have advantages: it instantly charged and it is not necessary to change like battery. But there is a drawback: a small current, which it can power your device.

Our module assembled on circuit Board with an area of slightly more than one square centimeter. On the one hand is the production chip DS3231 Maxim Integrated Products. Inside it, a crystal oscillator, real time clock, calendar and two alarms. There is a built-in thermometer circuit and the temperature compensation accuracy. The chip is well documented and simple as a hammer. The interface is I2C. In addition to the chip on the Board installed a couple of resistors with a capacitor. On the reverse side of the board attached GPIO connector and supercapacitor. Install the module on GPIO connector, use the power 3.3 V.

Raspberry Pi 2 Real-Time Clock Module

Raspberry Pi 2 Real-Time Clock Module

Raspberry Pi 2 Real-Time Clock Module

Raspberry Pi 2 Real-Time Clock Module

Please note that the module is placed on inner row GPIO pins.

Raspberry Pi 2 Real-Time Clock Module

Raspberry Pi 2 Real-Time Clock Module

Put the module loaded the computer and... nothing happens. What actually supposed to happen? In the list of devices (/dev/) you should see the device-rtc0. But it is not.

Looking at the I2C bus.

sudo i2cdetect -y 1 nothing shows.

sudo i2cdetect -y 0 also gives nothing.

The system clock is invisible.

Trying to read time from our hardware clock.

sudo hwclock

Nothing.

And everything was just. In the system configuration file you want to include on the bus GPIO I2C interface and tell the system that now we has a new device.

To the /boot/config.txt write the following lines:

dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
dtoverlay=i2c-rtc,ds3231

Save the config and restart OS. After reboot it will work.

Check that in /dev/ a device -rtc0, and hwclock will give message like this: root@raspberrypi:/# hwclock Mon 04 Jan 2016 23:31:34 MSK -0.546987 seconds

Author:  Dmitry Ivanov
Back to the list

Related Information: