Raspberry Pi computers have no internal clock. Keep time correct by using a rtc-ds3231 module

Moderator: BarryK

Post Reply
FeodorF
Posts: 161
Joined: Tue Jul 14, 2020 7:52 pm
Has thanked: 8 times
Been thanked: 24 times

Raspberry Pi computers have no internal clock. Keep time correct by using a rtc-ds3231 module

Post by FeodorF »

Forum member @Grey posted about the use of a rtc-ds3231.
viewtopic.php?p=27337#p27337
https://www.banggood.com/High-Precision ... mds=search
I ordered two of them for 10€ plus postage.

The 'How-To' list is very short using EasyOS for the Raspberry pi.
Add this to the raspberry pi config.txt file:

# Adds support for a number of i2c real time clock devices
dtoverlay=i2c-rtc,ds3231

Use the console to read the rtc hardware time:
/sbin/hwclock -r

Use the console to make the rtc time your system time:
/sbin/hwclock -s --localtime (This is help full while running on 'Daylight Saving Time'/DST)

This small executable script at /root/Startup named piRTC will copy the rtc time to your system.

#!/bin/sh
/sbin/hwclock -s
--localtime

/sbin/hwclock --help (This will show you a list of all available tools.)

I'm using this rtc while my pi is off line.

Have Fun!

pi4-rtc-2.jpg
pi4-rtc-2.jpg (110.98 KiB) Viewed 549 times

Rem: I have added '--localtime' as well as /sbin for it's location.

Last edited by FeodorF on Mon Apr 18, 2022 9:03 pm, edited 5 times in total.
Misaligned
Posts: 78
Joined: Sun Oct 24, 2021 2:14 pm
Has thanked: 2 times
Been thanked: 3 times

Re: Raspberry Pi computers have no internal clock. Keep time correct by using a rtc-ds3231 module

Post by Misaligned »

Thanks for posting this.

FeodorF
Posts: 161
Joined: Tue Jul 14, 2020 7:52 pm
Has thanked: 8 times
Been thanked: 24 times

Re: Raspberry Pi computers have no internal clock. Keep time correct by using a rtc-ds3231 module

Post by FeodorF »

I have ordered one more RTC-ds3231 module to add it onto my Raspberry Pi 400.
I'll report back on that as soon as it arrives.

Post Reply

Return to “EasyOS”