John K,
This discussion is not related to the Grape system but pertains to a VLF system that I am currently running. John was referring to me, so I apologize for the confusion. Eventually, I plan on making it a partial kit with documentation like the Grape to build up a network of VLF receivers that people can construct and install in their rural backyards. Precision timing is required for many applications in VLF, including lightning location, absolute phase measurements of VLF transmitters, multichannel correlation, correlation between VLF receivers at different locations, and VLF amateur transmission and reception of both carrier integration and the EbNaut coherent BPSK mode.
John,
The key to the timing precision is the loops that both vtcard (the application that reads from the soundcard) and vttime (the application that detects the PPS and resamples according to PPS alignment and aligns timestamps) run, both in the initial setup state and then a running state. In the setup state, vtcard determines the sample rate drift and latency and uses these as calibration parameters, but ntpd must be running to continuously steer the system clock. If there is too much drift in the system clock, vtcard cannot leave the setup state. If there is too much variation in the sound card clock due to rapid temperature variations, it falls back into a setup state from a run state to obtain calibration over again and will go into a run state once the clock is stable. Here is a sample output from vtcard's log. The "offs" is the is the variation between the soundcard's clock and system clock:
2023/07/12 15:47:26 run -5.944e-08 sr 96003.692 tadj -5.080e-09 rr 96003.7 offs -0.001mS r=0.00
2023/07/12 15:47:36 run -7.857e-06 sr 96003.654 tadj -6.715e-07 rr 96002.9 offs -0.079mS r=0.03
2023/07/12 15:47:46 run +2.364e-07 sr 96003.655 tadj +2.020e-08 rr 96003.7 offs +0.002mS r=0.00
2023/07/12 15:47:56 run +7.825e-06 sr 96003.693 tadj +6.688e-07 rr 96004.4 offs +0.078mS r=0.03
2023/07/12 15:48:06 run -7.567e-06 sr 96003.657 tadj -6.524e-07 rr 96003.0 offs -0.076mS r=0.02
2023/07/12 15:48:16 run +2.312e-06 sr 96003.668 tadj +1.976e-07 rr 96003.9 offs +0.023mS r=0.01
2023/07/12 15:48:26 run -3.040e-07 sr 96003.666 tadj -2.598e-08 rr 96003.6 offs -0.003mS r=0.00
2023/07/12 15:48:36 run +5.912e-06 sr 96003.695 tadj +5.052e-07 rr 96004.2 offs +0.059mS r=0.02
2023/07/12 15:48:46 run -1.084e-06 sr 96003.689 tadj -9.268e-08 rr 96003.6 offs -0.011mS r=0.00
2023/07/12 15:48:56 run -2.930e-06 sr 96003.675 tadj -2.504e-07 rr 96003.4 offs -0.029mS r=0.01
This offset is measured and used as calibration information. This performance can be plotted over time. Here is a plot of the sample rate variation and the offset. You can see, the trend in sample rate variation roughly follows temperature in Nathaniel's shack:
Next, the stream is fed into vttime. In the setup state, it looks for the rising edge of the PPS and takes some calibration measurements. Here is the log output:
2023/07/12 16:11:23 st2 PPSpmr 65.9 PPSmad 1.422uS in 2.965158mS out -0.002uS rate_err 0.001 inrate 96003.6801 int 96003.7718 tc 0.000
2023/07/12 16:11:24 st2 PPSpmr 62.3 PPSmad 1.435uS in 2.960555mS out -0.005uS rate_err -0.000 inrate 96003.6798 int 96003.5832 tc 0.001
2023/07/12 16:11:25 st2 PPSpmr 65.0 PPSmad 1.414uS in 2.955984mS out -0.013uS rate_err -0.001 inrate 96003.6792 int 96003.6376 tc 0.001
2023/07/12 16:11:26 st2 PPSpmr 66.1 PPSmad 1.421uS in 2.951257mS out -0.006uS rate_err 0.001 inrate 96003.6798 int 96003.8032 tc 0.001
2023/07/12 16:11:27 st2 PPSpmr 62.6 PPSmad 1.424uS in 2.946953mS out -0.003uS rate_err 0.000 inrate 96003.6800 int 96003.6564 tc 0.000
2023/07/12 16:11:28 st2 PPSpmr 65.2 PPSmad 1.408uS in 2.946224mS out -0.010uS rate_err -0.001 inrate 96003.6794 int 96003.5824 tc 0.001
2023/07/12 16:11:29 st2 PPSpmr 67.1 PPSmad 1.400uS in 2.946736mS out -0.016uS rate_err -0.000 inrate 96003.6789 int 96003.6878 tc 0.001
2023/07/12 16:11:30 st2 PPSpmr 63.5 PPSmad 1.387uS in 2.947304mS out -0.028uS rate_err -0.001 inrate 96003.6779 int 96003.6066 tc 0.003
2023/07/12 16:11:31 st2 PPSpmr 64.0 PPSmad 1.406uS in 2.947634mS out -0.024uS rate_err 0.000 inrate 96003.6783 int 96003.8145 tc 0.002
2023/07/12 16:11:32 st2 PPSpmr 66.5 PPSmad 1.398uS in 2.948002mS out -0.018uS rate_err 0.001 inrate 96003.6789 int 96003.7080 tc 0.002
In the log you see "in 2.965158mS out -0.002uS" showing both the PPS offset (in) and the sample realigned offset (out). It also continuously measures the PPS mad, or the mean absolute distribution. This shows the distribution of the PPS falling within a sample window and the variation is due to the sample rate variation. You can plot this performance against sample rate variation:
You can see the variation of sample rate roughly follows the temperature of Nathaniel's shack again but this plot indicates performance before correction. After correction, timestamp accuracy is within hundreds of ns of the PPS edge but it varies within that range due to continuous correction.
The following is a stacked spectrogram of a VLF receiver using a GPS PPS located in Forest, VA (top) and my VLF receiver in Pennsylvania showing dawn chorus emissions with timestamps aligned. Without the PPS alignment performed by vttime, it would not be aligned like it is:
Another good test is with sferics. Here is a sferic from a lighting stroke that occurred in Puerto Rico that generated a red sprite. On the top is the same VLF receiver in Forrest, VA and on the bottom is mine:

You can see both receivers detected the same sferic and the dominant difference in timing is the propagation delay between both locations. The error is the timestamping error in both mine and the receiver in Forrest, VA, but that is still within hundreds of ns.
Lastly, VLF amateurs use GPS-locked carriers and GPS-locked coherent BPSK to send either an unmodulated carrier or a message via the EbNaut mode. In VLF, due to practical antenna sizes, microwatts of power are generated at the antenna at most. For carrier detection (QSO of the transmitting carrier at the other location), the signal has to be integrated over a period of an hour or more. Without a GPS-locked carrier and timestamping precision at the receiving end, the peak of the carrier would never be detected in the integration. Here is a QSO made with my VLF receiver with a VLF amateur DL3JMM at 8270.03Hz, showing the coherent narrowband power spectrum integration:
Following this transmission, he made a sequence of transmissions with EbNaut modulation. Here is an integration of the power spectrum of one of his transmissions:
On the transmitter end, three loops are used to synchronize the carrier frequency with GPS PSS using the same Audio Injector Stereo soundcard, also with its clock free-running, but using the same continuous correction. Without this correction to maintain accuracy both on the transmitting and receiving end, my power spectrum integrations would have shown noise.
This is all made possible by the open-source
vlfrx-tools software toolkit. It contains over 30 utilities for full signal processing, from capture to analysis, including vtcard and vttime. The above are a few examples of its capability. The author wrote it in his
free time (not retired) and created everything from scratch without any external funding. He spent quite a bit of time on attaining timestamping accuracy to make everything work and spent over 20 years in the study of VLF and using off-the-shelf hardware for data acquisition. You can read about it
here, including the
soundcard and
timing sections. He is also the creator of the VLF amateur
EbNaut digital mode and wrote all the software and tools for it, including
EbSynth that uses a GPS PPS and soundcard to generate a carrier or a carrier with EbNaut modulation.
Using the author's sferic processing tools, he helped build the I
ndian Lightning Detection Network, a collaboration between many Indian universities, using the same capture and timing method with vtcard and vttime. It uses a network of VLF receivers and base stations (same Audio Injector soundcard and uBlox GPS) to generate geographical lightning stroke solutions with very good accuracy. He built the VLF receiver kit as well as the aggregation server with the database that stores the sferic's TOGA and geographical solution from multiple receivers. Students went out and installed the receivers at various locations, and the network produces stroke solutions daily. I invite you to take a look at not only the maps, but the
about and
status sections as it is quite impressive and very cool.
vlfrx-tools would be an alternative to fldigi, too, in the Grape application. Using a good I2S soundcard, a GPSDO that outputs both a reference and PPS, vlfrx-tools can capture timestamped carrier data and generate both carrier spectrograms as well as plots and numerical data of frequency and amplitude. The only thing is, scripts would need to be written to put in the metadata and perform the uploading. It does not have a waterfall display utility, but Spectrum Lab can connect to its stream and generate one. Plus, everything would have accurate timestamps as well, but it's not as critical in the Grape application.
Jonathan