Hacker News new | past | comments | ask | show | jobs | submit login
μWWVB: A Tiny WWVB Station (anishathalye.com)
250 points by anishathalye on Dec 26, 2016 | hide | past | favorite | 49 comments

Hi HN! I wanted to share the story of µWWVB, a watch stand that I built that automatically sets the time on my atomic wristwatch.

Because I can't receive the regular atomic watch radio signal where I live, I built a device that determines the current time by using GPS and then emulates the WWVB protocol to set my atomic watch.

In the process of building this, I learned a lot about time, clocks, radio, and WWVB, and so I thought I'd share what I had learned.

Very nice work! Can you receive WWVB via a larger, resonant loop antenna; say a 10 cm diameter solenoid and resonating capacitor? If so, you may be able to place the watch at the center of the resonator (i.e. within the solenoid) so it parasitically couples.

The antenna gain will be proportional to area, so much more gain than that of a watch antenna.

Oh, that's a neat idea! Yeah, I think I should be able to receive WWVB in my dorm room via a larger antenna. I should try it when I'm back in my dorm room after the winter break.

Maybe build one with a short piece of large diameter PVC pipe as the coil form. Use a signal generator at 60 kHz to drive a smaller, transmit probe coil. Then another receive probe coil hooked to an oscilloscope. Use this loose magnetic coupling technique to tune the large coil for resonance. You'll of course want to shoot for as high of Q as possible, but that's an engineering trade off of AC wire resistance, capacitor Q, etc. Go for as large of inductance as feasible, until your self resonance is just above 60 kHz, then pull it to down on frequency with a silver mica cap, or adjustable air variable cap.

Hi. Thanks for the article! Perhaps I missed it, but I'm wondering why you had to deal with daylight savings at all. Isn't all the time data involved here either UTC or GPS?

WWVB includes information about daylight savings time in the information it broadcasts.

Ah, I see. Thank you!

Fantastic post! I learned a whole lot by reading this.

You also have access to some very nice milling and 3d printing equipment. That is one beautifully designed and soldered PCB.

electronic equipment too. i was salivating at that agilent mixed-signal oscilloscope, that's like a $3500 piece of kit. meanwhile i'm over here with my puny rigol ds1052e

Yeah, I'm lucky to have access to some really nice equipment at the Cypress Engineering Design Studio makerspace at MIT!

This is cool!

Have you given any thought towards building a home GPS powered NTP server? That would be a cool variant on your project.

The way that the author uses GPS to get time (NMEA messages) works well for the purposes of the article, eg syncing a wristwatch to ~1 second accuracy. As another poster pointed out though, these messages are only accurate to about a half-step one, and it is actually worse than just using an internet NTP signal.

If you want to build a GPS based NTP server, you need a GPS board that outputs a PPS signal. When I built mine I used an adafruit board hooked up to a raspberry Pi's GPIO pins.

It's something of a bear to get everything to play together properly and get the extremely precise PPS signal to the NTP server, I recall it required a custom kernel module and a lot of tinkering with tick rates.

I watched (and guided, some), my son do this in his summer between high school and college.


Great stuff! I should add, "10s of nanoseconds" took a while to digest. Can I suggest "tens" instead?

Good point, I hadn't noticed that. Fixed!

While currently I have no use for this, I definitely appreciate the research and effort that went in to solve a localized problem, and sharing the results. Epitomizes hacker culture to me. Thanks for sharing :)

The WWVB protocol has been interesting me for the past few months. I have been thinking about doing the opposite: building my own WWVB receiving station.

There are modules which can automatically receive the WWVB radio signal and output the high/low pulses (which still need to be translated from PWM to ones and zeros).



If I were to make a recommendation: you're hiding a bit of magic here:

> I designed the board using the EAGLE PCB design software and milled the board from a single-sided FR-1 circuit board blank on an Othermill v2:

You haven't said the kinds of endmills you're using (flat square mills? Or did you use a V-tip?). If so, where did you source the V-Tips from? The software side probably had a few extra steps as well (IIRC, its usually Eagle -> Eagle CAM Plugin export -> CAM software -> GCode -> Mill)

So expanding on what you did here would be most helpful... to me at least :-)

> It’s challenging to design good antennas for such long wavelengths

FYI: the loopstick / Small Loop antenna operates on the magnetic-portion of the wave instead of the electric-portion of the wave. Instead of making a very large wire (which "receives" the voltage as the wave passes), the small loop antenna is basically an inductor that generates a current as the magnetic wave passes over it.

That's how it gets so small, since the electric wave is 5000-meters long, its a bit difficult to make.

Ah yes, I didn't go into details on the milling process. I used a 1/64" flat end mill for the traces and a 1/32" flat end mill to cut out the board from the stock.

Also, the software workflow was really easy - Otherplan (Othermill's CAM software) can directly import Eagle's .brd files and drive the Othermill.

> Also, the software workflow was really easy - Otherplan (Othermill's CAM software) can directly import Eagle's .brd files and drive the Othermill.

Hmm, good to know. The only CNC Mill I have access to however is the Nomad 883. So I guess for my purposes, I'd have to do something else. But that's a nifty feature of "Othermill" for sure.

> I used a 1/64" flat end mill for the traces

I'm glad to know this is feasible for some of these larger surface-mount parts (like an ATTiny44A).

> There are modules which can automatically receive the WWVB radio signal and output the high/low pulses ...

Yep, and you can feed this into ntpd also!

That's the computer hacker solution. The RF hacker solution would be to build something that receives WWVB and retransmits its own signal on the same frequency without interfering with itself. The wavelength is long enough that you could pull this off. This has the advantage that you're not degrading the accuracy of the time signal.

It's not that accurate anyway; WWVB doesn't compensate for its propagation delay like GPS time does.

WWVB's worst case propagation delay is ~20 ms. This project's error can be up to 500 ms. For a wrist watch or wall clock, the former is imperceptible and the latter is not.

Yeah, the conclusion I reached after making a GPS-based NTP server is that having my clock accurate to a few nanoseconds didn't really matter for anything.

My watch is a minute behind my computer right now. Doesn't matter.

Could someone provide quick background on WWVB, or at least say if the Wikipedia page is accurate? I clicked the link to the NIST page,[0] which helped a little but was written for someone already familiar with it - it's both too detailed and leaves fundamental questions unanswered; for example:

* Is WWVB the norm for consumer clocks that synchronize to an outside source? If I see a clock with that feature, should I assume it uses WWVB? Is it one of several options?

* Why not use GPS? Because of poor signal indoors?

* How far does this signal from Colorado propagate?

[0] https://www.nist.gov/pml/time-and-frequency-division/radio-s...

This doesn't answer your questions (others already have), but if this interests you, you might also find WWVB's "sister" stations interesting: WWV (at the same site) and WWVH (in Hawaii). Those transmit a voice signal (but no carrier/time code) on 2.5, 5, 10, 15, and 20 MHz. If you have an SDR that will tune that low (or a shortwave receiver), you should be able to receive at least one of them on at least frequency at any given time of the day.

See also "The Current Readability of the WWVB Time Code": http://tf.nist.gov/tf-cgi/wwvbmonitor_e.cgi

As a teenager with the newly issued amateur radio call sign N9WWV, I used to set my wristwatch to WWV as I would constantly get asked, "What time is it?" anytime someone heard my call sign.

It sounds like this: https://en.wikipedia.org/wiki/File:WWV_time_signal_-_2009090... (.ogg, via Wikipedia).

When I started reading the article, I assumed the author would be using the PPS signal from the GPS for synchronization. You can do this w/ cheap GPS receivers and a small embedded computer (i.e. Raspberry Pi, BeagleBone Black, etc.) and synchronize your computer to it for extremely accurate time.

I can pretty much always receive WWV in New York on one frequency. Problem with WWV is that the propagation delay depends on how many hops the signal takes (it's skywave, unlike WWVB at night which is groundwave).

GPS time is much better, because you know exactly how far away you are from each satellite, so can subtract out the transit time reliably. WWV varies from day to day (and frequency to frequency).

EDIT: apparently a couple other people have already answered your questions, but I didn't see the other answers because I was typing my response. I'll leave my answer here cause it contains some information not in the other responses.

The Wikipedia page seems to be pretty accurate. To answer your questions:

> Is WWVB the norm for consumer clocks that synchronize to an outside source? If I see a clock with that feature, should I assume it uses WWVB? Is it one of several options?

In the United States, yes. Clocks labeled "atomic clock" or "radio clock" are set up to sync with WWVB. Nowadays, many clocks are multi-band, which means that they are designed so that they can receive from multiple radio stations (there are a bunch of these; see https://en.wikipedia.org/wiki/Radio_clock#List_of_radio_time...). Usually, the clock decides which station to try to sync to based on which time zone they are in (which is part of the configuration). For example, my wristwatch, a Casio AWGM100B, can receive from DCF77 (Germany, 77.5 kHz), MSF (UK, 60 kHz), WWVB (United States, 60 kHz), JJY (Japan, 40 kHz / 60 kHz), and BPC (China, 68.5 kHz).

> Why not use GPS? Because of poor signal indoors?

I think the main reason is that GPS is a lot more complicated, so it requires more sophisticated hardware and software (and more power) to get time via GPS. There are some higher-end watches that do use GPS - for example, the Casio GPW1000-1A.

> How far does this signal from Colorado propagate?

Depends on weather conditions and time of day. NIST has coverage maps that show where you can get > 100µV/m for different times of the day: http://tf.nist.gov/stations/wwvbcoverage.htm

> DCF77 (Germany, 77.5 kHz)

Actually DCF77 can be received all over Europe :) I believe reception is even possible in Russia and along the northern African coast.

I don't think OP ever claimed it couldn't be, just that that's where the signal propagates from.

There was a radio controlled clock in the Computer Lab at Cambridge, but it seems the actual clock mechanism ran fast (gain a couple of minutes over the course of a day). More often than not, if I happened to be walking past at around 1600, the clock would be mid-way through a fast twelve-hour cycle to get back to the right time.

Thank you (and thanks to everyone else who responded) for such a detailed response. I'm not sure how I got this far without knowing about WWVB, but it's now my favorite radio station.

1. In the US, yes. In other parts of the world, you'll see clocks that instead use a closer station (like DCF77 in Germany).

2. Indoor operation is part of it. Also, GPS receivers are more expensive and power hungry.

3. Depends on time of day, but it generally covers most of North America. There's coverage maps here: http://tf.nist.gov/stations/wwvbcoverage.htm

> Is WWVB the norm for consumer clocks that synchronize to an outside source? If I see a clock with that feature, should I assume it uses WWVB? Is it one of several options?

Yes. WWVB is the NIST Atomic clock radio station. In fact, any cheap clock that auto-synchronizes is going to be WWVB. Its the cheapest option for mass electronics that I'm aware of.

WWVB however has one major fault: and its the speed of light. The speed of light can make the signal off by a few dozen miliseconds as it travels across the country. So extreme accuracy is not really possible. But for anything that can take a few miliseconds of delay (ie: most consumer clocks), this isn't a problem.

> Why not use GPS? Because of poor signal indoors?

GPS is far more expensive. A WWVB receiver is only $5 for an antenna, $3 for amplifying components, and $1 for a very low-end microcontroller. The 60-bits to determine a timestamp are sent at 1Hz (yes, one-bit per second). And indeed, the 1Hz signal is sent exactly on the second, on every second. As the signal is so low-baud, it is trivial to find a microcontroller that is fast enough to process it.

As a very very low frequency, the WWVB signal penetrates through most walls. It also reflects off the ionosphere, giving a very long-distance range... far longer than the horizon.

The WWVB signal is also the atomic time standard of the USA. The radio station is owned by NIST and the signal is basically the current American definition of time.

> How far does this signal from Colorado propagate?

At night, when there's the least amount of interference from the sun, the signal propagates all the way to the Pacific Ocean and Atlantic Ocean, covering the entirety of the continental USA, and a good chunk of Canada as well.

To answer your points

1. WWWVB is the norm. When they say 'Atomic Clock' they are using WWVB to synchronise time.

2. Putting GPS on a consumer electronic would be WAY more expensive.

3. WWVB covers Continental US and Southern Canada. https://en.wikipedia.org/wiki/WWVB#Propagation

Part of the linked page describing the WWVB transmission station which I enjoyed:

"A computer is used to automatically tune the antennas during icy and/or windy conditions. This automatic tuning provides a dynamic match between the transmitter and the antenna system. The computer looks for a phase difference between voltage and current at the transmitter. If one is detected, an error signal is sent to a 3-phase motor in the helix house that rotates the rotor inside the variometer. This retunes the antenna and restores the match between the antenna and transmitter."

Cool technology :)

Could you attack WWVB receivers by overriding the transmitted signal and change their time?

edit: Not something I'd want to do obviously, just seems like a rather insecure technology.

I believe you can if your signal is strong enough relative to the real one, which can be pretty weak in certain areas (hence the need for this device).

My high school's math and science club tried to do this once to the school's clocks as a prank. We never got the transmission circuitry working, but I did write a program for my graphing calculator that computed and outputed the correct signal sequence for a given timestamp through its 2.5mm jack.

Edit to add: As I recall, our particular clocks synced at midnight or if you hit the reset button. I think that was to increase the chances of a good signal.

What calculator was that? That sounds like a lot of fun!

Mine was a TI-84, although an 83 would have worked too. I wrote it in native assembly, since TI-BASIC doesn'the give you enough control. You can do clever things with that jack, like play music if you've got a 2.5-to-3.5mm adapter.

And yeah, it was a blast!

How did you get programs to and from the calculator? Did you type it all out by hand on the calculator?

I developed programs on my computer and transferred them. There's some fantastic communities out there with all the resources and help you'll ever need [1]. I got my start working through this guide [2].

[1] https://www.omnimaga.org

[2] http://tutorials.eeems.ca/ASMin28Days/welcome.html

There's a USB adapter and software that lets you transfer files/scripts to and from the calculator. You can also record data over that port as well.

Very nice, I was originally thinking "Gee with NMEA signals they won't be able to do better than 1/2 second accuracy." and then realized its a wristwatch, you don't generally care about milliseconds and the watch can lose or gain a half second in a day anyway! So in fact it is engineered quite well for the requirement.

I also liked the antenna solution. Very nice piece of work.

Great work! And I applaud the concise and thorough explanation of the legality regarding the unlicensed transmissions!

That's a cool project.

Something I'd find irresistible is messing with the protocol to find the limits of your watch receiver. I mean sure the spec is 500 ms pulse for a one and 200 ms for a zero, and we can safely assume anything from 499 to 501 ms is close enough, but I wonder how far those limits can be pushed. Is the crossover from understanding 1/0 the arithmetic mean or geometric mean or some arbitrary limits or does the firmware crash or go into easter egg mode or ...

Another fun game to play is the AT44A is much weaker than the 8-bit home computers from the 80s that could synthesize live audio in real time up to a couple KHz. A somewhat more advanced chip in the 2010s could numerically synthesize live 60 KHz signals, which might be fun instead of altering hardware PWM. Then you could play with amplitude and keying signals. Its well trodden ground that square wave modulation of a morse code signal is extremely wide bandwidth. A fancy raised cosine would be very smooth. Perhaps you'd get better SNR at the receiver with less keyclicks, so you could reduce power, or it would be more reliable per watt transmitted. Or it might not matter. But live realtime synthesis would none the less be entertaining alternative to modifying PWM registers on the fly. A cleaner yet simple modulation method might be let the PWM fly free and use a digital pot with a I2C interface to smoothly AM modulate the output, probably only cost one chip and might provide some performance gain. Most digital pots are just FET with some buffers and drivers, they seem to be spec'd to 44 KHz sometimes 192 KHz so I assume 60 KHz would be no big deal.

Another funny thing about ferrites and reciprocity is how interesting their output is when they saturate, and how low the power level is when they saturate. That's why very little ham radio work has been done with ferrites as transmitting antennas, compared to the more conventional yet still rather obscure air core magnetic loop antennas. Ferrites are cool, strange chemical magic. Anyway a simple air core coil made resonant-ish might work better as an antenna than you'd think, maybe better than the ferrite. You get best performance with the correct ferrite core material for the frequency band selected. Probably the gutted radio clock you used, used the correct core material, or maybe it used the cheapest one that mostly worked (although not in your dorm room as you mentioned). Trying to use Amidon core material 17 would be quite futile at 60 khz, a bar of amidon material #3 would probably work at 60 KHz assuming you could find it. Manufacturing your own optimized antenna large enough core to handle some power and with the proper ferrite core material would be an interesting 3rd experiment.

Daydreaming about ways to continue iterating on a design is fun.

I'd love to buy one. My house stopped receiving them for a year now. Maybe I have a noise source or something.

Nice work!

-1 for disabling zoom on mobile devices

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact