RTC Setup on Raspberry Pi (x300 expansion board)

First enable I2C

pi@register:~ $ sudo raspi-config

RTC_2

RTC_3

RTC_4.PNG

check that the RTC has been detected.

pi@register:~ $ sudo i2cdetect -y 1

The RTC should appear on channel 68.

RTC_1

check file /etc/modprobe.d/raspi-blacklist.conf 

remove or comment line where the I2C is black listed

#blacklist i2c-bcm2708

edit file /boot/config.txt

change dtoverlay=w1-gpio to dtoverlay=i2c-rtc,ds3231

edit /lib/udev/hwclock-set with

pi@register:~ $  sudo nano /lib/udev/hwclock-set

locate three line and  remark it with #

if [ -e /run/systemd/system ] ; then
exit 0
fi

RTC_5

RTC_6

save and exit

reboot your raspberry pi : sudo reboot

set date time : sudo date MMDDHHMMYYYY.SS (MM=Month, DD=Date, HH=Hour, MM=Minute, YYYY=Year, SS=Second example sudo date 05300957201704 = 2017 May 30 09:57:04)

write the system time to expansion board

sudo hwclock -w

read the time to verify

sudo hwclock -r

 

Advertisements

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s