Real Time Clock Sync

Syncing the Real-Time Clock on sBitx

Why is the Real-Time Clock (RTC) Important?

The sBitx uses a battery-backed RTC to maintain Coordinated Universal Time (UTC) even when it’s offline. This ensures accurate logging and FT8 functionality.

The UTC maintained by sBitx operates independently from the Raspberry Pi’s system time and is only accessible and updated via the sBitx software.

Technical Tip

The sBitx checks if the system time matches UTC by running the `ntpstat` utility. If the Raspberry Pi’s time is synced, sBitx updates the RTC accordingly. Each time sBitx starts, it checks and syncs the RTC if needed, using the `rtc_sync()` function.

Setting Up Real-Time Clock Sync

To update the RTC, you need the `ntp` utility installed and running. Follow these steps:

  1. Attach a keyboard and mouse to sBitx.
  2. Keep the sBitx online (see [instructions here]).
  3. Open the Terminal with **Ctrl+Shift+T** or from the top menu.

Type the following commands in Terminal:

bash
cd sbitx
ntpstat

If `ntpstat` is working, it should show:

bash
synchronized to NTP server (164.100.255.123) at stratum 3
time correct to within 67 ms
polling server every 54 s

If not, install the required packages:

bash
sudo apt install ntp
sudo apt install ntpstat
sudo apt install ntpdate

Confirm each installation with `Y` for yes.

4. Reboot sBitx from the Terminal:

bash
sudo reboot

After reboot, open Terminal again and type `ntpstat`. It should now show synchronized network time.

Checking RTC Module Functionality

To verify that the RTC module is working:

bash
cd ~/sbitx
./sbitx

Look for messages confirming synchronization, like “synchronized to NTP server” and “Reading rtc…done!”. If you don’t see these, the RTC module may not be functioning correctly.