Contribute Update to NTP Project’s IRIG & WWV Tone Generator

I’ve always wanted to create a WWV(H) decoder.  Sigh.  In the late 1980s, I played with switched capacitor filters (MF10 springs to mind, but that’s a relatively low order filter, maybe it was the MAX7490 or MAX7413?), and with NE565 PLLs, to try and pull the 100 Hz subcarrier out of the shortwave audio signal WWV(H), then decode it.  Unfortunately, in this application, PLLs and high order bandpass filters are basically the same thing, and I didn’t get all the way to building the decoder.

Imagine my delight when I realized that the NTP project already has built-in, a WWV(H) decoder… and as a bonus, also an IRIG-B decoder too (modulated only, no unmodulated… yet).  Well, by this time, I didn’t have a shortwave radio handy to pull in WWV with… but, what’s this?   A program called tg in the utils directory is a WWV(H) and modulated IRIG-B generator!

I had a look at it, and sure enough, it would generate WWV(H) and modulated IRIG-B signals, but it was pretty limited, didn’t do any of the IEEE-1344 extensions that we used in power utility applications, nor leap seconds etc.  That wasn’t enough for me.  Hmm, I would rewrite tg to test all these things and generate synthetic IRIG-B.  So, I did.

Oops, it was not built for a modern LINUX sound system… so I ported it.

It was good to be able to test an IRIG-B decoder – I could start at an arbitrary time, insert and remove leap seconds, trigger various conditions, etc.  So I added these functions.

I found that the computer sound card sample rate wasn’t precise.  There were precisely 8,000 samples per second, so after a while, the time emitted by tg would drift.  I modified tg to omit or add an extra cycle (in an unused area of the protocol) to correct for this.  The program would track the sent time and the “apparent” real time with respect to the computer’s real-time clock, and would correct when needed.

I re-mastered a Knoppix image to include tg2 for demonstration of my work.  I thought Elecsys might sell it (or its support) to ERLPhase for cash, but it wasn’t of enough utility to make it worthwhile.

I added unmodulated IRIG-B output, although that was trouble because most sound cards won’t pass frequencies low enough to emit unmodulated IRIG-B.  But I unwarped the filter and did something that almost works, sometimes.

I added sophistication to the WWV(H) output as well, with coded pulses lining up more closely to what the actual station does.

Then I submitted it back to Dr. David Mills for inclusion in the NTP sources… he called my program tg2.

Recently, when reviewing my work and making a few tweaks on tg2 and playing with other parts of NTP, I realized that I had violated Dr. Mills’s coding format guidelines pretty badly.  I’m surprised he put up with it!  So I tried to do better.