Author Topic: Lars DIY GPSDO with Arduino and 1ns resolution TIC  (Read 283430 times)

pbs74 and 1 Guest are viewing this topic.

Offline salomonsk8r2003

  • Contributor
  • Posts: 12
  • Country: us
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1025 on: February 25, 2022, 04:03:44 am »
Hopefully some people are still monitoring this blog!

I have fully built the minimum design but I realized my (authentic) neo-7m is not capable of putting out a 1ns pulse. The lowest it will go is 1us which is 1000ns. From what I understand, my GPS needs to be putting out a pulse of 1ns or less, correct? I saw a post where Lars said 5ns was acceptable, but somehow I doubt this extends to 1000ns.

When I try to change the TP or TP5 to .001us it automatically jumps to 0 and no pulse is sent at all. The lowest it allows really is 1us.

I have confirmed these pulses with the oscilloscope. They are consistent, I will give them that. EXACTLY 1us for as many pulses as I can detect, but I just can't get the 1ns quick pulse and it is cause then whole system to never lock.

Any of you pros out there have any advice for me? I would be very grateful  :) |O :) |O :)
 

Offline AndrewBCN

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1026 on: February 25, 2022, 05:26:42 am »
...
From what I understand, my GPS needs to be putting out a pulse of 1ns or less, correct?
...

No. There is no limitation on the 1PPS pulse duration and certainly not a 1ns limit. The 1PPS pulse put out by default by the GPS is usually 10ms or 100ms long and that works quite well. In any case it is not a critical value.

In Lars' GPSDO design, the 1ns refers to the theoretical resolution of the phase detector in the PLL (phase-locked-loop), not to the duration of the 1PPS pulse from the GPS module.

EDIT: Let me expand a little bit on Lars' "1ns theoretical resolution TIC (Time Interval Counter)".

Basically Lars' TIC translates the phase difference (in ns) between the OCXO and the 1PPS leading edges into a voltage that is read by the AVR MCU. The range of the TIC/phase detector is approximately 1000ns, and the resolution of the AVR MCU ADC (analog to digital converter) is 10 bits (0 to 1024), so basic math tells us that 1000ns/1024 is more or less 1ns.

Now this is a theoretical resolution, because in practice both the OCXO and 1PPS signals have a certain amount of jitter, so the actual resolution of Lars' TIC is much lower, my guess is on the order of 15 to 25ns depending on the OCXO and the GPS satellite reception. Also the TIC precision (different from the resolution) is on the order of a few percent due to various reasons. But the repeatability is quite good and with proper processing (averaging of measurements), it does the job.

Despite all these problematic considerations, Lars' ingenious circuit works quite well for the intended purpose (the PLL achieving a "lock"), and it requires a minimal number of low cost and easy to find components, so I personally think Lars did a great job.
« Last Edit: February 25, 2022, 05:51:27 pm by AndrewBCN »
 
The following users thanked this post: thinkfat

Offline salomonsk8r2003

  • Contributor
  • Posts: 12
  • Country: us
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1027 on: February 25, 2022, 04:11:43 pm »
Haha oh wow that makes this much easier on me, thank you Andrew! I was racking my brain for the last day trying to figure out why my pulses were "so fat" lol.

I have another question (surely won't be my last):

After leaving this setup with my calculated gain of 22 overnight, I noticed I get what seem like pretty stable/low TIC values, and then it finally locks, but when it locks the numbers change quite a bit and it only lasts for a few seconds then it loses it and says "restarted" on the right. The low and stable TICs last for a pretty long time, but then that lock hits and everything changes. This cycle repeated many times throughout the night.

Admittedly, I need to spend a little more time combing through Lars' PDFs again. Oh, and I should mention that the diode I am using is not the same one (ordered them, will be here next week), so I am using a 1N4148 in the meantime. Might be causing problems.

I am not as savvy with this subject as you all seem to be. This is my first GPSDO, and my first time really working with timing and references and all of this is a learning experience for me. I'm not an engineer or anything, just a hobbyist. I say that just to say anything you say will not hurt my feelings or offend my intelligence or anything, so hammer away with any advice you can give! I do know how to use my scope though, so if you need me to probe any points and see what is happening just let me know.

Thank you!!!

 

Offline AndrewBCN

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1028 on: February 25, 2022, 05:21:28 pm »
Haha oh wow that makes this much easier on me, thank you Andrew! I was racking my brain for the last day trying to figure out why my pulses were "so fat" lol.
No problem. GPSDO concepts are not easy to grasp, it took me more than 6 months to get a basic understanding of how it all works.
I have another question (surely won't be my last):
Ask away! That's the reason this forum exists.
After leaving this setup with my calculated gain of 22 overnight, I noticed I get what seem like pretty stable/low TIC values, and then it finally locks, but when it locks the numbers change quite a bit and it only lasts for a few seconds then it loses it and says "restarted" on the right. The low and stable TICs last for a pretty long time, but then that lock hits and everything changes. This cycle repeated many times throughout the night.

Admittedly, I need to spend a little more time combing through Lars' PDFs again. Oh, and I should mention that the diode I am using is not the same one (ordered them, will be here next week), so I am using a 1N4148 in the meantime. Might be causing problems.
I have no idea what exactly could be causing this problem, but indeed the 1N4148 is quite different from the recommended Schottky diode. After you change it, do tell if it makes any difference.
I am not as savvy with this subject as you all seem to be. This is my first GPSDO, and my first time really working with timing and references and all of this is a learning experience for me. I'm not an engineer or anything, just a hobbyist. I say that just to say anything you say will not hurt my feelings or offend my intelligence or anything, so hammer away with any advice you can give! I do know how to use my scope though, so if you need me to probe any points and see what is happening just let me know.

Thank you!!!

Don't worry, this is a learning experience for me too!  8)
 

Offline salomonsk8r2003

  • Contributor
  • Posts: 12
  • Country: us
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1029 on: February 25, 2022, 06:57:34 pm »
Ask away! That's the reason this forum exists.

Sounds like a plan to me!!!

Btw, right after I posted last I suddenly got a lock that seems stable! It's been locked for about an hour now so I am very excited! My 1N4148 must be better than the 1N5817 I had in yesterday. Looking forward to my 1N5711's to arrive.

So I do have a couple more questions before I go power through Lars' .pdf more thoroughly:

1. Now that I have a lock, this means that the 10Mhz coming out of my oscillator should be pretty dang accurate now, right? I ask because my scope still reads the same 9.99995 Mhz that it did without disciplining the oscillator. (screenshot attached). Does this mean my scope is reading a bit low? That 10Mhz is coming out of the "10M" pin on my OXCO board.

2. I would like to see if I am understanding the precision and accuracy concept correctly:

ppm literally means parts per million. So if I had a perfect 1Mhz signal, that is 1 million hertz. If my scope read ".999999 Mhz" then that would mean it was reading 1ppm low, because out of the million hertz it is reading one less than it should. Assuming that is correct, if I had a perfect 10Mhz signal and the scope read "9.999999 Mhz" then it is still 1 hertz low, however now it is TEN million hertz instead of one million, so I would divide that single "missing hertz" it by 10 and say it is now "0.1ppm low" (or 100ppb low). Is that correct?

So, if my scope had a perfect 10Mhz signal but it read "9.999950 Mhz" (my scope isn't as precise as the example above requires), then it means it is reading 50 hertz low @ 10 Mhz, or stated in ppm it would be reading 5ppm low (or 5000ppb low?).

Am I on the right track or is there a gap in my understanding? I am a CS major so we don't really work with this sort of thing in school much haha.

I also put a couple pics of my setup to give you an idea of what I'm working with. If you see anything glaringly wrong lmk lol.


(Angry side note...)
NOOOOOO! I MOVED THE SETUP LESS THAN AN INCH TO TAKE A PICTURE AND I LOST MY LOCK LOL DANGET!!!! Clearly the breadboard and wires are not very well connected lol. Maybe it's time to move this to some perf board with solder lol. What a bummer!  :-//
 

Offline AndrewBCN

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1030 on: February 25, 2022, 07:12:07 pm »
A few comments:
1) You have a very nice and clean workspace. I wish I had the same!

2) Yes, in principle if you have a lock then your OCXO is at 10MHz +/- 0.01Hz or so.

3) Any DSO is much less accurate than a GPSDO. So yes, indeed it is measuring low.

4) Resolution is how many digits your measurement instrument can resolve. Accuracy is the difference between what is measured and what should be measured with a "perfect" instrument.

Taking the example of a ruler: if the smallest hash marks it has are 1/16" apart, then that's that ruler's resolution. Now if you measure for example a piece of metal that you know for sure is exactly 10" long, but your ruler says it's 10.5" long, then your ruler's accuracy is only 5%.

Also: since it seems you have a 4-channel DSO, I would suggest you measure on each channel:

1) 1PPS leading edge (trigger)
2) Leading edge of the output of the 74HC390 divider that is fed to the TIC
3) OCXO 10 MHz output.
4) And most importantly: the TIC output (that goes to the MCU ADC input)

This will really show you how Lars' GPSDO works.
« Last Edit: February 25, 2022, 07:19:35 pm by AndrewBCN »
 

Offline salomonsk8r2003

  • Contributor
  • Posts: 12
  • Country: us
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1031 on: February 25, 2022, 07:53:51 pm »
Excellent comments, thank you!

And haha, I was thinking how messy it currently was with all my diode kits laying all over. Messy enough that I almost didn't upload the photo lol. I'm a bit of a clean freak around the house though. Just wanted to show my 'wider view' of the bench to give you an idea of what I do or don't have to work with. Like the 4-chan scope! Great recommendation! I will definitely set up the other three probes. I've always seen people have multiple signals up at once but whenever I do it it only seems to focus on one signal and the rest become a blur. I only got the scope 3 or 4 months ago and it's my first, so I am slowly learning. I imagine I need to change the trigger settings on a per-channel basis? Haven't had a chance to play with that but might as well do it now.

Good to know that all DSO's are a bit off like that. I am guessing there is some oscillator in there (maybe an OCXO?) that is used as the reference for it's measurements. Can I GPS discipline that to make the scope more accurate? Not that I want to crack that thing open while it's under warranty lol, but just out of curiosity.

Anyways, thank you again for the tips! I have to go do my real job for a bit now, but hopefully tonight or tomorrow I will be able to hook those four probes up and really see the beauty of this thing in action! I might move it from the breadboard to a more stable, soldered board with sockets for the chips or something first. I had such a great lock there but if I so much as breath on a wire wrong it loses its mind lol.
 

Offline AndrewBCN

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1032 on: February 25, 2022, 11:14:45 pm »
...
Good to know that all DSO's are a bit off like that. I am guessing there is some oscillator in there (maybe an OCXO?) that is used as the reference for it's measurements.

Yes, there are a number of crystal oscillators inside every DSO, but no DSO that I know of uses an OCXO, most inexpensive ones use a simple quartz and possibly the more expensive ones use a TCXO.

Can I GPS discipline that to make the scope more accurate? Not that I want to crack that thing open while it's under warranty lol, but just out of curiosity.
Not that I know of.
Anyways, thank you again for the tips! I have to go do my real job for a bit now, but hopefully tonight or tomorrow I will be able to hook those four probes up and really see the beauty of this thing in action! I might move it from the breadboard to a more stable, soldered board with sockets for the chips or something first. I had such a great lock there but if I so much as breath on a wire wrong it loses its mind lol.

Just for experimenting a breadboard is good enough in my experience, but if you want this kind of assembly to last a little longer then it's a good idea to solder some components onto a perforated board or a proper PCB.
 

Offline thinkfat

  • Supporter
  • ****
  • Posts: 2152
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1033 on: February 26, 2022, 10:43:33 am »
Some mid-range DSO have an input for an external reference clock. If you have one of these, you can connect them to your GPSDO.
Everybody likes gadgets. Until they try to make them.
 

Offline 2N3055

  • Super Contributor
  • ***
  • Posts: 6738
  • Country: hr
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1034 on: February 26, 2022, 02:18:27 pm »
Pretty much anything that is not rubidium oscillator (or better) is worse than GPSDO.

Fact that scope that new costs less than decent OCXO has less frequency accuracy than said OCXO should not be a surprise.

Scopes use TCXO, in different grades. TCXO cover wide specifications range and come in ppm and ppb grades.
Scopes that have few ppm accuracy across whole temperature range have darn good clock sources...
For a scope, that is.
And it is more than enough for absolute accuracy and orders of magnitude better than old CRT scopes had with timebase specified in percents, not ppm or ppb... 
Scope is not exactly the frequency analyzer.
Scope timebase should have a good low term stability (low jitter, low phase noise).

Scope measurements of relative timing of events are different story though. They can be extremely precise and accurate.
Most modern scopes interpolate trigger point into picosecond range and can resolve much shorter time periods than sampling rate of ADC, with good accuracy and precision.

two pulses at 1PPS, 50ns wide, 277ns apart... measured with 8,9ps RMS noise...
And that includes all source errors...
On a scope with just good TCXO.

 
The following users thanked this post: AndrewBCN

Offline salomonsk8r2003

  • Contributor
  • Posts: 12
  • Country: us
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1035 on: March 06, 2022, 10:05:47 pm »
2N3055, thank you for the info, that is all very good to know. Your scope looks very nice too, such a pretty looking interface there!

Some mid-range DSO have an input for an external reference clock. If you have one of these, you can connect them to your GPSDO.

Dang, mine doesn't seem to have one. I have the 1104X-E but unlocked to be 200Mhz (as if I need that haha), and it seems I'm stuck with the internal reference. Based on what 2N3055 said though I shouldn't have any issue with that.

Also: since it seems you have a 4-channel DSO, I would suggest you measure on each channel:

1) 1PPS leading edge (trigger)
2) Leading edge of the output of the 74HC390 divider that is fed to the TIC
3) OCXO 10 MHz output.
4) And most importantly: the TIC output (that goes to the MCU ADC input)

This will really show you how Lars' GPSDO works.

Alright, I finally got it all set up! I had a medical procedure last week which glued me to the couch so I had to take a week off this project, but I am back now!

Also, I got my diodes (1N5711) and results seem to be basically the same, but at least I have the recommended piece now.

SO, I have my four probes hooked up the way you recommended. Here is the way they are arranged on the screen:

Blue:    10Mhz (obviously haha)
Yellow: 1pps from GPS (trigger)
Green: Pulse out from HV4046 Pin 15 (hooked up right after diode, before resistor so it was easier to see on the screen. Is that ok?)
Purple: 1Mhz out from HC390 pin 7

That was super helpful for me to see what was really happening! So my understanding now is that the 1pps from the GPS sets the HC4046 high on pin 14, then as soon as the 1Mhz hits pin 3 it drops it back down. That cycle determines the TIC pulse width of the pulse going to the ADC (A0) on the Pro Mini.



Here are a couple questions that I now have:

    1. I THINK that the TIC pulse width stability indicates whether or not the 1PPS and 1Mhz are synced, and the Pro Mini is using that TIC pulse width CHANGE to determine the DAC value to send to the VCO to make them synchronized... so if the width stops varying then it means they are synced and if it keeps changing then the VCO voltage is slightly adjusted till it stops changing... is that correct?

    2. Take a look at the falling edge of my green line (the TIC to the ADC). Does it fall off slowly like that because of the 1nf cap? If so, is that a reasonable looking falling edge there or should I try a different capacitor?

    3. I asked this one before and you weren't sure, but I was hoping that now that I have the correct diode and better screenshots that you might have a better idea: My setup seems to stabilize well, and the TIC values get down to like <20ns for a couple cycles, then it locks, and immediately the "pre-filter" changes from 1 to 16 and everything goes haywire and it loses its lock. This keeps repeating. As soon as that lock is lost (couple seconds), the filter changes from 16 back to 1 and within a few seconds my TIC values are back to <40ns, and eventually back to <20ns. What is that 1 and 16 filter value and why does it change? It seems to be the reason I can't maintain a lock for more than 10 seconds. In the time it has taken me to type this post, the locked/unlocked cycle has repeated probably 10 times. What is that pre-filter? I read Lars' pdf but I don't fully understand some of the more advanced parts.

    4. I attached some GPS signal screenshots. I have an active antenna hanging in my window on the blinds. Are these GPS signal strength strong enough? Sometimes I get only 2 or 3 above 30dB, but have a ton in the high 20's. Is that sufficient?


As always, thank you so much for your help. This is a really fun project. It is absolutely unnecessary for me to have this level of accuracy for the work I do (fixing vintage audio equipment) but it is such a fun side-project that I just can't stop! I want a super accurate reference just for the pleasure of having it lol.


P.S. That was so cool hooking up all four probes and actually getting the trigger setup to capture all four like this. I tried this in the past (only had a scope for a couple months now) and couldn't get it. I'm glad I gave it another shot here because I feel like my scope skills doubled just from this little "exercise" you gave me. So thank you for that.

P.P.S. I got a couple NEO-8M modules for a decent deal. I will swap for one of them once I get the 7M working and see if there is much difference.
« Last Edit: March 06, 2022, 10:08:34 pm by salomonsk8r2003 »
 

Offline AndrewBCN

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1036 on: March 06, 2022, 10:42:22 pm »
...
Green: Pulse out from HV4046 Pin 15 (hooked up right after diode, before resistor so it was easier to see on the screen. Is that ok?)
...

Thank you, this is a very, very good setup, except for one little thing: the scope probe for the pulse out from 74HC4046 (your Green channel) should be hooked after the resistor (where it connects to the capacitor), not before. This is because we want to observe how the capacitor charges, and the voltage measured by the MCU ADC.
 

Offline salomonsk8r2003

  • Contributor
  • Posts: 12
  • Country: us
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1037 on: March 06, 2022, 11:05:32 pm »
Andrew,

Here is what it looks like after moving that probe. I put the probe basically right by the arduino A0 so we can see it right as it's going into the ADC. I had to adjust the voltage scale for that channel just to see it. Looks pretty crazy... is it supposed to look like that? If I zoom out far enough (second screenshot) on the horizontal/time scale I can see the rising edge. I imagine this weird view (first view) is due to my lack of knowledge with the scope.

I'm actually very confused about something else now too... When I set the time division to 20ms I can see the 1Mhz and 10Mhz waveforms nicely. Then if I zoom that time division in I start to lose them, but if I keep zooming and zooming and zooming all the way to like 100ns division, I can suddenly see all the 1Mhz and 10Mhz again! Only the green TIC trace looks way different. Is the scope like automatically adjusting the time division for each channel or something? Or am I seeing some weird harmonic frequencies when I zoom way in?

EDIT:  I think I was seeing harmonics cause when I zoomed out the "10Mhz" was showing as like 40Hz. I set up the measure function to show the frequency of all four channels to make sure I was zoomed to the correct level. Attached is a screenshot at 200ns timescale. Can you see how my green trace barely rises there and then doesn't really fall much? Is that how that green trace should look? I kept the vertical division at 5v to match the other three channels. I mean, I get a lock and all, it just immediately drops as soon as the 1 changes to a 16.

EDIT 2: Well, I just decided to randomly change the time constant from 32 to 16 and the pre-filter from whatever the default is to 4... It locked right away and seems to be staying locked now. It was a random adjustment, I don't actually understand what I did. Any ideas why this fixed the "pre-filter change lock breaking issue" that I was experiencing?
« Last Edit: March 06, 2022, 11:33:49 pm by salomonsk8r2003 »
 

Offline thinkfat

  • Supporter
  • ****
  • Posts: 2152
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1038 on: March 07, 2022, 07:23:47 am »
The green trace looks very noise at first glance, but for most of the time it is not relevant because the ADC is not sampling. It only samples just right after the rising edge of the 1MHz trace. Absolute value then represents the time between the rising edge of the 1PPS pulse and the next rising edge of the 1MHz clock derived from the LO. The control software steers this towards 1µs, if I'm not mistaken (it's a configurable value).

There was a modification around that connects A0 to another GPIO that would then actively discharge that capacitor of the time-to-voltage converter, but I think it brought no relevant improvement.

The pre-filter is an exponential moving-average (EMA) digital filter with a variable time constant. When lock is achieved, the time constant is increased to smooth out the phase difference over a longer period of time. The merit of this is doubtful, increasing the integration time of the PI loop would be equivalent. Anyway, what this filter does is slow down the regulation. If the GPSDO then "breaks out of lock" it just means the regulator is now too slow to compensate the drift of the LO.

Usually, this is a problem with the stability of the LO. The OCXOs we have commonly access to, we don't know about their service life and how they were handled (or abused). When powered up after a long period out of service, they might take a while to "find their bearing". You should just give it some time. Keep the device powered, observe what it does, especially temperature changes. Realize that completing the circuit is not the end, it's the beginning of a long journey of tinkering and optimizing.
Everybody likes gadgets. Until they try to make them.
 

Offline AndrewBCN

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1039 on: March 07, 2022, 01:56:58 pm »
Andrew,
Here is what it looks like after moving that probe. I put the probe basically right by the arduino A0 so we can see it right as it's going into the ADC. I had to adjust the voltage scale for that channel just to see it.
...
Well done  :-+ , but there is just one more thing that you would need to adjust again, and please share with us another scope capture of what you'll get:
- The green trace now shows the voltage at the Arduino A0 pin. This voltage rises from zero to a maximum of 1.1V, so you should adjust that channel for 1V/division vertical.
- In the previous scope captures, the 3rd one is the one that is relevant: you can see the capacitor charging. So that's the one with the correct horizontal (timebase) setting, 200ns/division and zoomed in at the right place.

About the noise on the green trace: that, unfortunately, is one of the shortcomings of Lars' design. Lars' software deals with it with a smoothing algorithm (as thinkfat explained), but indeed it doesn't look very good on a scope capture. But it doesn't matter: we can still see the charging of the capacitor, and that's what we want.
 

Offline thinkfat

  • Supporter
  • ****
  • Posts: 2152
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1040 on: March 07, 2022, 02:33:53 pm »
If you look at the frequency of the noise on A0, it's really quite high, looks like a good deal above 10 MHz. You can see it drop significantly in amplitude once the sampling capacitor inside the STM32 is connected to the input, and then increase again when the sampling period is over.

It is not inherent to Lars' design though. I suspect that the typical makeshift build-up on a breadboard, with wires flying everywhere and no special care taken about decoupling and signal returns, is mostly responsible. I believe you could reduce it significantly if you provided better filtering for the OCXO supply, better decoupling for the digital components and a cleaner build.
Everybody likes gadgets. Until they try to make them.
 

Offline salomonsk8r2003

  • Contributor
  • Posts: 12
  • Country: us
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1041 on: March 07, 2022, 07:24:24 pm »
Have I mentioned yet how awesome you guys are? Thanks for the replies  :)

You should just give it some time. Keep the device powered, observe what it does, especially temperature changes. Realize that completing the circuit is not the end, it's the beginning of a long journey of tinkering and optimizing.

I have had the OCXO plugged in and hot for a week or two, but I haven't actually measured its temperature or anything. I've also moved and rearranged the breadboard and probes a lot so I probably have messed with its stability a bit. You are definitely right about the circuit only being the first step. I am definitely enjoying the tinkering though. I'm getting better with the scope, with oscillators in general and soon (tomorrow maybe) I will be drafting up a simple PCB in Diptrace and using the magazine paper laser printer trick which I used years ago and am excited to try again.

I suspect that the typical makeshift build-up on a breadboard, with wires flying everywhere and no special care taken about decoupling and signal returns, is mostly responsible. I believe you could reduce it significantly if you provided better filtering for the OCXO supply, better decoupling for the digital components and a cleaner build.

Definitely lots of wires! My first setup was using the standard, cheap, crappy little thin jumper wires that you get on eBay, but it was so sensitive that if I so much as looked at it wrong it lost it's mind. So I yanked it all out and used these much nicer solid core copper wires that are much thicker gauge  and shorter too. (picture attached). It got much more stable after that. But now I have scope probes flying all over, probably also interfering a bit just by nature of taking measurements in general. Looking forward to the PCB. I am going to put some test points in it to to make probe setup simpler.

About the noise on the green trace: that, unfortunately, is one of the shortcomings of Lars' design. Lars' software deals with it with a smoothing algorithm (as thinkfat explained), but indeed it doesn't look very good on a scope capture.

I had actually adjusted that green trace to 1 volt division right after making my last post. Now I went and change that probe from 10x to 1x and it looks significantly better. I even added some fancy new labels to my traces. Feelin like a pro now!  8) lol


So, all that said, I guess I'm not sure where to go from here... I seem to have a pretty solid lock (about a day now with no drops), but it's only cause I changed my time constant to 16, which if I read the .pdf correctly means I am getting much lower accuracy, right? I've never used TimeLab or ADEV/MDEV or any of this stuff before. Would you guys recommend I shift gears to that now? Now that I have at least gotten a lock with a 16 second time constant? Or do you think there is something else I should tinker with first? I noticed the .pdf mentions that an oscillator with a lot of "jumps" means the TC will need to be lower. Do I use TimeLab and do this ADEV analysis stuff to see if I have "jumps"?


EDIT: I forgot all the attachments.

On a side note, check out the signal strength on the new NEO-M8N units I got. That's just the default little puck antenna stuck to the PCB too, dangling in my window blinds. Not bad!
« Last Edit: March 07, 2022, 07:41:22 pm by salomonsk8r2003 »
 

Offline AndrewBCN

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1042 on: March 07, 2022, 08:14:20 pm »
Excellent!  :-+
So now, please allow me to comment on your latest scope capture.
From top to bottom:
1. The 10MHz squarewave from the OCXO.
2. The 1PPS pulse from the GPSDO.
3. The charging of the TIC capacitor. Note that the capacitor gets charged almost linearly, and the charging starts at the rising edge of the 1PPS pulse and stops at the rising edge of the 1MHz clock.
4. The 1MHz, which is in fact the 10MHz from the OCXO divided by 10.

Lars' program reads the voltage across the capacitor once per second, just after the capacitor gets charged. This voltage, as the scope capture shows, is proportional to the phase difference between the rising edges of the 1PPS from the Neo-M8 GPS module and the 1MHz from the (OCXO + 74HC390).

If we keep that phase difference constant and we know that we have counted exactly 10,000,000 clock cycles between two 1PPS pulses, then the GPSDO will have stabilized the OCXO frequency at exactly 10MHz, +/- the jitter/accuracy of our entire circuit (1ppb (0.01Hz) or so).

I am going to suggest one last addition to your scope capture and you might learn something new: could you please add two vertical lines ("cursors"), one at the rising edge of the 1PPS and a second one at the rising edge of the 1MHz clock? This will make obvious how the capacitor charges. Also you can even decrease the setting of the green channel to 0.5V/division, so we can "eyeball" the voltage across the capacitor.
« Last Edit: March 27, 2022, 11:02:24 am by AndrewBCN »
 

Offline salomonsk8r2003

  • Contributor
  • Posts: 12
  • Country: us
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1043 on: March 07, 2022, 08:41:45 pm »
Excellent! The more additions the better!

I went ahead and added a Y cursor too to make the cap voltage easier to see, changed it to 500mv division, and zoomed the time scale in a notch as well. Looks like it is smack dab in the middle of the 1.1v maximum, coming in at 550mv. Is this related to the fact that my DAC values are right around the middle too, coming in around 31000?

My time cursor from the rising edge of the 1PPS to the rising edge of the 1Mhz is about 500ns (keeps moving around though, just a tad). That is half the length of the PPS signal too. I'm thinking that's just a coincidence though, since the 1PPS pulse length seems to be somewhat arbitrary.

Those are just my guesses as to what these values mean. I'm excited to see what they actually mean now, especially how these scope readings relate to the serial printed information from the Pro Mini.

EDIT: Small correction to my setup; my TC is at 28, not 16. And prefilter is at 7.
« Last Edit: March 07, 2022, 08:44:33 pm by salomonsk8r2003 »
 
The following users thanked this post: mycroft, AndrewBCN

Offline thinkfat

  • Supporter
  • ****
  • Posts: 2152
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1044 on: March 07, 2022, 09:00:09 pm »
The ADC input voltage being in the middle of the input range is good. This is where the control loop is steering it to, because supposedly this is the most linear region of the ADC. The DAC output being in the middle of the range is just a coincidence, it only depends on the OCXO. You can take it as a measure of how much the OCXO has aged. It seems your OCXO has quite some life left in it.

An OCXO to "retrace" its aging curve after being switched on after long downtime can take months.

Don't spend time on TimeLab yet. Just record the debug output, make some graphs. This will help you understand the system behavior better.

Back to the noise on the A0 pin. It is obviously correlated with the 10MHz. I suggest you add some ceramic caps to the supply pins of your divider and phase comparator ICs. 100nF MLCCs on short leads from supply to ground should reduce the 10MHz noise significantly.
Everybody likes gadgets. Until they try to make them.
 

Offline salomonsk8r2003

  • Contributor
  • Posts: 12
  • Country: us
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1045 on: March 07, 2022, 09:13:48 pm »
The ADC input voltage being in the middle of the input range is good. This is where the control loop is steering it to, because supposedly this is the most linear region of the ADC. The DAC output being in the middle of the range is just a coincidence, it only depends on the OCXO. You can take it as a measure of how much the OCXO has aged. It seems your OCXO has quite some life left in it.

That is good! Looks like I got a reasonable OCXO then. It was an ebay purchase, complete in an IC with power regulator and what not. Cost like $20 or so.

An OCXO to "retrace" its aging curve after being switched on after long downtime can take months.

wow.. looks like it will be a while for that test then lol. I will do my best to keep it warm and running 24/7.

Back to the noise on the A0 pin. It is obviously correlated with the 10MHz. I suggest you add some ceramic caps to the supply pins of your divider and phase comparator ICs. 100nF MLCCs on short leads from supply to ground should reduce the 10MHz noise significantly.

Is this the same as the caps that the "Minimum working schematic for GPSDO controller" jpg image from Lars had? If so, I do already have 100nf caps between VCC and Ground at the inputs for pin 16 on the HC390, and on pins 5 & 16 on the HC4046. If you look at my picture in the earlier post you can see the type of caps I used. Does this look correct? Or should I change them up?
 

Offline AndrewBCN

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1046 on: March 07, 2022, 10:32:22 pm »
@salomonsk8r2003

Your last scope capture summarizes in a single image exactly how Lars' GPSDO works. It's just amazingly good. Thank you.  :-+

It also shows how a DSO can be used at its best to analyze the workings of a relatively hard to understand circuit.

I hope it all makes sense to you, and I would suggest if you want to gain some further understanding of Lars' GPSDO, that you spend some time reading Lars' code.

You can find Lars' original code here: https://github.com/AndrewBCN/Lars-DIY-GPSDO/tree/main/Software

And my refactored version (warning: WIP) here: https://github.com/AndrewBCN/Lars-DIY-GPSDO/tree/main/Software/lars_gpsdo_AndrewBCN_refactored

Oh, one last thing: Lars' PDF has hints about using TimeLab with his GPSDO to generate some nice plots. The PDF is also in the same GitHub repository, here: https://github.com/AndrewBCN/Lars-DIY-GPSDO

EDIT:

One more thing that I just noticed: it appears the 1PPS pulse length for your Neo-M8 GPS module is still set at 1µs, you can change that back to its default value (100ms if I remember correctly).
« Last Edit: March 27, 2022, 11:04:59 am by AndrewBCN »
 

Offline KA8BRK

  • Newbie
  • Posts: 7
  • Country: us
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1047 on: March 17, 2022, 04:52:32 pm »

I built a GPSDO based on the Lars minimum circuit and Arduino program.  NEO-7M, CTI OCXO, HC390, HC4046, Arduino Nano.
Close to minimum working schematic but multiple 7805's 78L05's to isolate power.  After much fiddling, it minimally works.
Lots of weirdness.  If I load the "...30_170801.ino' sketch it will start, if there is no PPS , it just sets there with only the header.
Never says, "No PPS'.  When I connect PPS then it may run for a few seconds (5 to 100 or so) and then restart. 
If I load Paul's sketch that includes LCD, It will run, complete 'warm up' and then get 'lock' about 60 to 400 seconds after 'warm up'.
It may stay locked for anywhere from a few to 1000's of seconds and then reboot.  Additionally, sometimes it will stop
serial printing the averages, usually after 10000 seconds or more.  The gain is about 50, but it will lock at 12 up to 500 or more.
When it is locked, it appears very stable at 25 Mhz (5th harmonic of 5 Mhz) using my Icom 706MKII as a receiver.
 
I have tried three different Nano's, similar problems with all.  I also tried to use an Uno, but for some reason, after a short period,
the A0 input goes to around +5 volts, even when disconnected from the TIC circuit.  When that happens the DAC out goes way off.
Are all of my Nano's and the Uno I tried bad?
Is the Nano not suitable for this purpose?
Is there something special about the Nano, that I don't understand?
Has anyone else had this weirdness?
Is there a sketch that will test the hardware functionality of an Arduino? 

Ding, KA8BRK
 

Offline salomonsk8r2003

  • Contributor
  • Posts: 12
  • Country: us
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1048 on: March 17, 2022, 06:02:12 pm »
I have tried three different Nano's, similar problems with all.

Lars' design calls for a Pro Mini, not a Nano. I use a Pro Mini and don't have any of these issues, but I will say when googling things throughout the process I constantly kept searching "nano" on accident and it kept messing me up. I had bad drivers a few times because of it, kept getting weird pinouts, etc.

Your last scope capture summarizes in a single image exactly how Lars' GPSDO works. It's just amazingly good. Thank you.  :-+

Thank you! All I did was follow your setup advice!

Sorry for the radio silence here, I had to go back to working in the office so I have not had much fun time at home on the GPSDO.

I should have a little more time to play with it over the next month now. I am starting by making a little home-made PCB to get it off the breadboard and to refresh my PCB etching skills (or lack thereof). After that I will dive into TimeLab and start learning how all that works!

On a side note, my breadboard version seems to have been reliably locked on for the last 8 days, so things are looking good for the migration to the PCB! I am going to include test-points pins on the PCB to make scope captures easier too. More of a development PCB for learning the ins-and-outs of this beauty.
 

Offline AndrewBCN

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Lars DIY GPSDO with Arduino and 1ns resolution TIC
« Reply #1049 on: March 17, 2022, 06:29:39 pm »
...
Your last scope capture summarizes in a single image exactly how Lars' GPSDO works. It's just amazingly good. Thank you.  :-+

Thank you! All I did was follow your setup advice!

Sorry for the radio silence here, I had to go back to working in the office so I have not had much fun time at home on the GPSDO.

I should have a little more time to play with it over the next month now. I am starting by making a little home-made PCB to get it off the breadboard and to refresh my PCB etching skills (or lack thereof). After that I will dive into TimeLab and start learning how all that works!

On a side note, my breadboard version seems to have been reliably locked on for the last 8 days, so things are looking good for the migration to the PCB! I am going to include test-points pins on the PCB to make scope captures easier too. More of a development PCB for learning the ins-and-outs of this beauty.

The test points on the PCB are a really good idea.  :-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf