Most Hackaday readers will be familiar with the idea of a network time server; a magical box nestled away in some distant data center that runs the Network Time Protocol (NTP) and allows us to conveniently synchronize the clocks in our computers and gadgets. Particularly eager clock watchers can actually rig up their own NTP server for their personal use, and if you’re a true time aficionado like [Cristiano Monteiro], you might be interested in the portable GPS-controlled time server he recently put together.
The heart of the build is a NEO-6M GPS module which features a dedicated pulse per second (PPS) pin. The ESP8266 combines the timestamp from the GPS messages and the PPS signal to synchronize itself with the atomic clock aboard the orbiting satellite. To prevent the system from drifting too far out of sync when it doesn’t have a lock on the GPS signal, [Cristiano] is using a DS3231 I2C real-time clock module that features a high accuracy temperature-compensated crystal oscillator (TCXO).
These components, along with the open source code provided in the project’s GitHub repository, gives you an extremely accurate Stratum 1 NTP server that can respond to client requests over WiFi. But to take the idea a step further, [Cristiano] added an OLED and some LEDs to provide feedback, and put the whole thing inside a handsome enclosure along with a 18650 cell, TP4056 charging module, and DC-DC buck converter. The result is a fully wireless time server that can be deployed anywhere, which as an amateur radio operator, he plans to use in the field.
Whether you take yours on the road or permanently mount it, this project is an excellent way to get more acquainted with NTP and GPS reception. It’s a great time (no pun intended) to start experimenting with this technology too, as there have been some grumblings that terrestrial radio time signals may go dark in the near future.
This is my MQTT equivalent. More compact.
http://enginemonitor.blogspot.com/2020/09/gps-module.html?m=1
Cute and clever, but hardly equivalent to a stratum-1 NTP server…
So when I build this stratum-1 time source, do I add or subtract the leap second every 300 million years to offset the grossly inaccurate stratum-0 time source?
Yes.
I can see advantages of the device (lightweight, portable, probably quite cheap). On the other hand using WiFi for NTP link can give up noticeable part of precision the device aims to provide.
Hi!
You talk about round trip latency or internal WiFi processing latency? A decent NTP client should account for network latency when syncing.
Not only the latency but also its jitter. And while the jitter can be averaged over time, statistical properties of such value (e.g. standard deviation) are worse and can change over time due to radio channel occupation in the neighbourhood.
And I wouldn’t be surprised if the delay is at least slightly asymmetric, at least if communicating from WIFI to a wired device connected to access point. The roles of the access point and the mobile station are quite different in when they can or cannot transmit.
@steelman said: “I can see advantages of the device (lightweight, portable, probably quite cheap). On the other hand using WiFi for NTP link can give up noticeable part of precision the device aims to provide.”
NTP was designed from the beginning to handle symmetric latency well, and it’s a low bandwidth protocol. In my experience NTP over WiFi is no problem for light to medium loads, you’re not giving anything up versus using wired connectivity. If you are serving a high-density NTP (or anything for that matter), avoid wireless networking entirely and stick to wired or fiber. Where NTP traditionally has (or had?) problems is with asymmetric latency (more delay in one direction than the other).
I suggest you read the book on NTP by its creator Dr. David L. Mills (ret.) at the University of Delaware.[1][2] The physical book is quite expensive to buy (even used), but there are much cheaper Knndle E-Book options available.
* References:
1. Computer Network Time Synchronization: The Network Time Protocol on Earth and in Space, Second Edition, by David L. Mills, $158.99 New Hardcover
https://www.amazon.com/Computer-Network-Time-Synchronization-Protocol/dp/1439814635
Publisher: CRC Press; 2nd edition (November 15, 2010)
Language: English
Hardcover: 494 pages
ISBN-10: 1439814635
ISBN-13: 978-1439814635
Item Weight: 1.8 pounds
Dimensions: 6.1 x 1.2 x 9.1 inches
2. 1. Computer Network Time Synchronization: The Network Time Protocol on Earth and in Space, Second Edition, by David L. Mills, Kindle $47.16 Buy, $17.44 30-Day Rent
https://www.amazon.com/Computer-Network-Time-Synchronization-Protocol-ebook-dp-B008KZU4AI/dp/B008KZU4AI
Could this not be done with an app on a modern smartphone.
I don’t know exactly but there are three problems (this device shares one of them). 1) NTP server binds to UDP port 123. Smartphone OS may not allow opening ports <1024. 2) Dedicated device may provide better precission. 3) Using WiFi introduces degrades some of that precision.
Yes, a smart phone has all the required hardware to do what the article is about:
” an excellent way to get more acquainted with NTP and GPS ”
And taking the smartphone route will learn how much information you have about the device that you own.
Most likely you will base your work on the work of the people that build smartphone firmware.
Yes, there are real apps that do this, on Play Store for example.
Hi,
Android will not allow an app to change the smartphone date/time, unless you’re rooted. I don’t root all my phones since, for some of them, it’s a painful process to keep them updated later
I don’t think that’s the point. The apps have a nice display and the ability to share the time to devices without RTCs. There’s no reason to mess with the the phones internal clock which could cause bad things. Local NTP is great for internet down or lack of internet. Think Ameteur radio for instance. We use digital communication that require accurate time.
I see what you meant to say and did say in your second response. In order to serve the time. Point taken. It is very hard to achieve root on some devices.
Hi!
Android will not allow an app to sync time unless you’re rooted. I don’t root all my phones since, for some of them, keeping updated later is a nightmare.
They are suggesting that there are NTP daemons on the Google Play store (there are), not that there are NTP clients on the Play store.
There are also NTP clients in the play store too, but I imagine they do not actually change your system clock for the reasons you mention.
Sure, there’s an app for everything nowadays, but it doesn’t mean we should stop learning new things either.
There are a couple of android apps that serve time with GPS synchronization. The one without apps and with open source MIT license is Time Server App, https://timeserver.app/
Probably not. I don’t think cell phones expose the PPS (pulse per second) device
So one gotcha I ran into building a Linux box + gpsd ntp server is that the crappy USB gps I had available ended up reporting time as very precisely one second behind. Easy to offset, but do always check your work against some trustworthy ntp sources before you ship your box off to a field somewhere.
If you have a gps or radio based ntp server in the data center one of the problems you can run into is nearby noise from the racks. Typically datacenters sometimes offer a service to mount an antenna on the roof etc.
That being said this is good for home use.
Every year, I have to have somebody at my datacenters clear hornet’s nests out of my GPS antennas. Otherwise, my Symmetricon-based NTP servers become quite useless.
Props for the integration work and packaging. Well done. The main reason for accurate time for amateur radio is FT8 and other digital modes. A cheap USB GPS does the job. For owners of the IC 705, it is built in. For general logging contest groups have allowed for the piss poor PC clocks for years.
jitter is the bigger problem.
That is just a normal GPS receiver and you get the same accuracy using a public NTP server.
You’re missing the point. This is for portable ham radio use, probably going to areas without any sort of internet connectivity.
But… but… I thought that’s what the apps are for?
Never ever learn anything more, yay!
(to avoid accidents: the above was ironical)
Wow, the link here on HaD to [Cristiano Monteiro’s] page: “An IoT Maker Tale: Stratum-1 Time Server Built From Scratch” is on Linkedin, and I can see it! That’s the first Linkedin content I’ve ever seen that didn’t require me to create a Linkedin account and log in first (I’m not going todo that). Am I the only person that has this perpetual problem with Linkedin?
You need neo-9m for stratum Server and several real time adjustments, as example rpi Zero. I have Code similiar without ntp few years ago for AVR. https://github.com/schuppeste/Precise-Time-Millis