Atomic Clock Receiver Module V3 WWVB MSF JJY60

Trying to get the time using the module above.
I am following the

without the TFT and the "Blue Pill" (who's using that anyways?)

So my code goes:

//#include <TFT_eSPI.h>
#define RADIO_OUT 21


void setup() {
Serial.begin(115200);
Serial.println ("Serial works");
}
void loop() {
int pulseWidth = pulseIn(RADIO_OUT,LOW,2000000); 
pulseWidth /= 1000;
if (pulseWidth>90) 
{Serial.print ("Good signal: ");
Serial.println (pulseWidth);
} 

Serial.println (pulseWidth);
}// end loop

Good news is that I get some signal, but nothing above 90. I moved the antenna around but no use. Should I go to a hill top?

Can I proceed further?
I get now:

-6
31
-9
13
-27
15
22
24
14
-26
31
12
15
8
10

Thanks a lot
Mitch

Do you need to define RADIO_OUT pin 21 (on your Mega?) as an INPUT or INPUT_PULLUP? I see the link's code does not define it as input, but maybe the Lilblupil has PA12 always INPUT/INPUT_PULLUP.

A note about WWWB reception. It's shortwave, conditions are highly variable. A hilltop won't help you, the signals are coming down at you from the ionosphere.

I had a few clocks that used it. They were constantly losing synch. Usually I could only find a few places in the house where they would lock on. The 3D orientation makes the biggest difference, but they are also sensitive to any EMI from other electronic devices nearby.

I assume you know, the signal is only transmitted once per minute... so moving the antenna faster than that won't prove anything.

You mean, in the thread title? How about a link? Thread titles are not easy to cut and paste with this forum software.

Actually, WWVB is VLF (60 kHz). WWV is short wave.

@OP: which WWVB module do you have, with which antenna? Post a link.

The ferrite rod should be arranged so that its long axis is perpendicular to the line from you to the WWVB transmitter, and FAR AWAY from other electronics.

If you arrange for a simple LED output, you don't need an Arduino to detect WWVB reception. Just look for 1 second flashes. Best reception is at night.

Possibly useful info on WWVB here: GitHub - jremington/WWVB_decoder: New, more accurate WWVB time signal decoder for Arduino, based on cross correlation with bit templates

Oops! Anyway, reception is usually "spotty", so you can't sync continuously. You need some kind of RTC. No matter how good the signal, there will be times it won't be there.

The module home is

Sorry, I should have mentioned that.

Good suggestion to define an input , and I did: pinMode (RADIO_OUT, INPUT);
The results are as bad as before.
Why do I have negative numbers for Pulse width?
Also , if the broadcast is once a min, why do I get a continuous string of readings?

It is not. Data bits are broadcast every second, with either full carrier, or carrier reduced levels. 60 data bits = 1 minute = one complete time/date WWVB transmission. The details are posted here.

If set up properly the radio will flash an LED every second, using either a long or short pulse, when receiving a valid WWVB signal.

EDIT: on that CANADUINO receiver, the OUT LED should flash as mentioned above. To verify reception, all you need to do is power the receiver from a 3V battery and carry it away from possibly interfering electronics.

LF (30kHz - 300kHz) ITU Radio Freqs like to split at "3 x 10^x"

Do you need to "map()" the sensor output to your preferred range?

Probably because you are overflowing the int variable that you try to store it in:

int pulseWidth = pulseIn(RADIO_OUT,LOW,2000000); 

I'll guess the effect is masked by the subsequent divide by 1000 that you do.

pulseIn() returns an 'unsigned long int' (32-bit) number which you store in a 'signed int' (16-bit) variable. You have the timeout set to 2 million microseconds but any value over 32767 microseconds will overflow the 'int'.

Thanks everyone,
Yes defining the pulsewidh as a long got me better numbers.

Next the document above makes an ISR that doesnt even work on a Mega.

I am giving up. this is above me. I wish someone smarter than me worked out the bugs and we had a way to get the atomic time easily...

The code linked in response #5 above will work on a Mega.

I think for the Canaduino receiver, the input pin should be connected to OUT, rather than /OUT. But if the LED indicates a good signal and one doesn't work, try the other.

That Universal Solder Canaduino module has a led marked OUT and it should blink regularly at 1 second intervals if it is getting a good signal.
Some things to be aware of. (1) It is a kit and the crystal and antenna must match the transmitter, in your case 60kHz and (2) The pin marked PDN must be tied to ground. (3) The receiver modules are very prone to local electrical interference such as noisy power supplies.
The project you are following is for a Bluepill, a 32 bit processor, and you are using a Mega which is an 8bit processor hence the problem you have already experienced with int/long. It also uses interrupts and hardware timers which are completely different between these microcontrollers. You really have to find a project which has been developed for an 8 bit Arduino board.
I have used the European (77.5kHz) version of the Canaduino module quite successfully. I even used a much bigger (20cm) home made ferrite antenna for improved reception.

And there more than a few times WWVB is off the air for various reasons. Out weather station uses WWVB for it's clock. A few weeks ago my wife noticed it was way off from the time on the other kitchen devices. I reset the weather station and it had not synced up after quite a few hours. The WWV web site gives a list of all the WWVB outages, when and how long. Quite a long list.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.