Build your own WWVB-controlled binary clock


Background

I love having an accurate clock, but I'm also a geek. There are lots of radio-controlled clocks on the market, but there are two problems:

1. Nearly all use LCD displays, which I find quite boring.
2. None of them are binary clocks.
In order to satisfy my inner geek (or perhaps it's more of an outer geek in my case), I require a clock which has a visual binary output. Nearly all the binary clocks I have found use a binary coded decimal output, but I want a true binary display.
Being dissatisfied with the items available in the marketplace, I decided to create my own clock. My design requirements are:
  • It must be accurate.
  • It needs a true binary display (none of that wimpy BCD crap for me).
  • It must be aesthetically pleasing (to me - I don't care what YOU think).
  • Design

    With those goals in mind, I began my research into how exactly I could build such a contraption. Building a binary clock is not all that difficult, but things start to get more complicated when the element of accuracy is introduced. There are three decent options I could come up with to get an accurate time reference - NTP, WWVB, or dialing NIST with a modem. The first option is not easily done with a simple circuit - it would either need to be computer-controlled, or I would probably be looking at some sort of single-board computer with an ethernet interface, and those aren't cheap. The last option seemed a bit low-tech (read: not geeky enough), and I wonder whether that service will be available long-term. That leaves me with WWVB, which is well-proven as an inexpensive, accurate time source. There are numerous WWVB-controlled clocks that can be picked up at your local drugstore for less than $20. Obviously, this is the option I chose.

    For the display, I'm using a total of 47 LEDs:
    12 LEDs to display the year - what happens on January 1, 4096 is not my concern.
    4 LEDs to display the month
    5 LEDs to display the day of the month
    5 LEDs to display the hour
    6 LEDs to display the minute
    6 LEDs to display the second
    5 LEDs to display the current GMT offset (-12 to +12 in 2's compliment)
    1 LED to indicate DST status
    1 LED to indicate WWVB reception
    The LEDs are driven by an Intersil ICM7218A IC, which is normally used as an 8-digit, 7-segment display driver (including decimal points). A neat feature of the ICM7218 is that it has a no-decode mode, which allows you to control up to 64 discrete LEDs arranged in an 8x8 matrix. The IC drives the LEDs in constant-current mode, meaning that there's no need to put current-limiting resistors on the LEDs.

    My original plan was to build this using discrete TTL gates, but I quickly determined that using a microcontroller of some sort would make this project a whole lot simpler. I decided to use a MicroChip PIC microcontroller, due to their low cost and the high availability of documentation and sample code on the web. I ordered a PIC programmer kit (a kitsrus Kit 149d) from Electronics 123 to get me started. I got the kit the day after I ordered it and assembled it in about 30 minutes. I have no prior experience with PICs, although I have programmed x86 and 68k processors in assembler, so I figured I could learn this pretty easily.

    The next step was to find a way to get at the WWVB signal. I could try to build my own receiver, but that would add too much complexity to what is ultimately supposed to be a "fun" project, so I began searching for some sort of ready-made module to do this. It seems that there are only a couple of WWVB receiver modules available to the hobbyist, and they're more expensive than buying an entire clock. Determined to make this work, I picked up a small WWVB-controlled clock for $12.99 at my local CVS and disassembled it. It turns out that these clocks contain a small receiver module and a ferrite core antenna, which is entirely separate from the rest of the clock. I desoldered the 4-conductor ribbon cable from the clock's main PCB and put the clock back together. The nice part is that this little clock works just fine without the module, so I gave it to my lovely, but non-geek wife after setting the correct time on it.

    The module has an epoxy-blob type IC of some kind, a couple of smd resistors and capacitors, a 32.768KHz watch crystal, and some leads going to the antenna. The pinout for the ribbon cable is nicely labeled on the clock's main PCB, so I didn't have to do much testing.
    Pin 1: +3 to +5v
    Pin 2: Gnd
    Pin 3: Output signal
    Pin 4: Receiver enable (active low)
    With the receiver module out of the way, I began working on a basic clock running on a PIC. While it is certainly possible to do the clock 100% in software, I wanted the resources of the PIC dedicated to doing other things (like running the display and watching for a good signal from WWVB), so I decided to use a dedicated RTC chip to keep track of time for me. For that, I'm using a Dallas DS1302 RTC chip, which uses a 3-wire serial interface to the microcontroller. The PIC I'm using is the 18F4320, which comes in a massive 40-pin DIP package with 36 I/O pins and lots of memory. My initial testing was done using an LCD for output, since I can pack a ton of debug information onto a 2x40 char display.

    After writing a few smaller programs in assembler on the PIC to get familiar, I decided that it would be far faster to develop the program in C. Assembler is wonderful if you need to squeeze every ounce of speed or every bit of RAM, but if those resources are less constrained than your available free time, C is a better choice. I started looking around for a decent C compiler for a PIC and quickly found that these things aren't really geared toward the hobbyist. CCS, which seems to be one of the more popular compilers around, wants several hundred dollars for their software, and then they have the nerve to charge even more money if you want free upgrades past 30 days. While I contemplated "aquiring" the software through other means, I stumbled across BoostC, which includes the SourceBoost IDE with the compiler. BoostC does not have the huge libraries of pre-compiled functions that CCS comes with, but it does have an active, growing community of users who contribute sample code on the website. The software is free for hobbyist use if you can stick to the limit of less than 2k words of compiled code on the 16xxx PICS and 4k on the 18xxx series. You can actually do quite a bit in that amount of space. I wound up springing for the full non-commercial license for the software, even though I likely could have fit all of my code into the limitations of the free version, mostly because I want this guy to stay in business.

    Now that all the pieces have been gathered, I've breadboarded the important parts of the circuit and I'm working on the code for the microcontroller. I will update this page as the work progresses.