This commit is contained in:
2025-10-14 00:39:07 -06:00
parent 9c9dffdb14
commit 0a56dc6345
14 changed files with 153 additions and 19 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
* `bash ~/Precision-Timekeeping-Fuckery/full_status.sh`
**Status (Services)**
* `bash ~/Precision-Timekeeping-Fuckert/status_services.sh`
* `bash ~/Precision-Timekeeping-Fuckery/status_services.sh`
**Test PPS**
* `sudo ppstest /dev/pps0`
+9 -9
View File
@@ -2,15 +2,15 @@
**Pins are 2mm pitch**
**3.3 Volts**
| Cable | Module Pin | Module Pin Meaning | Raspberry Pi 4 Pin | Voltage | Notes |
|:-------|:-----------|:-------------------------|:---------------------------|:------------------------|:----------------------------------------------------------|
| Red | 2 - VCC | Voltage In | 1 - 3.3 Volts Out | 3.3 V | NOT 5 V TOLERANT |
| Black | 8 - GND | Ground | 25 - Ground | 3.3 V? | UNKNOWN 3 V AND 5 V TOLERANCES |
| Yellow | 4 - RST | Hardware Reset | NC? - Not Connected/GPIO? | 3.3 V | NOT 5 V TOLERANT |
| White | 6 - TP1 | Time Pulse 1/PPS | 12 - GPIO 18 | 3.3 V | NOT 5 V TOLERANT |
| Purple | 7 - TP2 | Time Pulse 2/PPS | NC? - Not Connected/GPIO? | 3.3 V | NOT 5 V TOLERANT |
| Green | 5 - RXD | UART Receive | 8 - UART Transmit | 3.3 V | NOT 5 V TOLERANT |
| Grey | 3 - TXD | UART Transmi t | 10 - UART Receive | 3.3 V | NOT 5 V TOLERANT |
| Orange | 1 - VCC_ANT | Antenna Power Supply | NC? Regulated Power Supply | 5.0 V Max 100 mA | MUST USE REGULATED POWER SUPPLY AND UNKNOWN 3 V TOLERANCE |
|:-------|:-----------|:-------------------------|:---------------------------|:-----------------|:----------------------------------------------------------|
| Red | 2 - VCC | Voltage In | 1 - 3.3 Volts Out (Split) | 3.3 V | NOT 5 V TOLERANT |
| Black | 8 - GND | Ground | 25 - Ground | 3.3 V? | UNKNOWN 3 V AND 5 V TOLERANCES |
| Yellow | 4 - RST | Hardware Reset | NC? - Not Connected/GPIO? | 3.3 V | NOT 5 V TOLERANT |
| White | 6 - TP1 | Time Pulse 1/PPS | 12 - GPIO 18 | 3.3 V | NOT 5 V TOLERANT |
| Purple | 7 - TP2 | Time Pulse 2/PPS | NC? - Not Connected/GPIO? | 3.3 V | NOT 5 V TOLERANT |
| Green | 5 - RXD | UART Receive | 8 - UART Transmit | 3.3 V | NOT 5 V TOLERANT |
| Grey | 3 - TXD | UART Transmi t | 10 - UART Receive | 3.3 V | NOT 5 V TOLERANT |
| Orange | 1 - VCC_ANT | Antenna Power Supply | NC? Regulated Power Supply | 5.0 V Max 100 mA | MUST USE REGULATED POWER SUPPLY AND UNKNOWN 3 V TOLERANCE |
### Adafruit DS3231 Precision RTC Breakout
**Pins are 2.54mm pitch**
+5
View File
@@ -0,0 +1,5 @@
SUBSYSTEM=="pps[0-9]*", GROUP="dialout", MODE="0660"
SUBSYSTEM=="tty[0-9]*", GROUP="dialout", MODE="0660"
SUBSYSTEM=="tty[A-Z]*[0-9]*", GROUP="dialout", MODE="0660"
SUBSYSTEM=="i2c[A-Z]-*[0-9]*", GROUP="dialout", MODE="0660"
SUBSYSTEM=="rtc[0-9]*", GROUP="dialout", MODE="0660"
@@ -0,0 +1,12 @@
# Precision Timekeeping Fuckery Additions
## GPS PPS GPIO Signal
dtoverlay=pps-gpio,gpiopin=18
## GPS GPIO UART
enable_uart=1
init_uart_baud=115200
## I2C Hardware RTC Overlay
dtoverlay=i2c-rtc,ds3231
# End Precision Timekeeping Fuckery Additions
+28
View File
@@ -0,0 +1,28 @@
# SHM refclock is shared memory driver, it is populated by GPSd and read by chrony
# it is SHM 0
# refid is what we want to call this source = NMEA
# offset = 0.000 means we do not yet know the delay
# precision is how precise this is. not 1e-3 = 1 millisecond, so not very precision
# poll 0 means poll every 2^0 seconds = 1 second poll interval
# filter 3 means take the average/median (forget which) of the 3 most recent readings. NMEA can be jumpy so we're averaging here
refclock SHM 0 refid NMEA offset 0.000 precision 1e-6 poll 0 filter 3
# PPS refclock is PPS specific, with /dev/pps0 being the source
# refid PPS means call it the PPS source
# lock NMEA means this PPS source will also lock to the NMEA source for time of day info
# offset = 0.0 means no offset... this should probably always remain 0
# poll 3 = poll every 2^3=8 seconds. polling more frequently isn't necessarily better
# trust means we trust this time. the NMEA will be kicked out as false ticker eventually, so we need to trust the combo
refclock PPS /dev/pps0 refid PPS lock NMEA offset 0.0 poll 3 trust
# allow local connections to ntp
allow 10.0.0.0/24
# manual
manual
# tell clients im the big dog
local stratum 1
# Good Time Servers
pool time.cloudflare.com iburst
+14
View File
@@ -0,0 +1,14 @@
# USB might be /dev/ttyACM0
# serial might be /dev/ttyS0
# pps might be /dev/pps0
DEVICES="/dev/ttyS0 /dev/pps0"
# -n means start without a client connection (i.e. at boot)
# -s 9600 is to set baud to 9600
GPSD_OPTIONS="-n -s 9600"
# also start in general
START_DAEMON="true"
# Automatically hot add/remove USB GPS devices via gpsdctl
# USBAUTO="true"
+26
View File
@@ -0,0 +1,26 @@
instance_name = "Precision Timekeeping"
[server]
# Protocol (http, https, h2, socket)
protocol = http
# The http port to use
http_port = 3000
[log]
# Either "debug", "info", "warn", "error", "critical", default is "info"
level = info
# Either "console", "file", "syslog". Default is console and file
# Use space to separate multiple modes, e.g. "console file"
mode = console file
[log.file]
# log line format, valid options are text, console and json
format = text
# This enables automated log rotate(switch of following options), default is true
log_rotate = true
# Max line number of single file, default is 1000000
max_lines = 1000000
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
dev=$1
+21
View File
@@ -0,0 +1,21 @@
# report usage statistics to influxdb company
reporting-enabled = false
[meta]
# Where the metadata/raft database is stored
dir = "/var/lib/influxdb/meta"
[data]
# The directory where the TSM storage engine stores TSM files.
dir = "/var/lib/influxdb/data"
# The directory where the TSM storage engine stores WAL files.
wal-dir = "/var/lib/influxdb/wal"
# Trace logging provides more verbose output around the tsm engine. Turning
# this on can provide more useful output for debugging tsm engine issues.
trace-logging-enabled = false
[logging]
format = "auto"
level = "info"
+4
View File
@@ -0,0 +1,4 @@
# m h dom mon dow command
# set hardware I2C RTC hourly
0 * * * * /bin/bash -c "/usr/sbin/hwclock -w 2>> /var/log/root-crontab.log"
@reboot /usr/share/customscripts/ifnet "/usr/share/customscripts/webhook bootup" 2>> /var/log/root-crontab.log
+22
View File
@@ -0,0 +1,22 @@
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 10000
metric_buffer_limit = 1000000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = "0s"
logfile = "/var/log/telegraf/telegraf.log"
# debug = true
[[inputs.chrony]]
metrics = ["tracking"]
timeout = "5s"
[[outputs.influxdb]]
urls = ["http://127.0.0.1:8086"]
database = "Chrony_Stats"
timeout = "5s"
# skip_database_creation = true
+2 -2
View File
@@ -2,10 +2,10 @@
# set -e
echo "Fully upgrading, this may take a while..."
sudo apt dist-upgrade -y 1>/dev/null 2>&1
sudo apt dist-upgrade -y 1>/dev/null
echo "Cleaning up..."
sudo apt autoremove -y 1>/dev/null 2>&1
sudo apt autoremove -y 1>/dev/null
echo "Installer2.sh complete" >> ./status.txt
+4 -4
View File
@@ -28,7 +28,7 @@ fi
# updoot
echo "Getting new software lists..."
sudo apt update 1>/dev/null 2>&1
sudo apt update
# clean up
echo "Disabling unneeded junk..."
@@ -37,11 +37,11 @@ sudo update-rc.d -f fake-hwclock remove 1>/dev/null 2>/dev/null
sudo systemctl disable fake-hwclock 1>/dev/null 2>/dev/null
echo "Purging unneeded junk..."
sudo apt purge -y "bluetooth*" "usb*" "wireless*" "pci*" "fonts*" build-essential "bluez*" "alsa*" fake-hwclock 1>/dev/null 2>&1
sudo apt purge -y "bluetooth*" "usb*" "wireless*" "pci*" "fonts*" build-essential "bluez*" "alsa*" fake-hwclock
# install da packages
echo "Installing packages, this may take a while..."
sudo apt install -y telegraf grafana influxdb pps-tools gpsd gpsd-clients chrony syslog-ng gh lynx btop htop iptraf iotop neovim netcat-traditional python3-smbus i2c-tools picocom 1>/dev/null 2>&1
sudo apt install -y telegraf grafana influxdb pps-tools git gh gpsd gpsd-clients chrony syslog-ng gh lynx btop htop iptraf-ng iotop neovim netcat-traditional python3-smbus i2c-tools picocom
# check if pps-gpio is in /etc/modules already
grep -e "pps-gpio" /etc/modules
@@ -56,7 +56,7 @@ else
fi
echo "Cleaning up..."
sudo apt autoremove -y 1>/dev/null 2>&1
sudo apt autoremove -y
if [ ! -z $SUDO_USER ]; then
username=$SUDO_USER
+3 -3
View File
@@ -10,10 +10,10 @@ else
fi
echo "Updating Software Lists"
sudo apt update 1>/dev/null 2>&1
sudo apt update
echo "Installing git and raspi-config"
sudo apt install git raspi-config -y 1>/dev/null 2>&1
echo "Installing git"
sudo apt install -y git
echo "Cloning Repo"
cd /home/$username