DIY PTP Grandmaster Clock with a Raspberry Pi
jeffgeerling.com
jeffgeerling.com
The project is on GitHub: https://github.com/geerlingguy/time-pi
The blog post has more color/story around it, but the meat of it is over on GitHub, and right now I'm working my way through testing different network switches, installing an external GPS antenna, etc.
Also, if you're a PTP nerd, you might want to check out a project from the OCP-TAP, the Switchberry, an open hardware design for a PTP boundary/transparent clock with 7 ports! [1] This was built by the same PCB designers as the TimeHAT featured in my blog post, and I'm trying to hammer out some bugs in the bringup so they can be nice, lower-cost options for networks where you don't have the budget or need for enterprise-level PTP offerings, but still want a decent DIY setup.
[1] https://github.com/Time-Appliances-Project/Incubation-Projec...
What are the bandwidth requirements of establishing clock sync around 1ms?
However, the big benefit of PTP is having your precise timing and your main network connection share a single wire - so if your server needs 10 Gbps for whatever the server does, to get the highest accuracy you'd want a PTP compatible switch with 10Gbps ports.
In the author's latest post he also sets up a pi as PTP grandmaster: https://austinsnerdythings.com/2025/02/18/nanosecond-accurat...
Top hits from the past 30 days -
* 3441 hits - https://austinsnerdythings.com/2021/04/19/microsecond-accura...
* 2415 hits - https://austinsnerdythings.com/2021/09/01/how-to-deploy-vms-...
* 1990 hits - https://austinsnerdythings.com/2021/08/30/how-to-create-a-pr...
* 1870 hits - https://austinsnerdythings.com/2025/02/14/revisiting-microse...
so with the combined original post and the revisit post, easily the top topic
Since I know Jeff frequents HN I'll go meta for a second and say that I noticed the Neatpatch cable management in the rack. I've been a fan of Neatpatch for a good long time. I don't use them in racks there there will be much churn, but they're mighty nice in locations that get wired once and only touched again when switches get replaced. It really makes a rack look-- erm-- nest.
Using the same receiver, but with a PPS wire to a GPIO pin on a raspberry pi, I get +/- 5µs jitter.
If you are interested, I have a write up with live graphs in the hamburger menu here: https://www.developerdan.com/ntp
Of course, if you only need 'good enough' accuracy, a battery-backed RTC and NTP when you're online will generally be good enough.
I love Neat Patch units just to make it so when I'm popping things in and out of my racks, I can drop a few loops of slack into the box and not have it hanging out the back. As long as you keep it relatively organized, it's a tidy, if a bit expensive, solution.
For long-term use on a lab rack, I don't like the 1U Neat Patch though. It's too short for frequent use, I often get a little slice from the rigid plastic fingers. The taller 2U units have enough space to work inside—and larger punchouts on the back, for easier cable passthrough.
https://austinsnerdythings.com/2021/04/19/microsecond-accura...
(not usb though -- uses pps)
There's so much audio and video stuff that works so much better with ptp. Even if it's vastly less good, its still gotta be some way to keep systems running on the same time, and that's a huge win. I'd love to see wifi PTP happen.
There's some really incredible research work a team did a while back, hacking their own PTP implementation stop a specific driver (adding timestamps to ath9k). https://github.com/zlab-pub/wifi-ptp
But I remember reading somewhere (maybe it was in an OCP-TAP session, which they publish every month or so) that there was a serious effort to make hardware timestamping work in WiFi 7 or 6E, maybe? Can't find the reference.
This is one of the core pieces of tech in automotive for distributed safety cases, think sensors on different time scales with sync'd local clocks allowing for timestamping for staleness/aliveness.
Also making some very nice stuff at great price points.
(In the past, I did this: https://github.com/jrockway/beaglebone-gps-clock, so I have a testbench for this sort of thing.)
Also, does anyone know if RTK helps much with timing? Every so often I connect up my clock to the NYS DOT RTK network (free!) and ... it works, but I don't know if it helps with anything.
You might be surprised by how many PCs already have PTP capable NICs. I think it's standard on Intel's network chipsets. On Linux, just look for /dev/ptp0
However, PTP support is far from standard on network switches; and it doesn't work over wifi, or with USB-to-ethernet converters. So for sure plenty of clients can't use it.
> Will I be able to notice this improvement with the right tools?
If you're a precision timing aficionado? Possibly!
Just set up two devices with ethernet and GPIO pins, one that takes in a GPS 1PPS signal and acts as a PTP server, then a second that acts as a PTP client and outputs 1PPS.
Then connect your two 1PPS signals to the two inputs of an oscilloscope, trigger on one and watch how much the other is off by.
Make sure the PTP client is downloading big files, under heavy CPU load and suchlike, so you can see the effects of those.
even "old" time signals like DCF77, WWV.... are sufficient enough for home lab. they can be heard even inside of a buildings, where GPS can have problems. And you can think about RTK signal as a signal in this more available signal category.
Most strange thing to me is that i have to set correct time in long wave radios (receiver), when they can just receive any of all those time signals.
These systems are commonly used to trunk audio between points. Using them and a strand or two of glass or a cat6 cable is most of all that is needed to distribute dozens (or hundreds, and potentially thousands) of low-latency uncompressed audio signals.
PTP is part of how latency is kept low, and audio in-phase (which is a task that, itself, requires accuracy on the order of microseconds).
See AES67/SMPTE ST 2110/IPMX.
They've also designed Switchberry, a 7-port PTP boundary/transparent managed 1 Gbps switch which is run through a Raspberry Pi CM4. I'm currently testing it (along with some other switches).
The Switchberry is open hardware, too! https://github.com/Time-Appliances-Project/Incubation-Projec...
How does VR relate to precise time? I assume we are talking about Virtual Reality and if that’s the case I don’t get the relation, or is there another VR abbreviation I’m ignorant to?
Currently most consumer VR gear is limited to a set of devices run through a single machine.