[time-nuts] WWVB data to play with

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Dec 5 21:36:50 UTC 2018


--------
In message <2ce7bd8e-ab0c-0f0f-568a-dac7088faa7d at febo.com>, John Ackermann N8UR
 writes:

>While everyone's been talking :-) , I recorded some WWVB IQ data for 
>folks to play with.  You can download it from
>http://febo.com/pages/wwvb/
>
>The receiver ran at 48 ksps and was centered on 80 kHz (to allow a 20 
>kHz IF to move away from 0 Hz crud).  The data was taken in early 
>afternoon in Dayton, Ohio.  WWVB was easily visible in an FFT.

Here is a bit of python3 code to show how simple this is
and to get people started:

	import struct 
	from math import sin, cos, atan2, hypot

	PI = 3.14159265

	# Sample rate
	SR = 48.00009351e3

	# Target frequency = (80) -20kHz
	TF = -20e3

	fi = open(
	    "n8ur_rx_center=0.08MHz_rate=48ksps_start=2018.12.05.13.57.54.bin",
	    "rb")

	fi.read(512)

	fo1 = open("out.txt", "w")

	n = 1
	r = 0
	o = 0.0
	do = 2. * PI * (TF / SR)
	ali = 0.0
	alq = 0.0
	while True:
	    a = fi.read(8)
	    if not a:
		break
	    i,q = struct.unpack("ff", a)
	    ss = sin(o)
	    cc = cos(o)
	    o += do
	    li = ss * i - cc * q
	    lq = ss * q + cc * i
	    ali += (li - ali) / n
	    alq += (lq - alq) / n
	    if n < 12000:
		n += 1
	    r += 1
	    if r % 480 == 0:
		fo1.write("%e %e %e\n" %
                          (r / SR, hypot(ali, alq), atan2(ali,alq)))

The output file ("out.txt") has three columns:

	time in seconds

	amplitude 

	phase

The "r % 480" gives an output line every 10 msec

The "if n < 12000" is the averaging factor of an exponential average.
A proper low-pass filter will give much sharper amplitude.

Johns sample-rate appears to be almost 1000PPM fast and
drifting, it it is trivial to adjust the "do" to keep either
the ali or alq haunting zero.

Enjoy...

Poul-Henning


-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.




More information about the Time-nuts_lists.febo.com mailing list