demogorgi / set-rtc-using-dcf77-via-dcf1

Micropython script to set real-time clock (rtc) using DCF77 receiver module DCF1
9 stars 3 forks source link

Questions rather than issues: #3

Closed veebch closed 2 years ago

veebch commented 2 years ago

First of all thankyou for sharing this!

Why the subtraction of 1 from the minutes? Are the parity sums correct? they seem to differ from the wikipedia page

demogorgi commented 2 years ago

I suppose you mean the -1 at the end of line 74 of dcf2rtc.py. The comment at the very end of the line indicates that I asked myself your question two years ago :-) I tested the code back then, so I think the -1 is necessary, but umfortunately I can't tell you why.

veebch commented 2 years ago

Thanks.... if I figure it out, I'll let you know :) The code looks fine, so I am blaming Wikipedia

veebch commented 2 years ago

I think it's the 59 seconds that you are adding on that is the issue. I am assuming that DCF is giving information about the hours and minutes only, and that the signal describes the minute following the second without modulation. I am no expert at all. As it stands, it is possible for the code to give a minute value of -1 if all the bits are set to zero. Does this make sense?

demogorgi commented 2 years ago

I have reinstalled everything and let the code run for getting into it again. I think you're right. The thing is, that "The time transmitted is the time of the following minute; e.g. during December 31 23:59, the transmitted time encodes January 1 00:00." (see https://en.wikipedia.org/wiki/DCF77). So I have to subtract one minute to usually get the correct time in my approach. This can go wrong if the script starts its work close to the hour switch.

veebch commented 2 years ago

So I've refactored a little for the decoding (it can deal with a slightly noisy signal), I'll share as soon as it's up and running. If you want, I can fork your code and submit it back for your consideration. Anyway, thank you again, your code was really helpful in getting me started.

demogorgi commented 2 years ago

I'm glad to hear that and look forward to your contribution.