54 lines
3.1 KiB
Markdown
54 lines
3.1 KiB
Markdown
|
|
# RPi Zero 2W NTP server
|
||
|
|
|
||
|
|
It s a project where I have created a NTP Stratum 1 server with 100Mbps Ethernet port and Alide GT-U7 GPS module that gets time from satelites and works as a stratum 0 source.
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
## Chrony configuration
|
||
|
|
|
||
|
|
The file **chrony.conf** is my example from ```/etc/chrony/chrony.conf```. It has the configuration for allowing RFC1918 (all private networks) and to use GT-U7 GPS module.
|
||
|
|
|
||
|
|
## Boot configuration
|
||
|
|
|
||
|
|
After attaching everything correctly the **config.txt** file in ```/boot/firmware/config.txt``` needs to be edited to enable dtoverlay dwc2 module and UART for GT-U7, then SPI and dtoverlay w5500 module for the 100Mbps port. Lastly GPIO 18 is specified as PPS pin by loading dtoverlay pps-gpio module and specifying GPIO18 as the PPS source.
|
||
|
|
|
||
|
|
## Telegraf configuration
|
||
|
|
|
||
|
|
The **gpsdMeasurement.py** file goes to ```/etc/telegraf``` and **inputs.conf** and **outputs.conf** go to ```/etc/telegraf/telegraf.d/```.
|
||
|
|
|
||
|
|
The only file that needs to be edited is **outputs.conf** because it has the destinations to which metrics will be sent. In my case it was InfluxDBv2
|
||
|
|
|
||
|
|
## EasyEDA folder
|
||
|
|
|
||
|
|
There is a schematic to how connect the Raspberry Pi Zero 2W with W5500 and GT-U7 modules. There is also a 5V regulator but it can be ommited if a stable 5V source is provided (like USB).
|
||
|
|
|
||
|
|
## influxMeasurements file
|
||
|
|
|
||
|
|
There is a description of each metric that is collected by **gpsdMeasurement.py** script
|
||
|
|
|
||
|
|
## dashboard.json file
|
||
|
|
|
||
|
|
It has a Dashboard for Grafana that visualizes the data collected
|
||
|
|
|
||
|
|
## Price
|
||
|
|
|
||
|
|
Total price should be around 15 Euro for the GPS module, 10 Euro for the GPS antenna, 4 Euro for a SD card, around 4 Euro on Aliexpress for the W5500 module and 21 Euro for a Raspberry Pi Zero 2 W.
|
||
|
|
|
||
|
|
In total the price should come to approximately 50 Euro excluding soldering station, solder, cables, power supply (can be whatever USB-A power plug as long as it gives 5V 1A).
|
||
|
|
|
||
|
|
## Some pictures
|
||
|
|
|
||
|
|
### How the server looks
|
||
|
|
Here is a picture of my current "in production" NTP server. It is not the prettiest but it works. I do not have a 3D printer so I can not print a nice enclousre for it. I have also decided to add additional heatsinks for the WiFI chip, CPU, SD card, and the W5500 chip (it was getting pretty hot to touch).
|
||
|
|

|
||
|
|
|
||
|
|
### How the Dashboard looks
|
||
|
|
Here is how the Dashboard looks in Grafana. Note that GPS Data section repeats on both images.
|
||
|
|

|
||
|
|

|
||
|
|
|
||
|
|
### Sources and Inspirations
|
||
|
|
|
||
|
|
My initial inspiration for setting up that local NTP server was a post by [spookyghost on NetworkProfile.org](https://blog.networkprofile.org/gps-backed-local-ntp-server/). It was a basis for how and where to connect the GT-U7 module.
|
||
|
|
|
||
|
|
Second port that inspired me when it came to Grafana, telegraf and that Python measurement script was by [shrunbr on blog.shrunbr.dev](https://blog.shrunbr.dev/posts/stratum-1-ntp/). It gave me a good overview on how telegraf works and how inputs and outputs.conf is configured. The same goes for my Dashboard in Grafana. Shrunbr's dashboard was my startpoint, even though I had to remap all the values.
|