diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 5f083a2..bb1ad1e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,37 +1,37 @@ -Added RTC (https://www.adafruit.com/product/3013) - added packages python3-smbus i2c-tools to installer - updated installer to set gpio baud to 115200 - added rtc i2c overlay /boot/firmware/config.txt - removed fake-hwclock package -NEO GPS Module - Wiring - Changed to 5v mode - U-Center-2 (https://www.u-blox.com/en/u-center-2) - Changed Baudrate UART1 to 115200 - Time Pulse Mode - Antenna Cable Delay set to the calculated 14ns -edited shit - baud - pins for pps - configure - unattended-upgrades - restic - all five installers - fuckin hwclock-config or whatever - -1.4-rc-0 - IT WORKAN WITH NEW MODULE - -1.5-rc-2 - updooted grafana vis - streamlined info level - collapsed all da scripts into time_fuckery.sh - -1.5-rc-3 - merged all da functions into time_fuckery.sh - measure offset (chrony_statistics.sh) - added Commands.md - pi image creation - -1.5-rc-4 +Added RTC (https://www.adafruit.com/product/3013) + added packages python3-smbus i2c-tools to installer + updated installer to set gpio baud to 115200 + added rtc i2c overlay /boot/firmware/config.txt + removed fake-hwclock package +NEO GPS Module + Wiring + Changed to 5v mode + U-Center-2 (https://www.u-blox.com/en/u-center-2) + Changed Baudrate UART1 to 115200 + Time Pulse Mode + Antenna Cable Delay set to the calculated 14ns +edited shit + baud + pins for pps + configure + unattended-upgrades + restic + all five installers + fuckin hwclock-config or whatever + +1.4-rc-0 + IT WORKAN WITH NEW MODULE + +1.5-rc-2 + updooted grafana vis + streamlined info level + collapsed all da scripts into time_fuckery.sh + +1.5-rc-3 + merged all da functions into time_fuckery.sh + measure offset (chrony_statistics.sh) + added Commands.md + pi image creation + +1.5-rc-4 mostly bug fixes \ No newline at end of file diff --git a/Calculations/notes-deepseek-cable-delay.md b/Calculations/notes-deepseek-cable-delay.md index f0d0de0..af62e81 100644 --- a/Calculations/notes-deepseek-cable-delay.md +++ b/Calculations/notes-deepseek-cable-delay.md @@ -1,92 +1,92 @@ -how do i calculate the time for a signal to travel down the wire of a gps antenna? -Calculating the time for a signal to travel down a GPS antenna cable involves understanding the **signal propagation speed**, which depends on the **velocity factor (VF)** of the cable. Here’s how to do it step-by-step: - -### **1. Determine the Velocity Factor (VF) of the Cable** -The velocity factor is a property of the cable and represents how fast an electrical signal travels compared to the speed of light in a vacuum (\(c = 3 \times 10^8 \, \text{m/s}\)). - -Common coaxial cables used for GPS antennas: -- **RG-58**: VF ≈ **0.66** (66% of the speed of light) -- **RG-174**: VF ≈ **0.70** -- **LMR-200**: VF ≈ **0.83** -- **LMR-400**: VF ≈ **0.85** - -Check your cable’s datasheet for the exact VF. - -### **2. Calculate Signal Propagation Speed in the Cable** -The actual speed (\(v\)) of the signal in the cable is: -\[ -v = \text{VF} \times c -\] -For example, with **RG-58 (VF = 0.66)**: -\[ -v = 0.66 \times 3 \times 10^8 \, \text{m/s} = 1.98 \times 10^8 \, \text{m/s} -\] - -### **3. Measure the Cable Length** -- Let’s say your GPS antenna cable is **3 meters** long. - -### **4. Calculate Signal Travel Time** -The time (\(t\)) for the signal to travel the length of the cable is: -\[ -t = \frac{\text{Length}}{v} = \frac{\text{Length}}{\text{VF} \times c} -\] -For **3 meters of RG-58**: -\[ -t = \frac{3 \, \text{m}}{1.98 \times 10^8 \, \text{m/s}} ≈ 15.15 \, \text{nanoseconds (ns)} -\] - -### **5. Quick Formula for Practical Use** -For a given length (\(L\)) in meters and velocity factor (VF): -\[ -t \, (\text{ns}) ≈ \frac{L \, (\text{m}) \times 3.33}{\text{VF}} -\] -**Example (3m, RG-58, VF=0.66):** -\[ -t ≈ \frac{3 \times 3.33}{0.66} ≈ 15.15 \, \text{ns} -\] - -### **Why Does This Matter for GPS?** -- **Timing Accuracy:** GPS relies on precise signal timing (errors as small as **10 ns** can cause ~3m position error). -- **Antenna Delay Calibration:** Some high-precision GPS receivers allow compensating for cable delay. - -### **Final Answer** -For a **3-meter RG-58 cable**, the signal delay is **~15.15 ns**. Adjust based on your cable’s **VF** and **length**. - -Would you like help estimating the impact on GPS positioning accuracy? - -what is the 3.33 in those formulas? -Great question! The **3.33** in the simplified formula comes from the **time (in nanoseconds) it takes light to travel 1 meter in a vacuum**. Here’s the breakdown: - -### **Derivation of the 3.33 Constant** -1. **Speed of light in a vacuum (\(c\)):** - \[ - c = 3 \times 10^8 \, \text{meters/second} - \] - -2. **Time for light to travel 1 meter (in seconds):** - \[ - t = \frac{1 \, \text{meter}}{3 \times 10^8 \, \text{m/s}} ≈ 3.33 \times 10^{-9} \, \text{seconds} = 3.33 \, \text{nanoseconds (ns)} - \] - -3. **Generalizing for any cable length (\(L\)) and velocity factor (VF):** - The delay (\(t\)) in nanoseconds is: - \[ - t \, (\text{ns}) = \frac{L \, (\text{meters}) \times 3.33 \, \text{ns/m}}{\text{VF}} - \] - - **3.33 ns/m** is the baseline delay per meter in a vacuum. - - Dividing by **VF** accounts for the slower speed in the cable. - -### **Example Recap (3m RG-58, VF = 0.66)** -\[ -t = \frac{3 \, \text{m} \times 3.33 \, \text{ns/m}}{0.66} ≈ 15.15 \, \text{ns} -\] - -### **Why Use This Shortcut?** -- Avoids recalculating \(c\) every time. -- Converts directly to **nanoseconds** (handy for RF and GPS timing). - -### **Key Notes** -- If working in **feet**, use **1.016 ns/ft** (since light travels ~1 ft in ~1.016 ns). -- For **picoseconds**, multiply by 1000 (e.g., 3.33 ns = 3330 ps). - +how do i calculate the time for a signal to travel down the wire of a gps antenna? +Calculating the time for a signal to travel down a GPS antenna cable involves understanding the **signal propagation speed**, which depends on the **velocity factor (VF)** of the cable. Here’s how to do it step-by-step: + +### **1. Determine the Velocity Factor (VF) of the Cable** +The velocity factor is a property of the cable and represents how fast an electrical signal travels compared to the speed of light in a vacuum (\(c = 3 \times 10^8 \, \text{m/s}\)). + +Common coaxial cables used for GPS antennas: +- **RG-58**: VF ≈ **0.66** (66% of the speed of light) +- **RG-174**: VF ≈ **0.70** +- **LMR-200**: VF ≈ **0.83** +- **LMR-400**: VF ≈ **0.85** + +Check your cable’s datasheet for the exact VF. + +### **2. Calculate Signal Propagation Speed in the Cable** +The actual speed (\(v\)) of the signal in the cable is: +\[ +v = \text{VF} \times c +\] +For example, with **RG-58 (VF = 0.66)**: +\[ +v = 0.66 \times 3 \times 10^8 \, \text{m/s} = 1.98 \times 10^8 \, \text{m/s} +\] + +### **3. Measure the Cable Length** +- Let’s say your GPS antenna cable is **3 meters** long. + +### **4. Calculate Signal Travel Time** +The time (\(t\)) for the signal to travel the length of the cable is: +\[ +t = \frac{\text{Length}}{v} = \frac{\text{Length}}{\text{VF} \times c} +\] +For **3 meters of RG-58**: +\[ +t = \frac{3 \, \text{m}}{1.98 \times 10^8 \, \text{m/s}} ≈ 15.15 \, \text{nanoseconds (ns)} +\] + +### **5. Quick Formula for Practical Use** +For a given length (\(L\)) in meters and velocity factor (VF): +\[ +t \, (\text{ns}) ≈ \frac{L \, (\text{m}) \times 3.33}{\text{VF}} +\] +**Example (3m, RG-58, VF=0.66):** +\[ +t ≈ \frac{3 \times 3.33}{0.66} ≈ 15.15 \, \text{ns} +\] + +### **Why Does This Matter for GPS?** +- **Timing Accuracy:** GPS relies on precise signal timing (errors as small as **10 ns** can cause ~3m position error). +- **Antenna Delay Calibration:** Some high-precision GPS receivers allow compensating for cable delay. + +### **Final Answer** +For a **3-meter RG-58 cable**, the signal delay is **~15.15 ns**. Adjust based on your cable’s **VF** and **length**. + +Would you like help estimating the impact on GPS positioning accuracy? + +what is the 3.33 in those formulas? +Great question! The **3.33** in the simplified formula comes from the **time (in nanoseconds) it takes light to travel 1 meter in a vacuum**. Here’s the breakdown: + +### **Derivation of the 3.33 Constant** +1. **Speed of light in a vacuum (\(c\)):** + \[ + c = 3 \times 10^8 \, \text{meters/second} + \] + +2. **Time for light to travel 1 meter (in seconds):** + \[ + t = \frac{1 \, \text{meter}}{3 \times 10^8 \, \text{m/s}} ≈ 3.33 \times 10^{-9} \, \text{seconds} = 3.33 \, \text{nanoseconds (ns)} + \] + +3. **Generalizing for any cable length (\(L\)) and velocity factor (VF):** + The delay (\(t\)) in nanoseconds is: + \[ + t \, (\text{ns}) = \frac{L \, (\text{meters}) \times 3.33 \, \text{ns/m}}{\text{VF}} + \] + - **3.33 ns/m** is the baseline delay per meter in a vacuum. + - Dividing by **VF** accounts for the slower speed in the cable. + +### **Example Recap (3m RG-58, VF = 0.66)** +\[ +t = \frac{3 \, \text{m} \times 3.33 \, \text{ns/m}}{0.66} ≈ 15.15 \, \text{ns} +\] + +### **Why Use This Shortcut?** +- Avoids recalculating \(c\) every time. +- Converts directly to **nanoseconds** (handy for RF and GPS timing). + +### **Key Notes** +- If working in **feet**, use **1.016 ns/ft** (since light travels ~1 ft in ~1.016 ns). +- For **picoseconds**, multiply by 1000 (e.g., 3.33 ns = 3330 ps). + This constant simplifies real-world calculations for signal delays in cables. Let me know if you'd like further clarification! \ No newline at end of file diff --git a/conf-level-debug/boot-firmware-config.txt b/conf-level-debug/boot-firmware-config.txt index 0c7f36c..db8d14a 100644 --- a/conf-level-debug/boot-firmware-config.txt +++ b/conf-level-debug/boot-firmware-config.txt @@ -1,10 +1,10 @@ - -# Precision Timekeeping Fuckery Additions -## GPS PPS GPIO Signal -dtoverlay=pps-gpio,gpiopin=18 -## GPS GPIO UART -enable_uart=1 -init_uart_baud=9600 -## I2C Hardware RTC Overlay -dtoverlay=i2c-rtc,ds3231 + +# Precision Timekeeping Fuckery Additions +## GPS PPS GPIO Signal +dtoverlay=pps-gpio,gpiopin=18 +## GPS GPIO UART +enable_uart=1 +init_uart_baud=9600 +## I2C Hardware RTC Overlay +dtoverlay=i2c-rtc,ds3231 # End Precision Timekeeping Fuckery Additions \ No newline at end of file diff --git a/conf-level-debug/hwclock-set b/conf-level-debug/hwclock-set index a30559c..9b8a007 100644 --- a/conf-level-debug/hwclock-set +++ b/conf-level-debug/hwclock-set @@ -1,2 +1,2 @@ -#!/bin/sh +#!/bin/sh # dev=$1 \ No newline at end of file diff --git a/conf-level-info/boot-firmware-config.txt b/conf-level-info/boot-firmware-config.txt index 0c7f36c..db8d14a 100644 --- a/conf-level-info/boot-firmware-config.txt +++ b/conf-level-info/boot-firmware-config.txt @@ -1,10 +1,10 @@ - -# Precision Timekeeping Fuckery Additions -## GPS PPS GPIO Signal -dtoverlay=pps-gpio,gpiopin=18 -## GPS GPIO UART -enable_uart=1 -init_uart_baud=9600 -## I2C Hardware RTC Overlay -dtoverlay=i2c-rtc,ds3231 + +# Precision Timekeeping Fuckery Additions +## GPS PPS GPIO Signal +dtoverlay=pps-gpio,gpiopin=18 +## GPS GPIO UART +enable_uart=1 +init_uart_baud=9600 +## I2C Hardware RTC Overlay +dtoverlay=i2c-rtc,ds3231 # End Precision Timekeeping Fuckery Additions \ No newline at end of file diff --git a/conf-level-info/hwclock-set b/conf-level-info/hwclock-set index a30559c..9b8a007 100644 --- a/conf-level-info/hwclock-set +++ b/conf-level-info/hwclock-set @@ -1,2 +1,2 @@ -#!/bin/sh +#!/bin/sh # dev=$1 \ No newline at end of file diff --git a/old/DOCS.md b/old/DOCS.md index f763207..701a291 100644 --- a/old/DOCS.md +++ b/old/DOCS.md @@ -1,106 +1,106 @@ -## Install -### Hardware Needed -1. Raspberry Pi of any type -2. Timing Specific GPS Module [U-BLOX ublox LEA-M8T-0-10 HUAWEI GPS Module](https://www.ebay.com/itm/134243322249) -3. High Precision RTC Module like [Adafruit DS3231 Precision RTC Breakout](https://www.adafruit.com/product/3013) -4. CR1220 Battery for RTC -5. Female to Female jumper/dupont wires -6. Raspberry Pi Case that Exposes GPIO -7. (GPS Antenna)[https://www.aliexpress.us/item/3256808971033962.html] -8. (Cable for GPS Antenna)[https://www.amazon.com/Superbat-coaxial-Bulkhead-Adapter-Equipment/dp/B07FC8PVZS?th=1] -9. (GPS Antenna Adaptor)[https://www.amazon.com/dp/B00CVR4NN0] -10. UART -11. Solder Supplies (maybe) - -### Configuring Hardware -1. Install (u-center)[https://www.u-blox.com/en/product/u-center] NOT u-center 2 -2. Wire UART of GPS Module to your UART - 1. Change baudrate to 115200 - 2. enable timing mode? - 3. change cable delay to calculated value - -### Wiring Everything Up -#### GPS Module -1. GPS GND to RPi Physical Pin 6 (GND) -2. GPS RX to RPi Physical Pin 8 (GPIO 14 / TX (UART)) -3. GPS TX to RPi Physical Pin 10 (GPIO 15 / RX (UART)) -4. GPS PPS to RPi Physical Pin 12 (GPIO 18) -5. GPS VIN to RPi Physical Pin 27 (3.3 volts) -#### RTC Module -1. RTC GND to Rpi Physical Pin 9 (GND) -3. RTC SDA to RPi Physical Pin 3 (GPIO 2 / SDA1 (I2C)) -4. RTC SCL to RPi Physical Pin 5 (GPIO 4 / SCL1 (I2C)) -5. RTC VCC to RPi Physical Pin 1 (3.3 volts) - -### Setup Pi -#### Microsd Card -1. Install [Raspberry Pi Imager](https://www.raspberrypi.com/software/) on your PC -2. Insert Microsd card to your PC -3. Run Raspberry Pi Imager - 1. Choose Device (your Raspberry Pi Type) - 2. Choose OS->Raspberry Pi OS (other)->Raspberry Pi OS Lite (64-bit) - 3. Choose Storage (your Microsd card) - 4. Configure settings as you like them - 5. Burn -#### Login to Raspberry Pi -1. `curl -s https://raw.githubusercontent.com/PrincessPi3/Precision-Timekeeping-Fuckery/refs/heads/main/installer_auto.sh?nocache=$RANDOM | $SHELL` -2. `cd ~/Precision-Timekeeping-Fuckery && git pull; bash installer1.sh` (will reboot) -3. `cd ~/Precision-Timekeeping-Fuckery && git pull; bash installer2.sh` (will reboot) -4. `cd ~/Precision-Timekeeping-Fuckery && git pull; bash installer3.sh` (will reboot) -5. `cd ~/Precision-Timekeeping-Fuckery && git pull; bash installer4.sh` (will reboot) -6. `curl -s https://gitlab.com/princesspi/general-scripts-and-system-ssssssetup/-/raw/master/customscripts/install_script.sh?nocache=$RANDOM | sudo $SHELL` -7. `exec $SHELL` -8. `configure_webhook.sh` -9. `sudo reboot` -10. Grafana - 1. open grafana web interface in a browser: `http://:3000` - 2. username `admin` password `admin` - 3. set new password - 4. Dashboards->Import - 1. Upload Garfana-Visualization.json - 5. edit each graph and just save -11. After 24 Hours - 1. `cd ~/Precision-Timekeeping-Fuckery` - 2. `bash services.sh stop` - 3. `bash nuke_logs.sh` - 4. `bash reconfig_full.sh ./running-warn-level-conf` - 5. `sudo reboot` - -## Scripts -* `uninstall.sh` uninstalls everything -* `chrony_statistics.sh` uses the python script chrony_statistics.py and feeds it copies of tracking statistics to calculate offset -*`cleanup.sh` remove old files -* `dump_configs.sh` make a backup of all configs -* `full_status.sh` show status of all of the componants of Precision-Timekeeping-Fuckery one by one -* `installer_auto.sh` script to initialize the install, it is run first - * usage: `curl -s https://raw.githubusercontent.com/PrincessPi3/Precision-Timekeeping-Fuckery/refs/heads/main/installer_auto.sh?nocache=$RANDOM | $SHELL` -* `installer1.sh` first manual installer script. runs rpi-config and optionall rpi-update -* `installer2.sh` second manual installer script. performs a dist-upgrade and an autoremove -* `installer3.sh` third manual installer script. adds grafana and telegram repos, uninstalls and disables unneeded junk, installs packages, adds pps-gpio to /etc/modules if not there, autoremove, gives users the right groups -* `installer4.sh` final manual installer script. runs `reconfig_full.sh` and enables the services on boot -* `nuke_logs.sh` does just what it says on the tin -* `reconfig_full.sh` reconfigures services in one of the directories - * usage: `bash reconfig_full.sh ` -* `services.sh` runs an operation on all of the relevant services - * usage: `bash services.sh [start|status|stop|restart|reload|enable|disable]` -* `show_running_configs.sh` shows the current config files, one by one -* `cable-delay-calc.xlsx` spreadsheet to estimate cable delay in ns - -## Files -* `status.txt` this shows the progress of an ongoing install, it is automatically created at the start and deleted at the end -* `CHANGEOG.txt` this is all the latest changes -* `version.txt` version of Precision-Timekeeping-Fuckery - -## Logs -### Chrony Logs -* `sudo tail -f /var/log/chrony/tracking.log` -* `sudo tail -f /var/log/chrony/statistics.log` -* `sudo tail -f /var/log/chrony/measurements.log` -### Telegraf Logs -* `sudo tail -f /var/log/telegraf/telegraf.log` -### Grafana Logs -* `sudo tail -f /var/log/grafana/grafana.log` -### Influxdb Logs -* `sudo tail -f /var/log/syslog` -### Root Crontab Logs +## Install +### Hardware Needed +1. Raspberry Pi of any type +2. Timing Specific GPS Module [U-BLOX ublox LEA-M8T-0-10 HUAWEI GPS Module](https://www.ebay.com/itm/134243322249) +3. High Precision RTC Module like [Adafruit DS3231 Precision RTC Breakout](https://www.adafruit.com/product/3013) +4. CR1220 Battery for RTC +5. Female to Female jumper/dupont wires +6. Raspberry Pi Case that Exposes GPIO +7. (GPS Antenna)[https://www.aliexpress.us/item/3256808971033962.html] +8. (Cable for GPS Antenna)[https://www.amazon.com/Superbat-coaxial-Bulkhead-Adapter-Equipment/dp/B07FC8PVZS?th=1] +9. (GPS Antenna Adaptor)[https://www.amazon.com/dp/B00CVR4NN0] +10. UART +11. Solder Supplies (maybe) + +### Configuring Hardware +1. Install (u-center)[https://www.u-blox.com/en/product/u-center] NOT u-center 2 +2. Wire UART of GPS Module to your UART + 1. Change baudrate to 115200 + 2. enable timing mode? + 3. change cable delay to calculated value + +### Wiring Everything Up +#### GPS Module +1. GPS GND to RPi Physical Pin 6 (GND) +2. GPS RX to RPi Physical Pin 8 (GPIO 14 / TX (UART)) +3. GPS TX to RPi Physical Pin 10 (GPIO 15 / RX (UART)) +4. GPS PPS to RPi Physical Pin 12 (GPIO 18) +5. GPS VIN to RPi Physical Pin 27 (3.3 volts) +#### RTC Module +1. RTC GND to Rpi Physical Pin 9 (GND) +3. RTC SDA to RPi Physical Pin 3 (GPIO 2 / SDA1 (I2C)) +4. RTC SCL to RPi Physical Pin 5 (GPIO 4 / SCL1 (I2C)) +5. RTC VCC to RPi Physical Pin 1 (3.3 volts) + +### Setup Pi +#### Microsd Card +1. Install [Raspberry Pi Imager](https://www.raspberrypi.com/software/) on your PC +2. Insert Microsd card to your PC +3. Run Raspberry Pi Imager + 1. Choose Device (your Raspberry Pi Type) + 2. Choose OS->Raspberry Pi OS (other)->Raspberry Pi OS Lite (64-bit) + 3. Choose Storage (your Microsd card) + 4. Configure settings as you like them + 5. Burn +#### Login to Raspberry Pi +1. `curl -s https://raw.githubusercontent.com/PrincessPi3/Precision-Timekeeping-Fuckery/refs/heads/main/installer_auto.sh?nocache=$RANDOM | $SHELL` +2. `cd ~/Precision-Timekeeping-Fuckery && git pull; bash installer1.sh` (will reboot) +3. `cd ~/Precision-Timekeeping-Fuckery && git pull; bash installer2.sh` (will reboot) +4. `cd ~/Precision-Timekeeping-Fuckery && git pull; bash installer3.sh` (will reboot) +5. `cd ~/Precision-Timekeeping-Fuckery && git pull; bash installer4.sh` (will reboot) +6. `curl -s https://gitlab.com/princesspi/general-scripts-and-system-ssssssetup/-/raw/master/customscripts/install_script.sh?nocache=$RANDOM | sudo $SHELL` +7. `exec $SHELL` +8. `configure_webhook.sh` +9. `sudo reboot` +10. Grafana + 1. open grafana web interface in a browser: `http://:3000` + 2. username `admin` password `admin` + 3. set new password + 4. Dashboards->Import + 1. Upload Garfana-Visualization.json + 5. edit each graph and just save +11. After 24 Hours + 1. `cd ~/Precision-Timekeeping-Fuckery` + 2. `bash services.sh stop` + 3. `bash nuke_logs.sh` + 4. `bash reconfig_full.sh ./running-warn-level-conf` + 5. `sudo reboot` + +## Scripts +* `uninstall.sh` uninstalls everything +* `chrony_statistics.sh` uses the python script chrony_statistics.py and feeds it copies of tracking statistics to calculate offset +*`cleanup.sh` remove old files +* `dump_configs.sh` make a backup of all configs +* `full_status.sh` show status of all of the componants of Precision-Timekeeping-Fuckery one by one +* `installer_auto.sh` script to initialize the install, it is run first + * usage: `curl -s https://raw.githubusercontent.com/PrincessPi3/Precision-Timekeeping-Fuckery/refs/heads/main/installer_auto.sh?nocache=$RANDOM | $SHELL` +* `installer1.sh` first manual installer script. runs rpi-config and optionall rpi-update +* `installer2.sh` second manual installer script. performs a dist-upgrade and an autoremove +* `installer3.sh` third manual installer script. adds grafana and telegram repos, uninstalls and disables unneeded junk, installs packages, adds pps-gpio to /etc/modules if not there, autoremove, gives users the right groups +* `installer4.sh` final manual installer script. runs `reconfig_full.sh` and enables the services on boot +* `nuke_logs.sh` does just what it says on the tin +* `reconfig_full.sh` reconfigures services in one of the directories + * usage: `bash reconfig_full.sh ` +* `services.sh` runs an operation on all of the relevant services + * usage: `bash services.sh [start|status|stop|restart|reload|enable|disable]` +* `show_running_configs.sh` shows the current config files, one by one +* `cable-delay-calc.xlsx` spreadsheet to estimate cable delay in ns + +## Files +* `status.txt` this shows the progress of an ongoing install, it is automatically created at the start and deleted at the end +* `CHANGEOG.txt` this is all the latest changes +* `version.txt` version of Precision-Timekeeping-Fuckery + +## Logs +### Chrony Logs +* `sudo tail -f /var/log/chrony/tracking.log` +* `sudo tail -f /var/log/chrony/statistics.log` +* `sudo tail -f /var/log/chrony/measurements.log` +### Telegraf Logs +* `sudo tail -f /var/log/telegraf/telegraf.log` +### Grafana Logs +* `sudo tail -f /var/log/grafana/grafana.log` +### Influxdb Logs +* `sudo tail -f /var/log/syslog` +### Root Crontab Logs * `sudo tail -f /var/log/root-crontab.log` \ No newline at end of file diff --git a/old/conf-level-warn/boot-firmware-config.txt b/old/conf-level-warn/boot-firmware-config.txt index 0c7f36c..db8d14a 100644 --- a/old/conf-level-warn/boot-firmware-config.txt +++ b/old/conf-level-warn/boot-firmware-config.txt @@ -1,10 +1,10 @@ - -# Precision Timekeeping Fuckery Additions -## GPS PPS GPIO Signal -dtoverlay=pps-gpio,gpiopin=18 -## GPS GPIO UART -enable_uart=1 -init_uart_baud=9600 -## I2C Hardware RTC Overlay -dtoverlay=i2c-rtc,ds3231 + +# Precision Timekeeping Fuckery Additions +## GPS PPS GPIO Signal +dtoverlay=pps-gpio,gpiopin=18 +## GPS GPIO UART +enable_uart=1 +init_uart_baud=9600 +## I2C Hardware RTC Overlay +dtoverlay=i2c-rtc,ds3231 # End Precision Timekeeping Fuckery Additions \ No newline at end of file diff --git a/old/conf-level-warn/hwclock-set b/old/conf-level-warn/hwclock-set index a30559c..9b8a007 100644 --- a/old/conf-level-warn/hwclock-set +++ b/old/conf-level-warn/hwclock-set @@ -1,2 +1,2 @@ -#!/bin/sh +#!/bin/sh # dev=$1 \ No newline at end of file diff --git a/old/debug-level-conf/boot-firmware-config.txt b/old/debug-level-conf/boot-firmware-config.txt index c7e991c..78e83c9 100644 --- a/old/debug-level-conf/boot-firmware-config.txt +++ b/old/debug-level-conf/boot-firmware-config.txt @@ -1,12 +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 + +# 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 \ No newline at end of file diff --git a/old/debug-level-conf/hwclock-set b/old/debug-level-conf/hwclock-set index 35028d4..6810526 100644 --- a/old/debug-level-conf/hwclock-set +++ b/old/debug-level-conf/hwclock-set @@ -1,2 +1,2 @@ -#!/bin/sh +#!/bin/sh dev=$1 \ No newline at end of file diff --git a/old/info-level-conf/boot-firmware-config.txt b/old/info-level-conf/boot-firmware-config.txt index c7e991c..78e83c9 100644 --- a/old/info-level-conf/boot-firmware-config.txt +++ b/old/info-level-conf/boot-firmware-config.txt @@ -1,12 +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 + +# 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 \ No newline at end of file diff --git a/old/info-level-conf/hwclock-set b/old/info-level-conf/hwclock-set index 35028d4..6810526 100644 --- a/old/info-level-conf/hwclock-set +++ b/old/info-level-conf/hwclock-set @@ -1,2 +1,2 @@ -#!/bin/sh +#!/bin/sh dev=$1 \ No newline at end of file diff --git a/old/notes-scratch-old.txt b/old/notes-scratch-old.txt index d82f12f..fc764c6 100644 --- a/old/notes-scratch-old.txt +++ b/old/notes-scratch-old.txt @@ -1,61 +1,61 @@ -rtc module - ds3231 - product page: https://www.adafruit.com/product/3013 - product tutorial: https://learn.adafruit.com/adafruit-ds3231-precision-rtc-breakout/overview - install packages python3-smbus i2c-tools - enable i2c support in raspi-config - interfacing options->i2c-> - enable - kernel module loaded by default - check that i2c-dev is in /etc/modules - add `dtoverlay=i2c-rtc,ds3231` to /boot/firmware/config.txt - reboot - detect/test module `sudo i2cdetect -y 1` - looking for address UU AFTER configure Overlay - looking for address 68 BEFORE configure overlay - remove package fake-hwclock - remove from rc - read rtc `sudo hwclock -r` - set rtc `sudo hwclock -w` - raspberry pi RTC tutorial: https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/set-rtc-time - pinout: https://learn.adafruit.com/adafruit-ds3231-precision-rtc-breakout/pinouts - battery: CR1220 - chipset product page: https://www.analog.com/en/products/ds3231.html - chipset datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/DS3231.pdf - chipset reliability report: https://www.analog.com/media/en/technical-documentation/reliability-data/ds3231.pdf - notes: - https://serverfault.com/questions/1093101/chrony-hosting-time-with-rtc-as-authoritative-clock-on-an-air-gapped-isolated?__cf_chl_tk=G_sZX4ClltOv3fQJpH1q2a65tx4O2s_H_FObeBQ2UyU-1749831141-1.0.1.1-W0v5fl8cCrf0tIpB0pAqIb93L5MuoWeebiHm7iLGAlo - https://stackoverflow.com/questions/49730407/how-to-do-one-shot-time-sync-using-chrony - do oneshot sync? - script set every x seconds - `sudo hwclock -r` -GPS module - baudrates - 1. 115200 // working - 2. 230400 - 3. 460800 -cable delay - cable is 10ft? RG-174? - 14.3 - -velocity factors of cable forms -RG-58: VF ≈ 0.66 (66% of the speed of light) -RG-174: VF ≈ 0.70 -LMR-200: VF ≈ 0.83 -LMR-400: VF ≈ 0.85 - -formula - CD = time in nanoseconds of cable delay - L = Length of cable in UNIT - DF = delay factor in UNIT )speed of light in a vaccum used in nanoseconds per UNIT) - 3.33 = ns (nanoseconds per meter) - 1.016 = feet (feet per meter) - VF = velocity factor of cable (above) - CD ≈ (L*DF)/VF - CD ≈ (Length (meters) * 3.33 (baseline light speed in a vaccum ns/m)) / Velocity Factor of cable (VF) - - derriving the speed of light offset - t(ns) = time in nanoseconds - c = speed of light in a vaccum in meters per second (3*(10^8) m/s) - d(m) = distance to travel in meters +rtc module + ds3231 + product page: https://www.adafruit.com/product/3013 + product tutorial: https://learn.adafruit.com/adafruit-ds3231-precision-rtc-breakout/overview + install packages python3-smbus i2c-tools + enable i2c support in raspi-config + interfacing options->i2c-> + enable + kernel module loaded by default + check that i2c-dev is in /etc/modules + add `dtoverlay=i2c-rtc,ds3231` to /boot/firmware/config.txt + reboot + detect/test module `sudo i2cdetect -y 1` + looking for address UU AFTER configure Overlay + looking for address 68 BEFORE configure overlay + remove package fake-hwclock + remove from rc + read rtc `sudo hwclock -r` + set rtc `sudo hwclock -w` + raspberry pi RTC tutorial: https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/set-rtc-time + pinout: https://learn.adafruit.com/adafruit-ds3231-precision-rtc-breakout/pinouts + battery: CR1220 + chipset product page: https://www.analog.com/en/products/ds3231.html + chipset datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/DS3231.pdf + chipset reliability report: https://www.analog.com/media/en/technical-documentation/reliability-data/ds3231.pdf + notes: + https://serverfault.com/questions/1093101/chrony-hosting-time-with-rtc-as-authoritative-clock-on-an-air-gapped-isolated?__cf_chl_tk=G_sZX4ClltOv3fQJpH1q2a65tx4O2s_H_FObeBQ2UyU-1749831141-1.0.1.1-W0v5fl8cCrf0tIpB0pAqIb93L5MuoWeebiHm7iLGAlo + https://stackoverflow.com/questions/49730407/how-to-do-one-shot-time-sync-using-chrony + do oneshot sync? + script set every x seconds + `sudo hwclock -r` +GPS module + baudrates + 1. 115200 // working + 2. 230400 + 3. 460800 +cable delay + cable is 10ft? RG-174? + 14.3 + +velocity factors of cable forms +RG-58: VF ≈ 0.66 (66% of the speed of light) +RG-174: VF ≈ 0.70 +LMR-200: VF ≈ 0.83 +LMR-400: VF ≈ 0.85 + +formula + CD = time in nanoseconds of cable delay + L = Length of cable in UNIT + DF = delay factor in UNIT )speed of light in a vaccum used in nanoseconds per UNIT) + 3.33 = ns (nanoseconds per meter) + 1.016 = feet (feet per meter) + VF = velocity factor of cable (above) + CD ≈ (L*DF)/VF + CD ≈ (Length (meters) * 3.33 (baseline light speed in a vaccum ns/m)) / Velocity Factor of cable (VF) + + derriving the speed of light offset + t(ns) = time in nanoseconds + c = speed of light in a vaccum in meters per second (3*(10^8) m/s) + d(m) = distance to travel in meters t(ns) = d(m)/c \ No newline at end of file diff --git a/old/running-warn-level-conf/boot-firmware-config.txt b/old/running-warn-level-conf/boot-firmware-config.txt index c7e991c..78e83c9 100644 --- a/old/running-warn-level-conf/boot-firmware-config.txt +++ b/old/running-warn-level-conf/boot-firmware-config.txt @@ -1,12 +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 + +# 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 \ No newline at end of file diff --git a/old/running-warn-level-conf/hwclock-set b/old/running-warn-level-conf/hwclock-set index 35028d4..6810526 100644 --- a/old/running-warn-level-conf/hwclock-set +++ b/old/running-warn-level-conf/hwclock-set @@ -1,2 +1,2 @@ -#!/bin/sh +#!/bin/sh dev=$1 \ No newline at end of file diff --git a/old/warn-level-conf/boot-firmware-config.txt b/old/warn-level-conf/boot-firmware-config.txt index c7e991c..78e83c9 100644 --- a/old/warn-level-conf/boot-firmware-config.txt +++ b/old/warn-level-conf/boot-firmware-config.txt @@ -1,12 +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 + +# 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 \ No newline at end of file diff --git a/old/warn-level-conf/hwclock-set b/old/warn-level-conf/hwclock-set index 3d3a3b1..69b6e85 100644 --- a/old/warn-level-conf/hwclock-set +++ b/old/warn-level-conf/hwclock-set @@ -1,12 +1,12 @@ -#!/bin/sh -# Reset the System Clock to UTC if the hardware clock from which it -# was copied by the kernel was in localtime. - -dev=$1 - -# if [ -e /run/systemd/system ] ; then -# exit 0 -# fi - -# /sbin/hwclock --rtc=$dev --systz +#!/bin/sh +# Reset the System Clock to UTC if the hardware clock from which it +# was copied by the kernel was in localtime. + +dev=$1 + +# if [ -e /run/systemd/system ] ; then +# exit 0 +# fi + +# /sbin/hwclock --rtc=$dev --systz # /sbin/hwclock --rtc=$dev --hctosys \ No newline at end of file