]> oss.titaniummirror.com Git - oss-web.git/blob - in/blog/wwvb.md
Blog entry keyboard-specific-mappings.md
[oss-web.git] / in / blog / wwvb.md
1 title: WWVB
2 linktitle: wwvb
3 parent: 2011-10
4 ctime: 2011-10-28
5 mtime: 2011-10-28
6
7 Repositories: SOON
8
9 TMI uses a WWVB receiver in its RWS product.
10 [WWVB](http://www.nist.gov/pml/div688/grp40/wwvb.cfm) is a radio station
11 operated out of Ft. Collins, CO by NIST, which provides a 60Hz carrier wave on
12 which is encoded the current time as synchronized with a pair of on-site atomic
13 oscillators. The low frequency of the WWVB broadcast means it is available
14 through most of North America. Perhaps you have heard of *Atomic Clock* radios.
15 These simply incorporate a WWVB receiver which is then used to automatically
16 set, and periodically compensate, the radio's internal real time clock
17 circuitry.
18
19 TMI's RWS (Remote Weather Station) project collects weather data completely
20 autonomously, time-stamping recorded data using its onboard RTC. The WWVB
21 broadcast is used to both initially set the RTC, and to periodically compensate
22 for its drift over time.
23
24 TMI chose to incorporate the C-MAX
25 [CMMR-6](http://www.c-max-time.com/products/showProduct.php?id=31) WWVB receiver
26 into its RWS design. This simple board requires very little power, and the fact
27 that the WWVB receiver need only be consulted occasionally to compensate for RTC
28 drift means its time averaged power consumption is very low. The CMMR-6 offers
29 a simple output, TCO, treated as a digital signal. TCO is logic high when the
30 WWVB carrier is transmitting at full power, and is logic low when the WWVB
31 carrier is transmitting at reduced power. Each second uses a variable period in
32 which the carrier is at reduced power to encode one of three values: a 0 bit, a
33 1 bit, and a frame marker. 60 of these tri-state bits form a time frame
34 containing the time, to the minute, during the current frame transmission. More
35 about the WWVB signal format is available
36 [here](http://tf.nist.gov/stations/wwvbtimecode.htm).
37
38 While the [WWVB time code format](http://tf.nist.gov/stations/wwvbtimecode.htm)
39 is easy to parse, this is not so true in the presense of noise. TMI has chosen
40 to address noise by implementing a digital 4th order Butterworth filter, using a
41 32Hz sample rate and a 3 Hz cutoff frequency. The filter inputs are either 0.0
42 and 1.0, sampled from the CMMR-6 TCO pin, and the filter output is some fraction
43 inclusive of the range 0.0 through 1.0. The microprocessor code implements
44 hysteresis to generate a digital output, where outputs >= 0.7 are treated as
45 logic 1, outputs <= 0.3 are logic zero, and any value in between these
46 thresholds leave the logic output unchanged. This filter, implemented within
47 the uC, requires up to 5% of the CPU while WWVB is in operation, but does a
48 stellar job at cleaning up the WWVB signal. To evaluate filters and generate
49 their implementation logic, we used the simple and easy to use
50 [Fiview](http://www.uazu.net/fiview) design tool.
51
52 Consider the following oscilliscope capture of live WWVB reception. TCO is the
53 output from the CMMR, and FOUT is the output from the digital filter. Note that
54 the filter delays the signal by approximately 200 ms.
55
56 ![Oscilloscope capture image](images/wwvb-capture.png)
57
58 As mentioned earlier, the duration of the low period indicates the bit type.
59 200 ms for bit 0, 500 ms for bit 1, and 800 ms for a frame mark. As can be seen
60 in the TCO trace, there is a significant amount of relatively high frequency
61 noise interfering with the TCO signal. A discrete algorithm would likely be
62 unreliable in decoding TCO. However, the filtered output, FOUT, successfully
63 removed all the noise with minimal signal distortion. A discrete algorithm can
64 parse FOUT with a high degree of reliability. In this case, the trace as
65 decoded -- 0 0 1 0 M 0 0 1 1 -- was the correct sequence for the captured frame.
66
67 The decode algorithm determines a bit value for the current low period duration
68 that is best matched by the expected durations. But the low pass filter cannot
69 remove all sources of error, so a frame may be received with bits in error.
70 Frames are validated according to the [WWVB time code
71 format](http://tf.nist.gov/stations/wwvbtimecode.htm), and two frames must have
72 matching data to consider a valid time acquisition. Of course in this sense,
73 matching frames do not have the exact same values, but the second frame's
74 contents differ from the first frame's only by the number of minutes separating
75 their acquisition.
76
77 There are still a few enhancements possible in this design. First, the TCO
78 signal could be captured via an ADC, to bring additional information on each
79 bit into the filter. This, however, might require some software gain control
80 depending upon how good the CMMR-6 AGC circuitry is, and may not be worth the
81 effort.
82
83 The second enhancement is one that will be implemented. Instead of matching two
84 complete frames to indicate valid aquisition, instead match complete frame
85 sections. Three incoming frames all with errors in different sections would
86 allow this latter approach to construct a known good frame, where the current
87 algorithm could not. In very noisy cases, this enhancement should perform
88 better.