Stratum 1 GNSS NTP Server running on a Raspberry Pi 2
These are the parts I have used.
- Raspberry Pi 2
- SparkFun ublox NEO-M9N
- This Adafruit module is a good alternative
- Adafruit DS3231 RTC
- Some cheap Active GPS Antenna
- uFL to SMA Adapter Pigtail (Example)
- Pin Headers for the GNSS module (Soldering required)
- Some Male-to-Female DuPont Cables
Previously the BeagleBone Black SBC was used, check the beaglebone branch for more information.
- Install packages:
sudo apt update
sudo apt install pps-tools chrony nginx php-fpm php-gdOn trixie, build GPSd 3.27.x from the forky source package. Trixie currently ships GPSd 3.25, while forky/sid have GPSd 3.27.x.
Fetch the Debian 13/trixie archive signing key first. Forky source metadata is signed by Debian's archive key, not Raspberry Pi OS's archive key.
sudo dpkg -r gpsd-build-depssudo apt install ca-certificates wget
sudo install -d -m 0755 /usr/share/keyrings
sudo wget -O /usr/share/keyrings/debian-archive-trixie-automatic.asc https://ftp-master.debian.org/keys/archive-key-13.asc
sudo tee /etc/apt/sources.list.d/debian-forky.sources >/dev/null <<'EOF'
Types: deb-src
URIs: http://deb.debian.org/debian
Suites: forky
Components: main
Signed-By: /usr/share/keyrings/debian-archive-trixie-automatic.asc
EOF
sudo apt update
sudo apt install build-essential scons pkgconf python3 python-is-python3 python3-serial libncurses-dev libusb-1.0-0-dev libsystemd-dev libudev-dev
apt source gpsd/forky
cd gpsd-3.27.*
scons -c
scons prefix=/usr systemd=yes manbuild=no qt=no dbus_export=no
sudo scons prefix=/usr systemd=yes manbuild=no qt=no dbus_export=no install
sudo scons prefix=/usr systemd=yes manbuild=no qt=no dbus_export=no udev-install
if ! getent passwd gpsd >/dev/null; then
sudo adduser --system --no-create-home --home /run/gpsd --ingroup dialout gpsd
fi
sudo adduser gpsd dialout
gpsd -V- Edit
/boot/firmware/config.txt
-
Uncomment
dtparam=i2c_arm=on -
Add the following under
[all]:enable_uart=1 dtoverlay=i2c-rtc,ds3231 dtoverlay=pps-gpio,gpiopin=18
-
Edit
/boot/firmware/cmdline.txt, removeconsole=serial0,115200, addnohz=off. -
Reboot to apply changes.
-
Setup GPSd
-
Edit
/etc/default/gpsd. Use file in this repo as reference. -
Edit systemd service to start after chrony:
sudo systemctl edit gpsdAdd:
[Unit] Wants=chrony.service After=chrony.service -
Start GPSd:
sudo systemctl disable --now serial-getty@ttyAMA0.service sudo systemctl mask serial-getty@ttyAMA0.service sudo systemctl enable --now gpsd systemctl status gpsd -
Check using the
cgpscommand.
- 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, andchronyc sourcestats -vcommands.
- (Optional) Setup nginx + php to serve webpage:
/etc/nginx/&/var/www/html.
The following webpages are included in this repo.
Shows current time + offset, similar to time.is (Requires serverDate.js.php).
Quick page that shows the output of the following commands: chronyc sources, chronyc sourcestats, chronyc tracking.
My setup is based off the following guides.