NIST WWVB WWV WWVH & Propeller
PJAllen
BannedPosts: 5,065
OK
This subject and all Replies shall be about using the Propeller as it relates to capturing and otherwise making use of the time signals from WWVB, WWV and WWVH and their technologies as applicable.
If you're about GPS or something or anything else then take those concerns or objections someplace else.
The same goes for any "accuracy" rumbles, "what is time" theorizing, etc.
This subject and all Replies shall be about using the Propeller as it relates to capturing and otherwise making use of the time signals from WWVB, WWV and WWVH and their technologies as applicable.
If you're about GPS or something or anything else then take those concerns or objections someplace else.
The same goes for any "accuracy" rumbles, "what is time" theorizing, etc.
Comments
Waiting for my WWVB receivers from Inglaterra.
Links --
http://www.pvelectronics.co.uk/rftime/SYM-RFT-XX.pdf
http://www.nist.gov/pml/div688/grp40/wwvb.cfm
For WWV, I took the audio signal from a commercial HF receiver, built an op-amp active bandpass filter, then rectified the output, digitized it with a Schmidt, and the computer took over from there with conventional serial message decoding.
I say conventional because it's not rocket science, but all the same, there's a real art to being able to detect sync, decode partial messages, re-acquire sync after signal loss, etc. It's not so easy to do a good job at this. On the other hand, once it's working, it's really rewarding to watch your program smoothly decode the time from a signal that's so weak and staticy that the voice part of the broadcast is virtually unintelligible.
The trouble I've had with WWVB is that there's no conventional voice signal to show that the station has been acquired, and the signal where I live is weak enough that circuit noise, radio noise, oscillating op-amps, power supply hum all muddy up the received signal strength to the point where I can't tell whether the circuit is receiving the signal or not.
I could see two parts to this as related to the propeller. First, decoding the serial stream into date and time values. WWV and WWVB have slightly different formats, but if I remember right, they have a similar concept of several frames of data sent over about a minutes time, so I'd guess one propeller library could serve to decode both. Second, for the adventuresome, the propeller might be able to do some of the radio frequency signal processing as well.
Years ago I bought a dedicated WWV receiver, a little board about 2 inches square, into which is installed your choice of either a 5 or 10 mHz crystal, and it does a pretty decent job of receiving WWV audio. It would be a nice project to add a propeller time decoder to that board. Maybe Phil Pilgrim's Goertzel propeller code routine could replace the 100 Hz active filter and detector.
As you say, it's easier to experiment with something that you can hear.
WWV, WWVH reception quality varies by time of day and seasonally.
That can depend the aerial used and other factors.
I think that the idea is to update an "RTC" or similar, at least once a day, and not be pinned down to an all-or-nothing constant reception-dependent paradigm.
(I hope those Ingles get my receivers on their way soon.)
Ray
Both sellers noted on that other page feature the same device (same pictures, descriptions, etc.) and both have commendable feedback / ratings.
I bought a "CMRR" or some blasted thing from "DK" several years ago, but its documentation was a black hole, instructions by serial and they kept those secret (part of the expensive Development Kit or whatever.)
Publison,
I'm well outside CHU's reception area. I'm familiar with their 300bps format. If you work out something for that, feel free to post about that for sure.
That apparently broke some radio-controlled clocks, while others were able to absorb the new format with no ill effects.
http://www.nist.gov/pml/div688/grp40/wwvb.cfm
Yes; PJ provided that link in post #2.
I opened it up and soldered some headers to it and procrastinated other projects while working on trying to receive time signals.
Earlier today it didn't do anything interesting but tonight it started jabbering away at me.
This is what it said:
The various characters are all listed in the constant section but here are the main characters seen above.
If I didn't hold the radio in the correct position, I received the multiple second error messages.
I never received a full set of ones and zeros between to markers without some sort of timing error. Even though I'm not capturing the complete signal, I think it's promising.
Once I can get the ones and zeros sorted out, I can start to decode the message. I'm using a circular buffer to hold the pulses but so far the program doesn't analyze more than one set of high and low pluses at a time.
Here's the code in case any of you are interested (it's also attached to this post).
I was able to get a good signal for over four minutes. The Prop and radio were being powered from the USB cable so my setup wasn't portable. I had to hold the setup at almost arms length away from me to get a good signal. After four minutes, my arm got too tired.
Here's the output (it's from a functionally identical program to the one I posted1).
The good stuff is where the ones, zeros and "M"s show up.
Apparently two markers"M,M" indicate the beginning of a frame. The first three binary numbers is the tens of minutes (zero in this case) and the next five bits are the minutes less than ten (0 through 5 are displayed).
The NIST website has the info to decipher the rest of the bits.
I don't think it will be too hard to decode the transmission but turning the code into a useful self correcting clock will be more challenging.
1. I still had version "g" loaded in the EEPROM but the only difference between "g" and the "h" version I posted is I deleted a bunch of commented out code from the "h" version.
Good on ya, DD.
Still, I anticipate Los Ingles. (I am in receipt of an order update, they've "been shipped.")
This may account for the "attractive" pricing for these units.
:eek:
Won't know till we know.
As to the decoder: I have written a clock that keeps Greenwich (UTC) time in hours, minutes, seconds, and DayOfYear. That data gets fiddled to local time, date, month, DayOfWeek, and year, and displayed on a 2 x 16 LCD. I will add a WWVB decoder in a separate cog that reads UTC in hours, minutes, seconds, and DayOfYear, that being what WWVB provides. It will set a flag when it has good data which the propellor clock will use to overwrite the time it is keeping. The resulting display will be correct to within one second (neglecting LCD response time).
The wiki article for WWVB describes the AM coding in detail. Basically, it transmits minutes, hours, DayOfYear, year, and a few others once a minute. DD is correct is saying that a double marker indicates the beginning of a frame.
Here's the output from my latest program.
The time here was 9:46 PM Standard Mountain Time.
Obviously I need to fix the output formatting as well as the logic of the program.
I hope to make my system portable tomorrow so I can go outside to see if I can get better reception.
It's approaching the time of night when I've previously got good reception but I think I'm headed to bed. I'll try again tomorrow night.
I've attached the buggy program used to generate the above output.
I'm not there yet but I keep getting closer.
There is a second cog that monitors a simulated WWVB signal. It uses pretty much brute force, finding two markers in a row (top of frame) and then watching the next 58 pulses. If any pulse is incorrect for its second, the cog just starts over, looking for a new frame. If all the pulses make sense, this cog overwrites the time the prop crystal is keeping, always at second number 54.
This is working given an input that amounts to perfect WWVB reception (my simulator in a previous reply in this thread). I am anxiously awaiting my real WWVB receiver to see what I need to do (or what I *can* do). I am on the west slope of the Sierra Nevada range. I have a "atomic" clock that has always worked just fine as far as I know, so I have high hopes.
Edit: I just realized I had uploaded an old version. I replaced it with the current version at about 10am Cal time. Sorry, my bad.
Nice job. What you are going to need to do is not quit the process if one bit is missing over the frame. That's a real possibility in even the best reception.
The trick is to save each bit in an array, either 0, 1 or 2 (invalid) as you go through the minute. Some will be invalid, but that's okay as you will pick them up in the next minute. After 2-3 minutes, you'll receive all of the bits, just not all of them in one minute.
You also have to update the array at the top of each frame so the good bits increment, otherwise the final time will be incorrect. If you miss the top of frame, either dump the array and start over, or increment it and wait for the next expected top of frame.
I'd think the two markers indicating the start of the message and then the minutes frame would be enough to update a clock that is slightly fast or slow. The other stuff isn't going to change much.
After initial reception, yes. But on power-up, you might not know anything about the time and have to decode the entire frame. Plus, you should check for the DST bits to account for the hour shift.
That would speed things up instead of waiting for a whole frame and that delay.
Got time data locked; if frame w/o interruption then incr; frame w/o interruption then incr;...
And then deciding when it's appropriate to update an RTC or leave the Propeller-based clock in check.
Does that make good sense?
"Propeller-based clock," you ask?
Well, yes, have a Propeller cog running an hh:mm:ss clock based on its crystal.
Radical concept?
You don't even need a separate cog for a Propeller RTC. Just have the main loop check to see if a second has passed and if a second has passed, update the time.
I have the main loop call the method "CheckTime".
The method also updates the display (by calling the "DisplayTime" method) with each new second.
I think that would not drift more than 1 sec or so per day (but, please, don't anyone take me to task for my fantastic optimism).
Maybe I should try my hand at that before I go shooting from the hip.
Yes, I understood. I think this is a rather common practice in Propeller land. (The code I posted, includes a software RTC.)
I was pointing out you don't need a dedicated cog to run the software RTC, the main loop can just check the system clock ever so often to see if the seconds count of the software clock needs to be adjusted.
That's how the one I posted works. The cog monitoring WWVB is just there to correct the prop clock at most once per minute.
"Once your radio controlled clock has synchronized, it wont decode the signal from WWVB again for a while. Most clocks only decode the signal once per day, but some do it more often (for example, every 6 hours). Those that decode the signal just once per day usually do it at midnight or in the very early hours of the morning, because the signal is easiest to receive when it is dark at both WWVB and at the site where the clock is located. In between synchronizations, the clocks keep time using their quartz crystal oscillators. A typical quartz crystal found in a radio controlled clock can probably keep time to within 1 second for a few days or longer. Therefore, you shouldnt notice any error when you look at your clock display, since it will appear to be on the right second, even though it has probably gained or lost a fraction of a second since the last synchronization."
http://www.nist.gov/pml/div688/grp40/radioclocks.cfm
A crystal that is correct to within 10 ppm will be good to about a second per day. I guess it all depends on how well you have to keep time. I can remember when we needed +- 10 milliseconds. Nowadays, as the guy in "Soul of a New Machine" said, "...I will not consider any period of time shorter than a season".
I use a "possibleSync" variable to hold the beginning cnt setting as a bit is received. If the bit turns out to be the second marker, then I use the value stored in "possibleSync" to update the seconds time.
Duane,
Yes, the beginning of the first marker in the frame is the beginning of second 0. Subsequent markers are at the beginning of seconds 9, 19, 29, 39, 49 and 59.
http://www.nist.gov/pml/div688/grp40/wwvbtimecode.cfm
That is my understanding from reading the spec. The instant the signal strength decreases (the fancy new receivers from England {which I have ordered but not yet received} say it is inverted on their digital output) to begin the second marker is the beginning of the minute.
I am currently correcting my "free-running" clock on the 54th second. Probably ought to be waiting until the 59th.
It's also inverted in the SparkFun radio. The pin goes high when the signal strength drops.
I'm surprised you received a clear signal during the day. I need to make my setup portable so I can try it away from all the noise near my PC. I'd think receiving the signal in Idaho shouldn't be any harder than receiving it in California.
Is this the device you purchased? It looks like it's working well. If the device you purchased is the same as the one I linked to, I'll probably purchase one. I may want to make a radio syncing clock as a Christmas present for a family member.
Do you mind posting your latest code? I'm not going to look at it right away, but once I have my clock working as I'd like, I'd like to compare my program against yours to see what sorts of things we did differently.
Thanks for the update.