The Raspberry Pi as a Stratum-1 NTP Server
satsignal.euI just built one of these. It's fun to have a little computer that can synchronize highly accurate time without an internet connection by listening to things in outer space!
I built an auto-install script that anyone here is welcome to use or reference[1]. If you know what you're doing, just change the GPIO pin to your PPS input and fire away.
Unlike the author I used Chrony instead of NTP. It's lighter-weight and much easier to configure with a PPS/GPS reference clock.
The GPS chip I used was an ATGM336H, which can be had for less than $8 on ebay. I'm able to lock consistently 11 satellites from my desk[2]
Keep in mind the Pi has no hw RTC. If you're doing this for fun spend a few more bucks and buy an rtc chip from ebay so you don't drift considerably between being powered off.
1. https://github.com/stephen-mw/raspberrypi/blob/master/roles/...
2. https://www.ebay.com/sch/i.html?_from=R40&_nkw=ATGM336H&_sac...
I had one of these running with a 10 meter cable to the window so the receiver could get enough satellites. After 24/7 for about a year it just died and I haven't had time to figure out what's wrong. Lights blink but it's not reachable via ping, ssh or scp. HDMI output shows nothing. I had to move on to other projects, so I gave up and assumed I either got hacked or I hit the cheap-SD-card problem of corruption that seems to plague other users running their Pi continuously for longer periods.
I've started buying SanDisk's "High Endurance" microSD cards hoping it will mitigate any such issues in the future, but I haven't had time to get the NTP set up again... I really should have cloned the image.
I think the hardest part was finding a case with space for the GPS hat[0] with an open end for the coax connector. The hat sits a bit crooked because of something bulbous on top (condensator?).
[0]: https://store.uputronics.com/index.php?route=product/product...
I have two Pi's on remote locations. One is abused with power cuts, the other one not. The one with the power cuts is still alive, the other one had a corrupted microSD card which I just could not repair, and the system would hang (if I reinstalled it was OK again). Both Pi's have /var/log and a bunch of other locations mounted with tmpfs (so, in memory instead of on microSD) with swap off.
After the advice from a fellow HN reader [1] I bought a bunch of aMLC microSD cards from DigiKey. No S&H costs and it literally arrived 1,5 days later (from Springfield to The Netherlands) though I had to pay import tax. Needless to say, they've been rock stable. I'm using one in a Pi and one in a Dafang camera [2]. I still gotta replace the microSD cards in the remote Pi's though but I'll do it once they break (again).
For anything serious that is not a toy like an rpi, for industrial/embedded/ISP use, you need something with a storage interface that is either:
a) eMMC which can use a tiny flash module of the same type flash as found in MLC SSDs, with flash controller chip for write wear leveling
or
b) M.2 NVME SSD interface such as can be found on 170x170mm mini-itx x86-64 motherboards for intel or amd single socket CPUs. And of course on larger motherboards as well.
c) the "traditional" SATA3 disk interface which can be used for a SATA3 interface SSD.
Due to the very limited write lifespan of microSD cards, even "industrial" ones, it's just a really bad idea reliability wise to use a microSD card for boot and OS storage on any sort of remote embedded system that does anything important.
The drive writes per day (DWPD) figure in GB for even a cheap $55 consumer grade MLC SSD is vastly higher than the amount of times you can write to a microsd card.
Check out my install script linked earlier. If you already have the GPS unit attached and tested, you could probably be up and running again in a few minutes (make sure to change the GPIO pin in the script to your PPS pin).
I wonder how much the rpi foundation would need to sell a pi if it included 32gb of storage. I would gladly pay not to feel like I'm playing roulette with my microsd.
Eh, then you might have the same problems with bargain bin soldered on flash memory. Just let us boot from USB and be done with it.
They just need to make booting from a USB drive easy. Plug in a $20 SSD and stop worrying about reliability.
They're working on it: https://www.raspberrypi.org/blog/pi-3-booting-part-i-usb-mas...
It's very easy on the 3B+, see https://www.raspberrypi.org/documentation/hardware/raspberry...
It's pretty simple to do, as long as your USB drive is quick to come online.
I have an RPi running on one of those tiny USB thumb drives that only protrude a few mm and it's running a data capture suite I wrote to monitor my internet connection which writes to a PostgreSQL database on the Pi.
How much more are you prepred to pay?
This is a big jump up price-wise on the 'Pi, but it meets your "32gb of storage" requirement for $174:
https://shop.udoo.org/other/home/udoo-x86-advanced-plus.html
Pretty sure you're also paying more for x86 (as compared to ARM).
Sure. I'm not aware of any ARM based SOC boards with that 32GB of storage though (not saying there aren't any, just saying I've got 1st hand experience with that Udoo board and RPis...)
I was hopeful that NextThing would get there, their C.H.I.P board was nice (when you could actually get them to sell you any) and had 8GB on-board, but they went tits-up earlier this year. Hardware is hard...
Take a look at Resin’s Project Fin, which is designed for IoT deployments - it runs off a Pi Compute Module. https://resin.io/blog/introducing-project-fin-a-board-for-fl...
Switch to network boot with NFS as storage. Much faster (compared to most "cheap" SD cards) and more reliable.
Another possibility to improve reliability with SD cards is to use a distro that is designed to not make any writes to the storage in normal operation. I have some NTP servers running on OpenWRT and they work great.
Along a similar vein (if sticking with Raspbian, et al distros is important), you can e.g. disable swap and journaling, using ramdisk for logs, etc. as well as keeping lots of free space available for wear-leveling and a few other ideas: https://raspberrypi.stackexchange.com/questions/169/how-can-...
Maybe add [2012] to the title, dear mods?
Off topic: I love this couples website. If you click through to the homepage they've got lots of stuff to browse.
Yes, it maybe old-style, but it's these sort of sites that the internet was originally built on. It's a real shame that they are becoming a dying breed.
> Configuring Wi-Fi
That alone will negate any benefit of running a stratum 1. You lose the precision and accuracy over wifi. Jitter on intranet with the pi as a timesource would be magnitudes greater than the GPS link.
Not exactly. Sometimes it's more helpful to have a local time source that you know is accurate but has a little jitter than to have a remote time source with intermittent Internet.
RPi's ethernet-over-USB is no better: it aggregates packets to compensate for limited bandwitdh, incurring killer jitter.
this is pretty cool. i was looking at your case, could you tell me the exact model case you were using? i couldn't find the exact model on modmypi.
also, here's a writeup i did on my experiences creating something with an rpi 3 model b+:
https://github.com/stephenhu/written/blob/master/raspberrypi...
What is the use case for microsecond-accurate timekeeping?
I've done it; and my primary argument to family and friends is time attack vectors.
The real reason though, is because I can, and I like saying my computers are more accurate and precise than their phones.
it's mostly about synchronization between systems
I built a nixie tube clock like that with a gps receiver, it works amazingly
They still haven't separated the USB/Ethernet Bus :/
This is also possible with the Orange Pi/NanoPi boards which have actual Ethernet that doesn't go over USB, though I don't think there's such a good writeup of how to do that.
This would be a perfect case for a NanoPi Neo. [1] It's designed to be ultra-tiny and run headless. It's also $13. I find FriendlyElec's board better designed and supported than Orange by a bit and miles above the Banana folks.
1: https://www.friendlyarm.com/index.php?route=product/product&...
Are there performance differences regarding Pi 1/2/3?
Yes, very much so.
Do you have some numbers?
The biggest factor is that each generation of the Pi has gotten a better processor (700Mhz single-core in the original Pi to a 1.4Ghz quad-core in the 3B+). There are also a number of detailed benchmarks out there if you bother to Google it.
Especially in the context of a stratum 1?