WWVB Atomic Time with a PICAXE 08M2

pxgator

Senior Member
#1
Inspired by other threads that decode time signals I decided to give it a spin. Ordered a WWVB/MSF receiver from PV Electronics in the UK and put together a small breadboard system. The receiver works great and it should since I live within 120 miles of the transmitter. The pulses are clean and steady 24 x 7. WWVB is a bit stingy with the information they broadcast compared to MSF in the UK. There is no month, day of month, day of week etc. and extracting that from the days in the year would have surely given me a headache. So the project extracts UTC time and either Mountain Standard or Mountain Daylight Savings Time depending on the state of a certain bit (57). It is working great and doing exactly as intended. The code is not optimized but written for clarity and ease of understanding. All comments either positive or negative are welcome. Reference information was derived from the link below.

https://www.nist.gov/sites/default/...ST-Time-and-Frequency-Services-2012-02-13.pdf


View attachment WWVB_sertxd2T.bas


P.S.
The *.bas file has been updated so that it is easy to modify to work with any time zone within
WWVB broadcast coverage. See lines 132,190, and 196. Also the error checking has been updated.
The next update will include hippy's date code.

Cheers to All
 
Last edited:

hippy

Technical Support
Staff member
#3
WWVB is a bit stingy with the information they broadcast compared to MSF in the UK. There is no month, day of month, day of week etc. and extracting that from the days in the year would have surely given me a headache.
Happy May Day ...

Code:
Symbol dofy = w1 ; b3:b2 1..366 Day Of Year
Symbol year = b4 ;       0..99  Year
Symbol mnth = b5 ;       1..12  Month
Symbol days = b6 ;       1..31  Day

; 2017 dofy 1    2017-1-1
; 2017 dofy 31   2017-1-31
; 2017 dofy 32   2017-2-1
; 2017 dofy 59   2017-2-28
; 2017 dofy 60   2017-3-1
; 2017 dofy 365  2017-12-31

; 2020 dofy 59   2020-2-28
; 2020 dofy 60   2020-2-29 Leap Year
; 2020 dofy 61   2020-3-1
; 2020 dofy 366  2020-12-31

Test:
  year = 17      ; Year
  dofy = 365     ; Day Of Year
  Gosub FindDate
  SerTxd( #year, "-", #mnth, "-", #days, CR, LF )
  End

FindDate:
  mnth = 0
  Do
    days = year & 3 Max 1 ^ 1 + 28
    ;            Ja Fe   Ma Ap Ma Ju Jy Au Se Oc No De
    LookUp mnth,(31,days,31,30,31,30,31,31,30,31,30,31),days
    mnth = mnth + 1
    If dofy <= days Then
      days = dofy
      Return
    End If
    dofy = dofy - days
  Loop
 

pxgator

Senior Member
#4
Awesome...!! thank you Sir. Once again...hippy to the rescue :eek:
With support like this how could one not love the PICAXE system.

Cheers to All
 
Last edited:

pxgator

Senior Member
#5
Here is a version of the code that outputs the time to a TM1637 four digit LED clock display. The code is setup
for time zone 7 (mountain time) but can be easily modified for any time zone within WWVB broadcast coverage
by changing line 150. The parts and pieces for the project were obtained from the links below.


View attachment WWVB_MT_TM1637.bas


http://www.ebay.com/itm/262840859433?_trksid=p2057872.m2749.l2649&ssPageName=STRK:MEBIDX:IT

http://www.ebay.com/itm/310788450125?_trksid=p2057872.m2749.l2649&ssPageName=STRK:MEBIDX:IT

http://www.ebay.com/itm/232045296534?_trksid=p2057872.m2749.l2649&ssPageName=STRK:MEBIDX:IT


P.S. The *.bas file has been updated to reduce code size.

Cheers to All
 
Last edited:
Top