RPi4 NTP Server with GPS

Building a stratum 1 NTP server using RPi4 and GPS receiver

Similar projects worth following
I had a commercial NTP server that worked for several years, but ultimately needed to be replaced. It used GPS to discipline it’s clock, but did not have firmware to recognize the latest message format and also would periodically crash.

Lots of folks have done development work to make stratum 1 servers based upon GPS more affordable and accessible, certainly good enough for NTP. The Raspberry Pi4 had been recently released, and with the additional memory and other feature improvements, it seemed like a good approach for a DIY NTP server.

This project is built on the shoulders of a lot of work by others, and is mostly an integration of a selection of key components. I wrote some scripts and adapted example code to provide a bit of user interface with an OLED display and implement active cooling management.

Resources and Details

Building NTP Server with Raspberry Pi

Updated guidance: Using Uputronics GPS with Raspberry Pi

Using Uputronics GPS with Raspberry Pi (original)

Uputronics Raspberry Pi GPS expansion Board

Uputronics GPS expansion board pinout

Adding a PWM controlled fan

Adding OLED display

Pins, which Pins?

Some amount of effort is needed to decide which pins are going to be used for the PWM fan control. The GPS expansion board has the ability to pass all pins through (using extra tall headers). But the tall headers only extend long enough to support the OLED display. The two 5V pins are captured by the display, so additional header pins were grafted onto the display header, and bent to provide low profile access to 5V and ground needed for the fan control subsystem.

Cooling Caveats

Thermal issues were raised by some after the initial release of the RPi4. Part of that related to firmware for the USB controller, even when unused; a firmware update largely mitigated that issue. The other can readily be solved by installing passive heatsinks on two key chips. My approach was to augment the passives with a PWM controlled fan. A daemon process monitors the CPU temperature and adjusts the speed of the fan to maintain a desired range. If no active cooling is needed, the fan is off.

OLED Display

I dug around for some fonts for the OLED display that made it more readable from a distance and for my less-than-young eyeballs. I set the display update process to show the current time of day, and alternate between CPU temperature and GPS satellite status (number of birds used versus current known catalog, and the average signal quality among the birds used).

Follow On Activities

I plan to implement a POE capability, to eliminate the wall-wart Pi4 power supply. I also have an externally mounted GPS antenna that will replace the little puck antenna shown in the pictures. These two steps will enable me to install this project as a replacement for my commercial NTP server.


Scripts and services for fan control and display of Sats, Temp.

x-compressed - 26.36 kB - 05/31/2020 at 23:09


  • POE Support added

    M. Foster05/31/2020 at 21:13 0 comments

    I finally got around to testing for POE support. It works fine. Only these two parts were needed to replace the wall wart/USB-C power supply:

    Uctronics PoE Splitter Gigabit 5V, IEEE 802.3AF,

    zdyCGTime 0.5FT USB 2.0 Micro Female to USB Type C Male

  • Components List and Suppliers

    M. Foster01/05/2020 at 21:25 0 comments

    Raspberry Pi 4 Model B - 2GB RAM $45.00

    Official Raspberry Pi 4 Power Supply $8.00

    Heat Sinks for Raspberry Pi 3 model B $3.99

    Heatsink for Raspberry Pi Zero $1.99


    Uputronics Raspberry Pi GPS expansion Board $39.95

    485-3527 Adafruit PiOLED monochrome OLED for RPi $14.95

    485-2223 Adafruit GPIO Stacking header for Pi Extra-long 2x20 pins $2.50

    Waterproof GPS Active Antenna, 28dB gain, 3-5VDC, SMA $14.99

    Electrronics-Salon M2.5 nylon hex M-F spacer/screw/nut kit for RPi $12.99

    Raspberry Pi 4b Fan, iUniker 30x30x7mm $7.99

        POE stuff (future)

    Uctronics PoE Splitter Gigabit 5V, IEEE 802.3AF $14.96

    zdyCGTime USB-C to Micro USB Adapter $7.99

    zdyCGTime USB 2.0 micro female to USB Type C male right angle $7.55

    misc parts (Frys, spares)

    1K resistor

    1N4001 diode

    NPN transistor (300mA, 2N2222A)

    Small sheet of plexiglas/polycarbonate left from other projects for top/bottom

    A short piece of vinyl corner bead (used with sheetrock) to mount fan

View all 2 project logs

Enjoy this project?



M. Foster wrote 10/22/2021 at 22:04 point

Hi Joe. Thanks for the kind words. NTP isn't very demanding, nor is the processing of the GPS packets, but you may find that the very modest expense between RPi4 vs RPi2 isn't really worth the savings (even if you already have the RPi2 in hand). 

There may be alternatives to the GPS board that would be less expensive (although likely less sensitive or capable). If you're trying to save cost, that's where I would focus.

  Are you sure? yes | no

Joe Ashcraft wrote 04/29/2021 at 02:28 point

Great write up! 

What the typical resource usage of this thing? I'm considering trying this out with an RPi2. 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates