需要接入 Raspberry Pi GPIO 匯流排 1, 3, 5, 7, 9 等接腳(整排腳座插入)即可。見下圖
必須先開啟 Raspberry Pi 上的 I2C 匯流排功能,Raspberry Pi 各個版本的作業系統可能會有所不同,請先透過網路搜尋相關啟用資訊,並確認切實已經開啟 I2C 匯流排
按照示意圖裝上 RTC 模組之後,執行下列命令
# Comment out the blacklist entry so the module can be loaded on bootsudo 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 (use -0 for Model A or -1 for Model B)
echo ds3231 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
# Test whether Linux can see our RTC module.
sudo hwclock
你應該會看到一串回應,也就是 RTC 目前儲存的日期。沒問題!
假如你的系統日期「不」正確,譬如說你沒有連上 Interent。你可以先輸入諸如下列指令直接去校正它,接著再設定 RTC 內部的數值。
# Only do ONE of two the below:sudo dpkg-reconfigure tzdata
sudo date -s "Sep 27 2014 12:46:00"
# Now that your system date is correct, simply use this command to transfer the system date to the chip:
sudo hwclock -w
接下來,想要在每次啟動時都從 RTC 讀取當下的時間,請開啟 /etc/rc.local
並在 exit 0
之前加上這兩行:
echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
hwclock -s
我們也可以停止在啟動時所啟用的 ntp
與 fake-hwclock
sudo update-rc.d ntp disable
sudo update-rc.d fake-hwclock disable
就這樣,相當容易吧?!
你依然可以透過下列指令從 Internet 校正系統時間。
sudo ntpd -gq
sudo hwclock -w
資料來源:https://www.seeedstudio.com/RTC-Module---Super-Capacitor-p-2137.html
This product is discontinued, please consider the Raspberry Pi RTC Expansion Module v1.1 as an alternative.
This is a Super Capacitor Real-Time Clock module, it design for Raspberry Pi, but it also can be used to Arduino.
Pluging it into Raspberry Pi GPIO interface, and all is ok. This is the easiest way to keep it in time.
Compared with the Mini RTC Module,it not include battery. Because it has super capacitor.
Features:
Super capacitor
Smaller
Work in 3.3V and 5V
Supported Raspberry Pi and Arduino
Compatible with Raspberry Pi A+,B,B+/2.
Specification:
DS3231 RTC IC
Self-adjust 3.3V and 5V
Size: 14x16x12 mm