Code Monkey home page Code Monkey logo

Comments (29)

mr-sneezy avatar mr-sneezy commented on July 18, 2024

I'm also trying different PWM values for the -17dB low signal. Tried higher and it definitely bombs out earlier. Now trying lower than 6...

from wwvb.

micooke avatar micooke commented on July 18, 2024

Try changing:

if ((wwvb_tx.mm() % 10 == 9) & wwvb_tx.is_active())

To:

if ((wwvb_tx.mm() == 59) & wwvb_tx.is_active())

This will sync it once an hour. The drift will be about 15ms over that time, so should be negligible.

The other option is a change in wwvb modulation, which i really don't want to do. It would involve amplitude modulation instead of pulse width modulation, hence more componentry.

from wwvb.

mr-sneezy avatar mr-sneezy commented on July 18, 2024

Did the change and retested various PWM low values. The Casio is still not happy with it, the desk clock works fine with up to a PWM low of 10 then fails after that. Tried the default 6 a few times and also 4, 5. No joy with the Casio watch.
It would be good to find someone else with WWVB clocks or watches to try some testing.

from wwvb.

ntmmfts avatar ntmmfts commented on July 18, 2024

Appreciate the amazing work on this project... I've been trying with a Japanese Casio Lineage LCW-M170TD-7AJF with no luck (https://www.amazon.com/gp/product/B00IK5YZR6/ref=oh_aui_detailpage_o07_s00?ie=UTF8&psc=1). My dso0201 nano scope says ~60.07 kHz with slight fluctuations, not sure how accurate it is though, but seems like the watch is really sensitive to an accurate signal. Depending on when I start a manual sync on the watch, it may try for about two minutes, or bomb out before one, and always results in an error. I'm following and hope you make a breakthrough, and maybe in the end that means some amp. mod. components. I live in Hawaii, so it's not just a bad WWVB signal, it's NO WWVB signal :-(. Thanks again for your efforts...

from wwvb.

micooke avatar micooke commented on July 18, 2024

@ntmmfts @mr-sneezy
This project is currently on the back burner, i had been waiting for parts to arrive to continue testing (which have since arrived). Ill get back on to this shortly (time permitting).

The code (below) is capable of generating a 60.150kHz or 60.606kHz carrier, so if @ntmmfts is measuring 60.06kHz then its better than expected!

#if (F_CPU == 16000000)
        ICR1 = 133; // Set PWM to 60kHz (16MHz / (2*133)) = 60150Hz
        // Yes, its 133 and not 132 because the compare is double sided : 0->133->132->1
        PWM_HIGH = 66; // ~50% duty cycle
        PWM_LOW = 6; // ~5% duty cycle
#elif (F_CPU == 8000000)
        ICR1 = 67; // Set PWM to 60.6kHz (8MHz / (2*66)) = 60606Hz
        PWM_HIGH = 33; // ~50% duty cycle
        PWM_LOW = 3; // ~5% duty cycle
#endif

The timing of the modulation signal is max 10Hz, so much easier to get right.

Im thinking that one of three things are to blame.

  1. I suck, and have stuffed something up. Very probable, but it is working with the BALDR clock (@mr-sneezy youtube vid) so it must be close
  2. My internal 60kHz signal isnt close enough - i need to modulate an external oscillator
  3. PWM is not good enough for quality clocks, i need to do AM

TODO:

  1. modify the code to just output the digital modulation signal (in progress.... slowly....)
  2. modulate a 60kHz carrier by this signal using an adder op-amp circuit (hopefully this is close enough?)
    2.1. if 2 works : test it with an internal 60kHz carrier - this minimises components.
    2.2. if 2 doesnt work: try it with a proper AM circuit =spice simulation, pain and more componentry

from wwvb.

mr-sneezy avatar mr-sneezy commented on July 18, 2024

@ntmmfts
Strangely enough that is exactly the same Casio Lineage that I have, but mines the black face version. Symptom is the same, the watch clearly detects a signal and starts to sync but then gives up after about two minutes, sometimes less I think. The same code and 'antenna' coil work fine with the BALDR desk clock though. So we're very close, but not quite there. It would be good to hear if somebody with a different Casio or perhaps a different watch altogether like Citizen could try it out. The antenna coil is fairly easy, a bit of hookup wire driven via a resistor or a LED as a current limiter will be OK for a test at close range (20-40cm).

from wwvb.

micooke avatar micooke commented on July 18, 2024

Update!?
I was going to create an opamp adder with one side of a lm358 (for AM) so i thought to use the other side as a 60kHz astable multivibrator. The maths for the circuit is tricky to tune, i couldnt get the damn thing to work - FAILED.

So i tried an astable 555 timer circuit. I couldnt get it to start unless i used a 1nF cap for C. The problem with this is that it's not very robust and its damn hard to tune as the cap tolerance and board capacitance vary so much. It should need Ra= 2k, Rb=11k. I settled for Ra=2k, Rb=10k pot. The 60kHz is very unstable - very temperature dependant, scrap that - FAILED.

Next i tried using parts of the wwvb to generate a 60kHz carrier - FAILED, then SUCCESS! Long story short, i think the bootloader and Arduino framework i use for the Attiny85 override some timer values so the wwvb library doesn't work for the tiny. It does with the internal 64MHz PLL, but in a recentish attempt to consolidate code i made it dependent on the 16 or 8MHz clock. Easily fixed, but motivation & time to roll it back into wwvb is low at this stage.

Tomorrow (?) ill design the op amp adder and see how i go. If it works with this setup then the next step is generating (and tuning) the 60kHz carrier and <10Hz modulation signal using the nano/micro.

Wish me luck!

from wwvb.

mr-sneezy avatar mr-sneezy commented on July 18, 2024

I wish you luck :)
And help of course.
My spare time for coding is split between the ESP8266 battery monitor (which is morphing into a weather station :) and also the Honda OBD to ODBII converter...

from wwvb.

ntmmfts avatar ntmmfts commented on July 18, 2024

thanks for your efforts! looking forward to see where things go... ~jay.

from wwvb.

micooke avatar micooke commented on July 18, 2024

I've uploaded my latest updates. The modulation output hack for wwvb only works for 16MHz, only tested against the nano.

Im using an attiny85 barebones for the 60kHz carrier. Funnily enough it should only need 132 for the compare register for 60kHz but i had to increase this when i tested it on the programmer. Then put it on a breadboard and its 57.4kHz. I can't win :)

See the fritzing diagram for the opamp circuit, but it doesn't work yet. I need to spend a bit more time on it.

from wwvb.

mr-sneezy avatar mr-sneezy commented on July 18, 2024

Yes nice set of diagrams :)

from wwvb.

micooke avatar micooke commented on July 18, 2024

Well i designed the adder circuit. Then realised it's not going to work for a single rail opamp. I then designed and tested a non inverting adder, and realised i want to add the carrier with the ook version of the carrier instead of the modulation pulse and the carrier. I added a 2n5484 and voila, working circuit.. At the cost of 2 components and 5 resisters. First of all i simulated it and it worked as expected.

Then @mr-sneezy points out that all i need is a voltage divider into a unity gain buffer. 'high' state i set the arduino pin floating, 'low' state i ground the positive input through a resistor to create the voltage divider. 1 component and 2 resistors - same output. So that's what ill try next. Just need to update the wwvb code to output the modulation pulse as i described above.
Stay tuned..

from wwvb.

micooke avatar micooke commented on July 18, 2024

Just a short note. The lm358 i use needs to be powered by 6.5V minimum as at worst it can output the rail voltage - 1.5V.
I was pretty happy with myself when i implemented a voltage multiplier off of the 60kHz signal, and it worked... But the desk clock is not playing dice - so its a timing issue. It needs more debugging, and probably calibration. I plan to get a stable 60kHz signal out, and use timer2 PWM at 1Hz for the modulation signal - and tune that setup as it should be most stable (less ISR calls).

@ntmmfts - what Arduino are you running? I work mainly on the nano, and if this works i may not bother calibrating for the micro/leonardo. I would really like to move this project to an esp8266 and use ntp for timing rather than gps, so would use my time learning up on that.

from wwvb.

ntmmfts avatar ntmmfts commented on July 18, 2024

Sorry, was distracted by my job for a while! I'm using a nano. Question, what exact model lm358 did you use? Thanks again!!

from wwvb.

micooke avatar micooke commented on July 18, 2024

Yeah you and me both!
At the moment I'm trying to get my esp8266 controlled xmas tree lights flashing to music 😄

Unfortunately i still don't have it working for the casio watch, i need to calibrate it and run another test using the AM circuit. I really hope i dont have to do proper AM as ill need to use a negative supply. IF (big if) i need to go down this path ill use a 555 circuit like this http://www.electronicecircuits.com/electronic-circuits/555-negative-voltage-power-supply-circuit. This would be a pain..

Lm358n or lm358p - same chip, different manufacturer. This looks like a good buy - 50pcs for $2 http://s.aliexpress.com/YJryqQrA .
You can also get 10pcs for $1 on ali

from wwvb.

ntmmfts avatar ntmmfts commented on July 18, 2024

thanks! and good luck with the tree and Merry Christmas 😀

from wwvb.

micooke avatar micooke commented on July 18, 2024

You too!

from wwvb.

micooke avatar micooke commented on July 18, 2024

Just a heads up - im back on task.

Im in the process of rewriting this project to utilise the Arduino Time library, @JChristensen Timezone library.and my own PWM library. I will support wwvb at 60kHz and jjy at 40kHz and 60kHz.

Watch this space.

from wwvb.

mr-sneezy avatar mr-sneezy commented on July 18, 2024

Sounds like a man possessed :)

from wwvb.

baradhili avatar baradhili commented on July 18, 2024

whilst thats pretty cool, I'm using an esp8266 locking with NTP, a timezone shift to fake US timezones in australia and a stupidly small 60.000kHz osc from Microchip (yay samples!)

it would be great to handle different clock systems and something like the Digispark would do the job..

from wwvb.

micooke avatar micooke commented on July 18, 2024

@baradhili - what wwvb watch/clock are you using? Also what antenna?

One of the reasons to moving to Time and Timezone is that its easier (its already coded, examples are available) to use different sync methods such as ntp and gps, also daylight savings time is automatically accounted for.

The only thing that would be nice is to auto detect what timezone you are in - it would require either gps distance to the closest timezone (there are 39 worldwide), or i believe weather underground returns tz and tz offset.

from wwvb.

baradhili avatar baradhili commented on July 18, 2024

from wwvb.

micooke avatar micooke commented on July 18, 2024

Stupid booleans taking up 8bits... Having issues with my struct, but im getting close to gettting a first version working.

There is too much to change here, so ill be starting up a new library and abandoning this one.

Ill keep everyone informed of the change - but this is no longer maintained :(

from wwvb.

mr-sneezy avatar mr-sneezy commented on July 18, 2024

Mark it sounds like baradhili has a US market clock like my desk clock. If so he'll only have the US time zones available on it.

from wwvb.

mr-sneezy avatar mr-sneezy commented on July 18, 2024

"and a stupidly small 60.000kHz osc from Microchip (yay samples!)"
What's the part number of that osc ?

from wwvb.

baradhili avatar baradhili commented on July 18, 2024

from wwvb.

ntmmfts avatar ntmmfts commented on July 18, 2024

Holy crap, just found this app and it synced my Casio Lineage LCW-M170TD-7AJF on the very first try! No bullshit, it actually works. My Casio hasn't synced since it left Japan brand new a year ago - even after several trips to the mainland where it failed - and now this app, wow. Clock Wave, https://cw.rzapps.com. I will never give up on the aruino project though, not after all this effort, lol.

from wwvb.

mr-sneezy avatar mr-sneezy commented on July 18, 2024

Great yes, but it doesn't work on most of the other phones in the world (Android) and will wake me up at night when the watch expects it's next update...

from wwvb.

micooke avatar micooke commented on July 18, 2024

Okay im closing this down. It is an acknowledged bug, and should be fixed in the new wwvb_jjy library

from wwvb.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.