Skip to content

sarabveer/rpi-time-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Raspberry Pi Time Server

Stratum 1 GNSS NTP Server running on a Raspberry Pi 2

Equipment

These are the parts I have used.

Previously the BeagleBone Black SBC was used, check the beaglebone branch for more information.

Setup

  1. Install packages:
sudo apt update
sudo apt install pps-tools gpsd chrony nginx php-fpm php-gd
  1. Edit /boot/firmware/config.txt
  • Uncomment dtparam=i2c_arm=on

  • Add the following under [all]:

    # Overclock
    arm_freq=1000
    core_freq=500
    sdram_freq=500
    over_voltage=2
    # Serial, RTC, PPS
    enable_uart=1
    dtoverlay=i2c-rtc,ds3231
    dtoverlay=pps-gpio,gpiopin=18
    nohz=off
  1. Edit /boot/firmware/cmdline.txt, remove console=serial0,115200

  2. Reboot to apply changes.

  3. Setup GPSd

  • Edit /etc/default/gpsd. Use file in this repo as reference.

  • Edit systemd service to start after chrony: sudo systemctl edit gpsd

    Add:

    [Unit]
    After=chrony.service
    
  • Start GPSd:

    sudo systemctl disable --now [email protected]
    sudo systemctl mask [email protected]
    sudo systemctl enable --now gpsd
    systemctl status gpsd
  • Check using gpsmon and cgps commands.

  1. Setup Chrony
  • Edit Chrony config files. Use file in this repo as reference.

  • Start Chrony:

    sudo systemctl enable chrony
    sudo systemctl restart chrony gpsd
    systemctl status chrony
  • Check using chronyc tracking, chronyc sources -v, and chronyc sourcestats -v commands.

  1. (Optional) Setup nginx + php to serve webpage: /etc/nginx/ & /var/www/html.

Webpage

The following webpages are included in this repo.

index.html

Shows current time + offset, similar to time.is (Requires serverDate.js.php).

chrony.php

Quick page that shows the output of the following commands: chronyc sources, chronyc sourcestats, chronyc tracking.

References

My setup is based off the following guides.

About

Stratum 1 GNSS NTP Server running on a Raspberry Pi

Topics

Resources

Stars

Watchers

Forks