RTC ds3231 offline music + alarm

Hi greeting everyone, Im having trouble to install rtc on volumio, anyone has success? Please help.

Volumio V2.917
Raspberry pi 2
RTC DS3231

Hi shadow, welcome to Volumio. :slight_smile:

It would be very useful if you could explain why you need help, what the problem is exactly, and what you have tried doing so far. The more information you give, the more likely that someone will be able to offer advice. What we can’t do ofc is mind read. :thinking:

1 Like

Hi Chsins1, The setup is for my parent usage only. No network access and I just connect with old wifi router so that volumio able to control with offline wifi. All song i have installed in 16gb local storage and able to play without any problem. The only problem I have is alarm clock because I unable to sync date-time with ntp server. My question is can I use RTC DS3231 on volumio? Thanks

Sure - normally if you can use it on Debian, you can use it Volumio :wink:

For this is particular, it’s even easier as this RTC is supported in the upstream kernel
Try enabling the overlay with:

device_tree_param=i2c1=on
dtoverlay=i2c-rtc,ds3231

EDIT:
What exactly have you tried so far that has failed?

1 Like

EDIT:
What exactly have you tried so far that has failed?
[/quote]

This is what I did,

  1. enabled “ARM I2C interface”
  2. added “dtoverlay=i2c-rtc,ds3231” in boot configuration file
  3. kernel driver successfully loaded "UU"address appeared when execute “sudo i2cdetect -y 1”
  4. remove fake hwclock package “sudo apt-get -y remove fake-hwclock”

but unable to write the correct time to RTC hardware.
volumio@volumio:~$ sudo hwclock -D -r
hwclock from util-linux 2.25.2
Using the /dev interface to the clock.
Assuming hardware clock is kept in UTC time.
Waiting for clock tick…
/dev/rtc does not have interrupt functions. Waiting in loop for time from /dev/rtc to change
…got clock tick
Time read from Hardware Clock: 2021/11/23 15:56:59 - the time is not right
volumio@volumio:~$ date
Tue Nov 23 23:57:07 +08 2021 - correct time
volumio@volumio:~$ sudo hwclock -w
volumio@volumio:~$ sudo hwclock -r
volumio@volumio:~$

Thanks

You still need to set the RTC time. This can be done either directly with

sudo hwclock --set --date="2021-18-23 16:45:05"
# or.pull in the system time
sudo hwclock -s
# Finally confirm things are good
timedatectl status
1 Like

Thanks for you response, below are the result after execute above command.

volumio@volumio:~$ date
Wed Nov 24 01:24:34 +08 2021
volumio@volumio:~$ sudo hwclock --set --date=“2021-11-24 01:25:00”
[sudo] password for volumio:
volumio@volumio:~$ sudo hwclock -s
volumio@volumio:~$ timedatectl status
Local time: Wed 2021-11-24 01:26:17 +08
Universal time: Tue 2021-11-23 17:26:17 UTC
RTC time: Tue 2021-11-23 17:26:17
Time zone: Asia/Kuala_Lumpur (+08, +0800)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
volumio@volumio:~$

EDIT: RTC it works fine in moode.

Seems to work? :slight_smile:
This is in UTC, and not in your local time zone…

1 Like

Is this because of the old chestnut of Volumio not setting a timezone? Oh, it says “RTC in local TZ: no”

1 Like

Yep, while you can force the system to use the RTC as local timezone, it’s not really recommended, especially when you have DST and other shenanigans…

For @shadow’s case I guess they could try timedatectl set-local-rtc 1 --adjust-system-clock

1 Like

when try to run directly from the RTC module "Time read from Hardware Clock is not real time even after manually set current time and unable to write in RTC and the time and date also not display when execute sudo hwclock -r

volumio@volumio:~$ sudo hwclock -D -r
hwclock from util-linux 2.25.2
Using the /dev interface to the clock.
Assuming hardware clock is kept in UTC time.
Waiting for clock tick…
/dev/rtc does not have interrupt functions. Waiting in loop for time from /dev/rtc to change
…got clock tick
Time read from Hardware Clock: 2021/11/23 18:02:01
volumio@volumio:~$ date
Wed Nov 24 02:02:17 +08 2021
volumio@volumio:~$ sudo hwclock -w
volumio@volumio:~$ sudo hwclock -r
volumio@volumio:~$

volumio@volumio:~$ timedatectl set-local-rtc 1 --adjust-system-clock
==== AUTHENTICATING FOR org.freedesktop.timedate1.set-local-rtc ===
Authentication is required to control whether the RTC stores the local or UTC time.
Authenticating as: root
Password:
==== AUTHENTICATION COMPLETE ===
volumio@volumio:~$ timedatectl status
Local time: Tue 2021-11-23 18:30:47 +08
Universal time: Tue 2021-11-23 10:30:47 UTC
RTC time: Tue 2021-11-23 18:30:47
Time zone: Asia/Kuala_Lumpur (+08, +0800)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: yes
DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone. This
mode can not be fully supported. It will create various problems with time
zone changes and daylight saving time adjustments. The RTC time is never updated,
it relies on external facilities to maintain it. If at all possible, use
RTC in UTC by calling ‘timedatectl set-local-rtc 0’.
volumio@volumio:~$

it’s worked after set-local-rtc to 1 and hwclock -r is displayed

volumio@volumio:~$ timedatectl status
Local time: Tue 2021-11-23 02:47:27 +08
Universal time: Mon 2021-11-22 18:47:27 UTC
RTC time: Tue 2021-11-23 02:47:27
Time zone: Asia/Kuala_Lumpur (+08, +0800)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: yes
DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone. This
mode can not be fully supported. It will create various problems with time
zone changes and daylight saving time adjustments. The RTC time is never updated,
it relies on external facilities to maintain it. If at all possible, use
RTC in UTC by calling ‘timedatectl set-local-rtc 0’.
volumio@volumio:~$ sudo hwclock -r
Tue Nov 23 02:44:20 2021 -0.365693 seconds

If you have already set your timezone, then I think it should be sufficient to set the RTC again in UTC, and let timedatectl do the RTC → TZ conversion.
This way you don’t have to manage DST (Does Malaysia have daylight savings? I don’t think so?)

All your alarms and other things are anyway going to hook into date and not hwclock directly, so it should be good!

1 Like

Hi Ashthespy,
You’re right Malaysia don’t have daylight saving,

Anyway I want to thank you for taking the time to help me, I’m greatly appreciated.