Skip to content

tiagofreire-pt/rpi_uputronics_stratum1_chrony

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raspberry Pi 5B NTP Server - Stratum 1 (with Uputronics GPS HAT)

A straightforward and highly optimized approach to achieve a cost-effective (€200) and high performance Stratum 1 NTP server, disciplined with highly precise PPS (Pulse Per Second) sourced from the GNSS radio service plus NTP public servers across the internet to get the absolute time reference.

Can be prepared to be used with off-the-grid applications such as IoT in remote locations/air-gapped systems or WAN connected IoT ones (as presented here).

The end result with a fully assembled Raspberry Pi 5B and an Uputronics GPS/RTC HAT Ublox M8 engine vs 6.4:

The Server Fully Assembled

This is my recipe for Raspberry Pi OS lite version Bookworm, freshly installed, with kernel 6.1.73-1+rpt1.

Index

Achievements @ January 2024:

Scope Achievement Value
Timekeeping Precision ~ 2^(-26) s
Timekeeping PPS Jitter < 400 ns
Timekeeping Frequency < 200 ppb
Service Clients > 160
Service RMS offset < 100 ns

Optimizations @ January 2024:

(non exaustive)

  • Chrony software optimization:
    • Enabled DSCP higher priority packet stamping for reduced latency and jitter over the network time distribution;
    • Enabled Hardware Timestamping over the ethernet BCM54213 PHY;
    • Enabled directive to lock chronyd into RAM;
    • Implemented temperature compensation, aiming reduced frequency value and its lower jitter.
  • Hardware optimization:
    • Low latency hardware UART for NMEA messages;
    • Forced constantly CPU clock and governor to its higher frequency for higher timekeeping resolution;
    • Disabled WiFi and Bluetooth radios aiming lower eletromagnetic interferance against the GNSS radio;
    • Reduced to the minimum coalescence values on the ethernet interface, for lower latency and jitter over the network time distribution;
    • Enabled the usage of the ethernet PHC clock, as a secondary high precision reflock;
    • Designed a custom case, with better hot airflow output and with higher thermal insulation for the oscilators on the Rpi 5B buttom face.
  • Operating system fine tuning:
    • Disabled linux kernel power saving method, aiming reduced processes scheduling latency and jitter;
    • Increased Chrony services to -10 nice value, aiming higher process schedule priority for better timekeeping;
    • Disabled unnecessary services, reducing CPU time consumption, latency and jitter;
    • Disabled SWAP partition usage for lower file system and memory latency, over the SD Card.
  • Ublox M8 chip fine tuning:
    • Enabled support for GALILEO GNSS for better UTC time reference;
    • Disabled support for SBAS (reducing PPS jitter) and GLONASS GNSS (#slavaukraini);
    • Enabled jamming/interferance monitoring for superior GNSS continuity;
    • Enabled stationary dynamic model aiming reduced NMEA and PPS latency and jitter;
    • Set the power management to full power, reducing latency and jitter;
    • Set the antenna cable lenght latency for a better PPS time sync accuracy against UTC reference time.

Sample metrics:

Chrony vs 4.5 server tracking statistics after 1 day of uptime:

Chrony tracking after 1 day of uptime

Chrony vs 4.0 client tracking statistics after 1 day of uptime:

Chrony tracking after 1 day of uptime

Chrony vs 4.0 client tracking ntpdata of this server, after 1 day of uptime:

Chrony ntpdata after 1 day of uptime

List of materials and tools needed

Mandatory:

  • 40 pin header 10mm spacer (if using the genuine active cooler)
  • SD Card with 8GB or more
  • USB SD Card reader or other similar device to install Raspberry Pi OS on the SD Card.
  • Raspberry Pi 5B, with a suitable power adaptor
  • Uputronics GPS HAT
  • RJ45 Ethernet CAT5 (or better) cable with proper lenght

Optional :

  • 3D printed case for housing the fully assembled server (RPi 5B):

    I suggest this custom made case. Rpi 5b custom case PLA or PETG are generally appropriate, depending on the ambient temperature and environment you`ll apply this server in.

  • Outdoor GPS active antenna with 28dB Gain, inline powered at 3-5V DC, with 5 meters of cable lenght and SMA male connector

Step-by-step tutorial

For this tutorial, you have 3 major steps. Being the last 2 of them optional, but highly recommended, as achieves huge and superior accuracy and precision.

  1. Setup the server
  2. Advanced Ublox M8 tuning
  3. Advanced system tuning

Acknowledgments

  1. Conor Robinson, for his cooperation and shared knowledge
  2. Anthony Stirk, for his openess to help and cooperate on a further hardware improvement (stay tuned!)

References

About

A straightforward and highly optimized approach to achieve a cost-effective Stratum 1 NTP server using a Raspberry Pi 5B and an Uputronics GPS HAT

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages