Это видео недоступно.
Сожалеем об этом.
Build a Stratum 1 Time Server Using a Raspberry Pi Pico
HTML-код
- Опубликовано: 8 дек 2022
- Using a GPS module and a microcontroller board, like the Raspberry Pi Pico W, it is possible to make your own Stratum 1 time server. A Stratum 1 time server is directly linked to a reliable source of UTC time such as GPS. Sounds complex? Trust me it isn't. Let me explain!
---
My videos about time, NTP, atomic clocks etc: • Time
Let Me Explain T-shirt: teespring.com/...
Twitter: / garyexplains
Instagram: / garyexplains
#garyexplains
As an older person, seeing this sort of solution being available, not just for home use, but at such a low cost, is beyond amazing.
40 years ago time servers in computer rooms cost an absolute fortune,
I remember the first time I saw basically the same thing... It was made by NEC, it took a complete full rack, and it was nowhere near as accurate... And if the figure I was told was right, it costed $14 million... It served as the national timebase standard for the Republic of Panama and was part of a NEAX PBX. Surprising indeed.
@@BrunoRegno The problem with national telephone networks is that they are very reliant on accurate timebases. The old T1 standard for example pushed 1.5Mbits of data each second, if you are just a single bit out, you have unintelligible audio/data on the other end.
Sure, you can try to recover the timing from the stream itself, but you should still have a single source of truth for the network where possible so you as a nation don't drift too much.
This has been possible with serial interface and hand held GPS with serial bus (or by hacking to it with some wires as in this video) since late 90's. (I was working in Nokia with navigation based product back then). NMEA codes are in text format and in public domain. However GPS manufacturers tend to have proprietary non-text serial protocol, too. Both in the same serial interface and by default configured to work with NMEA protocol.
I used a MikroTik router. It has NTP server and or client program already integrated in its OS. You plug a serial gps and you can synchronize it with gps. And there are really cheap MikroTik router and you get a good router with it.
Nico, please share the model number you have used. I would like to recreate your method.
I’ve used a GitHub repo called “RPi-GPS-PPS-StratumOne”, a GNSS receiver and a Pi Zero 2 W as an NTP server.
The repo has a bash script to do all the difficult setup for you and uses PPS for more precise disciplining of the Pi’s time.
Nice to see this on a Pico, and using both cores. Please add PPS to make this accurate enough to be useful. A Stratum 1 Time Server needs to use the GPS PPS signal. The Serial data alone is not accurate enough for Stratum 1. Many low cost GPS boards have this signal in addition to the serial.
Glad you like it. The source code is in my GitHub repo, please feel free to extend it to include PPS.
Could you provide your github link please?@@GaryExplains
2:49 The free GPS antenna is the same as the better one, they are both patch type, however the one with the SMA connector has a built-in LNA.
Great video on how to. But I am a confusiast about your result at the end of this video. Why is your setup reporting it takes over 900ms ? That appears too slow. In comparison with connecting to network time from an internet NTP server. Why do this? What risk and reward is it to make a GPS NTP server to the SOHO network?
I remember being impressed at GPS NTP sources that finally came down under $2500 in the 2000's. Ha!
Very impressive video. Thank you
Glad you liked it!
This is amazing, great work!
Glad you think so!
Great timing!! Just picked up an ultimate GPS from Adafruit and have been wondering what to do with it. Surly something like this will justify the purchase
Thank you for the informative video! I wonder why you would need your own NTP time server, though? Do you see public NTP servers as a security risk, or consider them unreliable?
There are lots of situations where running your own time server is beneficial, especially on any kind of private LAN with many machines. Imagine the amount of network traffic a data center creates just trying to sync the time. But the point of this project was more about the "fun" and hobbyist spirit than anything else.
Can you build the same using a WWVB radio?
So luckily you could get your breath in order again after commenting the video, I HOPE!
Eh?
@@GaryExplains What I am trying to say it's about your speech at the end of the video which was very many words in a short time,😉
Wouldn't it have been a lot easier to just use the GPS data to set the hardware clock on a computer (any general purpose computer that can run Linux), then run the ntpd daemon as a stratum 1 time server on that computer?
With this solution you would only need to write some code to extract the current time from the GPS data and use that to set the time.
Of course there are other solutions, but that isn't the point is it.
Also, did you see this video where I put an atomic clock in my PC? ruclips.net/video/YKApDtJjXU4/видео.html
On the one hand this project is kinda cool, but on the other it's not done and especially not explained in a way to provide any benefit compared to using an ntp server on the Internet. Just because you're stratum 1 doesn't mean that you're accurate.
I was aiming more for the "cool" aspect.
Please explain!!
Most the time I am inside the house, the GPS reception is miserable there. I have to walk outside the house to know where I am. Only then a GPS receiver can tell me that I am at the back of my house and not in it. On the other hand, in the telephone signal is also the time transmitted. Maybe UMTS / GPRS can be used better instead of the GPS signal. The receiver is just as cheap as the GPS receiver. Often it can be harvested from an old phone, the Chinese even sell these receivers, desoldered from telephones whos only fault is being from last years. And maybe using an old mobile telephone receiver could also give extra information, like name of the telephone company and the exact GPS location of their mast. Recording this information could give you an alibi if you are at the same time somewhere else doing things you shouldn't. (Omnipresence is not rare or so, many have this!)
What about the NMEA message receiving time lag from the GPS receiver and further software delays? I thought you would be able to do your magic on the second, but refine the exact moment, af least to a few milliseconds, from the 1PPS (one pulse per second) signal directly from the GPS on one of the Pico's GPIO ports. The 1PPS IS the exact moment you can count on for time synchronization.
That sounds like a good idea. The code is in my GitHub repo please feel free to extend it to monitor the pps on a gpio pin.
That's true you would absolutely need PPS to get desired accuracy from this kind of configuration. But the module used in the video does not even have PPS output so a different module would have to be used.
Very cool
What is this Serial.printf() of which you speak? The compiler chokes with the message "Compilation error: 'class arduino::UART' has no member named 'printf'; did you mean 'print'?" Looking at the docs and google search seems to indicate the arduino ide can't do this. Am I missing something here?
The Raspberry Pi Pico implementation of Serial includes printf, for Arduino you will need to break it down into Print and Println.
@@GaryExplains it fails on my PicoW at this point and when rem'ed out it then fails on setRX. Did something change and these are no longer in the language?
Gary, how about a link to all the devices you purchased!
To be honest I can't even remember where I got the GPS module, they are ubiquitous. Any place that can sell you a Pico can normally sell you a GPS module.
@@GaryExplains - I wrote down all the info. I'll check that way. YES, I don't like the other-one either!
There are a bunch of Stratum-1 sources on the internet that don't rely on GPS, but instead sync directly to UTC, which is what GPS is synced to.
And?
@@GaryExplains "In fact, the whole Internet is probably synchronized, time is synchronized using the signal that comes from the GPS satellites."
Could you give me a list of NTP servers that use an atomic clock rather than GPS? I couldn't find such a list.
@@GaryExplains I'll see what I can dig up. There are also ones that use cellular signals, like CDMA.
@@pleappleappleap it's been a month, where's the list?
hey guys just trying to get this script to run in arduino IDE but my serial1 isnt a variable its a macro and i am always getting the error code Compilation error: 'class arduino::UART' has no member named 'setRX'
What board are you using?
@@GaryExplainsPi Pico W like you
Oh. I have a vague memory of something similar but I can't remember right now what it was. I am away from my desk for a few days so I don't think I can help much.
@@GaryExplainsI have time
Gary will you start uploading speed tests again?
Sadly not at the moment. It wasn't popular.
How accurate is your implementation ? how does it compare to using an an a normal ntp service on your machine ?
3 orders of magnitude worse - only gets the time to the nearest second and then has variable latency transmitting it to the network. Normal Stratum 1 NTP has sub-ms accuracy. This is produced by using an edge triggered pulse input (PPS) to lock in the exact point the time is correct.
Many GPs modules offer a PPS pulse, it shouldn't be hard to incorporate that. As for the variable latency transmitting the time via NTP, of course that is true for all NTP implementations and NTP handles it.
@@GaryExplains Ok I am interested and curious, so your mission is accomplished in that. From reading the other comments, many question do come to mind. Given a normal computer ( window / linux ) how accurate is it with normal ntp server. How accurate is can it be using this gps time with and without pps. what if I wanted to go crazy have two dedicated raspberry pi core to measure a sensor, but they are two far away from each other for wifi signal, how good could I get them in making the measurement ?
I suggest you watch my other videos on time, I think you will find answers to many of your questions. Here is the playlist: ruclips.net/p/PLxLxbi4e2mYFmsJADZJSM7-wjbUF7udsC
Is GPS time more or less accurate than the land based atomic time like the clock at the national phisical laboratory in the UK .
@@guusossevoort6855 How is GPS compared with the clock in mobile network's basestations deployed?
@@guusossevoort6855 Nice to know. I asked because I read that basestations usually employ a very accurate clock. Now I know that it is the same as the GPS clock.
You may find this video of mine interesting. I put an atomic clock in my PC! ruclips.net/video/YKApDtJjXU4/видео.html
@@GaryExplains interesting , but still gps based and a bit costly. See ruclips.net/video/S7JmCmbBKfA/видео.html
@@catchnkill Actually, I think most cellular base stations use GPSDOs (GPS Disciplined Oscillators), they’re much cheaper and more robust than rubidium oscillators and actually have better long-term stability. GPSDOs typically have a very stable ovenized crystal oscillator at their core, with a voltage input that can slightly shift the oscillator frequency. The oscillator output is divided down to a 1 pps signal, which is compared with the 1 pps output from the GPS module. If the oscillator’s output is leading the GPS signal, the oscillator’s control voltage is adjusted to slow it down, if it’s lagging, it’s sped up.
The control loop has to be carefully designed and tuned to avoid any “jiggling” of the output frequency (called phase noise), but frequency deviations of less than 1 part in 10^10 are easily achievable. (That is, an error or less than 0.01 Hz in a 10 MHz clock signal.)
Please add the source code to this project.
It is in my GitHub repo, a quick Google search normally gives my repo as the first result.
Where's a link to the code!?
The code is in my GitHub repo, just Google for "Gary Explains GitHub".
@@GaryExplains - Didn't work! At on time you put it in one of your comments and it took m their immediately. Nuts!
Try here: github.com/garyexplains/examples/tree/master/ublox_tinygps_ntp_server_pico
@@GaryExplains -Thank You! Yes, this is it! 👍👍👍 This is what I was after!