einoko / DCF77-Synchronizer

Simulate DCF77 time signal in your browser
5 stars 2 forks source link

Cannot sync my Casio GW-M5610U both on my phone and laptop w/ and w/o headphones #1

Open arbv opened 1 year ago

arbv commented 1 year ago

I have tried to sync the wristwatch using your WEB-app but it does not seem to work. I have tried both on my phone and laptop using different voulme levels, but it does not seem to work, despite the fact that the timepiece shows good signal level before failing (L2-L3).

On the other hand I have tried DCF77 Emulator Android app and it worked just fine on the first try. What I have noticed is that the app sounds differently compared to yours. My headphones or speakers do not make the clicky noise with this app.

I am not sure what could be wrong, maybe you have any other ideas what I could try? Should I adjust my sound card settings maybe?

It would be nice if I can get yours to work as I like yours more. Having it this way just makes more sense to me.

einoko commented 1 year ago

Unfortunately, I never tested this on an Android device. However, I got access to an older Samsung phone, and I also couldn't get it to work. I noticed an interesting thing in that whenever the current minute ends and the new minute begins, in the stock Samsung browser, the start of the new minute is delayed by ~200ms. The signal effectively goes out of sync, and I think this is what is causing the watch to fail at synchronizing the time. On my iPhone, the switch to the next minute is quick enough, so that the signal stays in sync.

There are some workarounds that come to mind. For example, the buffer size could be increased from 1 minute to 10 minutes. This way the signal should be in perfect sync for at least 10 minutes, which should be enough to sync most watches. Since you said that you can get L2 and L3 reception on your watch, maybe the problem lies here.

Here's a version that buffers 10 minutes of signal at a time (it may take a second or two for the signal to be generated). This version works with my Samsung phone (I set it on full volume, and placed my watch 1 cm away from the speaker). Can you try it with your phone? https://64c0c49f2dd7a6304aaac1ca--taupe-bonbon-38f4ae.netlify.app/

arbv commented 1 year ago

It seems that going out of sync is indeed the problem. The clock starts synchronsation with signal level L3, then it starts switching between L2 and L3, and before failing it looses the signal.

Thanks for the modified version. Will test it and report back.

arbv commented 1 year ago

Here's a version that buffers 10 minutes of signal at a time (it may take a second or two for the signal to be generated). This version works with my Samsung phone (I set it on full volume, and placed my watch 1 cm away from the speaker). Can you try it with your phone? https://64c0c49f2dd7a6304aaac1ca--taupe-bonbon-38f4ae.netlify.app/

I have tried three times on my phone (twice using Firefox and once in Chrome). It maintained L3 signal level throughout a whole attempt, but towards the end (after 10 minutes, I guess, though it seems that it happens before that) it lost the signal. So, it seems that it works better, but still does not help.

arbv commented 1 year ago

Does not seem to work on my Linux-based laptop either (using Firefox). Probably, jitter on my hardware is too big for synchronising clocks via a WEB-app, as there are many layers at play.

If you have any other ideas, would be happy to try.

einoko commented 1 year ago

Thank you for trying. Interesting. It's definitely taking too long. On my Casio (WV-59), it takes only one partial and one full minute of full connection to successfully synchronize with the web app.

What you wrote earlier regarding the sound, do you hear the clicks with your phone? Does the sound of the signal itself sound like it's clipping/distorted, or just high-pitched?

arbv commented 1 year ago

I makes clicky sounds once a second, but most of the time it is clear high pitched (sine wave ?) noise.

I have to admit that the watch themselves work fine as they managed to synchronise using the real DCF77 signal at 4:00 at night. Though, I would still rather diversify my time synchronisation services :) I cannot really expect that to happen all the time as I am quite far away from the transmitter (around 2000 km far away).

einoko commented 1 year ago

I know what you mean. I, too, live on the outskirts of the transmittable range. Most of the time the watch syncs fine during the night, but sometimes it doesn't, which made me write this app. I would love to test this with other radio controlled watches, but they are not very common to come by.

Regarding laptops and speakers in general, the results may vary a lot. I have gotten my best results with my phone and headphones/earbuds. Basically, just full volume and as close as possible to the antenna.

I checked out the DCF77 Emulator Android app. It too uses the 15.5 kHz trick to emulate the signal. Since your watch syncs fine with it, it means that it can be tricked with this method, but perhaps the signal quality from this web app is not good enough. It's possible to try to improve the signal quality, for example, by adding a filter that cuts down some of the clipping frequencies, or by adjusting the signal gain. However, without a physical access to the speakers and watch, it's difficult to say how much adjusting is needed.

Here's an example with a low shelf filter applied to the signal. This should diminish some of the lower frequencies that might be clipping. The clicking should sound more muffled too. I can take these changes to another branch, if you want to experiment with trying to improve the signal quality. https://64c1103a742e2d651884b4dc--taupe-bonbon-38f4ae.netlify.app/

arbv commented 1 year ago

Regarding laptops and speakers in general, the results may vary a lot. I have gotten my best results with my phone and headphones/earbuds. Basically, just full volume and as close as possible to the antenna.

That is exactly what I am doing both with the Android app and yours. My phone is one of the few which still has a proper 3.5 mm jack.

Here's an example with a low shelf filter applied to the signal. This should diminish some of the lower frequencies that might be clipping. The clicking should sound more muffled too. I can take these changes to another branch, if you want to experiment with trying to improve the signal quality. https://64c1103a742e2d651884b4dc--taupe-bonbon-38f4ae.netlify.app/

Will try this version later today and share the results. Thanks!

arbv commented 1 year ago

Well, it sounds much better, but the result is the same. It starts with L3 signal level and after some time it goes out of sync.

I can take these changes to another branch, if you want to experiment with trying to improve the signal quality.

Please do. Though, I have no experience in WEB-dev. I am the kind of guy who is more likely to write a program in C or C++ which spits out raw PCM data to stdout or a file. That being said, I would be happy to take a look at the filter code as I have no experience in these topics. Should I find something or have any other ideas, I would be happy to share them back.

einoko commented 1 year ago

There is now an experimental branch in the repo. It uses the 10 minute buffer, and there is a filter, and a gain node added to the signal chain. If you want to experiment with different filter types/values, or gain, see (lines 78-91) in /src/lib/signal_player.ts. On line 77 there is a link to the MDN documentation on different WebAudio filter types.

To launch the web app, go to the project folder, run npm install once to install the dependencies. After that, use npm run host to launch the web app in your local network. You can then access the web app in the local network with your phone.

arbv commented 1 year ago

Thank you for the guidance!