HCL:Raspberry Pi3 RTC
One of the main issues with the Raspberry Pi is the lack of a Real-Time-Clock (RTC) that gives the system the correct time directly after a reboot. Usually the system needs network access to get the correct time via NTP, but without access to an NTP server, during a network outage or stand-alone setup, the system will start with a pre-defined date and time after each reboot.
Mounting the Module
The module gets mounted to the GPIO socket pins 1,3,5,7,9 as shown in the picture below.
Device Tree (DT) overlay
The RTC module needs to be activated with a Device Tree (DT) overlay. The configuration for this is located at
After a reboot you will see the module with the
[ 4.526184] rtc-ds1307 1-0068: rtc core: registered ds3231 as rtc0
The time on the RTC module can be checked with the
#> hwclock --show 2019-01-30 17:29:41.818087+0100
To write the system time that the system got over NTP to the RTC module run
#> hwclock --systohc
To load the time from the RTC via a systemd service, create the file
/usr/lib/systemd/system/hwclock-start.service with the following content.
[Unit] Description=read rtc and write to system clock After=sysinit.target [Service] Type=oneshot ExecStart=/sbin/hwclock --hctosys --utc [Install] WantedBy=basic.target
Enable the service and restart the system.
#> systemctl status hwclock-start