GPSDO YT 10 Mhz Lcd 2x16 With LED, UTC Time and GPS Localisation.




Introduction: GPSDO YT 10 Mhz Lcd 2x16 With LED, UTC Time and GPS Localisation.

About: Hi, i'm electronic technician but it's my hobby too. I like to do and try many projects just for fun :)

January 18 2022 , Last version is 1.57 Available at step 11

Hi guys,

What is a GPSDO ? GPSDO means: GPS disciplined oscillator. GPS for global positioning system. All GPS satellites are equipped with synchronized atomic clock. GPS module receives these signals from several satellites. And by triangulation, it knows his location. But here, what interests us is the pulse per second that is found on the module. With this precise pulse (from atomic clock), we can do a very very accurate oscillator. What for ? For reference, for calibration of frequency counter or just for fun to have one in his lab.

For more explanation on how calibration is working. Go to my first instructable just here:

So i did a frequency generator of 10.000000000 Mhz +- 0.000000001 Mhz or 1ppb on 10Mhz

PS: I had some questions about how i know that the speed is accurate. The answer is quite simple. If you read 10,000,000.000 it's because you have 10,000,000.000 Mhz It's 10 billion count on 1000 seconds. It's a frequency counter AND a gpsdo at same time. If you have different result, probably your reference (pps) isn't accurate. Not enough satellite, weak signal. Can be power supply problem too. OCXO itself take 600ma.

That's said, the accuracy of this device is 10mhz + or - 0.001hz OR +-1x10e-10

Let's begin

Step 1: Here Is the Schematic

I improved schematic. I added a pot for the 12v version. Like that almost any 7404 or 7414 are working.

And i added LED support. Optional as well.

Basic projet could be only the uC atmega without LCD and LED. Or only LED without LCD. Output will be the same. But add some monitoring device is more fun :)

Also, like you will see on step 24. I have now added a serial output for monitoring if you do not have a display.

You can download original schematic by clicking on it. And clicking on the arrow at bottom left (download original).

Step 2: Some Parts You Will Need: GPS Module

GPS module. You can buy a cheap one.... any will do but now, by experience, you can have better result with a m8n for this reason: Number of satellite.

Attention: Ublox neo 6m can receive US satellite only. Neo m8n can receive US and Russia, and have more satellite.

You see an exemple here at 3:22

More you have satellite, more accurate is the pulse. At the beginning i thought that just with 3 or 4 was ok. Yes it's working and we have a pulse. But this one is not as precise.

I have 2 gpsdo. One with simple ocxo on neo 6m and another with a double on neo m8n.

My simple ocxo was a bit less accurate of my double. Worst result i saw was 9.985 And I did a test.

I used the m8n pulse for my simple ocxo gpsdo. Problem disappeared.

If we read on wikipedia here, Error sources and analysis, we can see, gps can have error.

If you have some difficulties with the result, gps module and antenna is probably the problem.

You will need to find where is the pulse is. When a led is on the device. Best thing to do is to put a wire from the led to the 7404 input. Or now on eBay i saw some available with on board GPS pulse output.

You need to configure the module to have to have 1 pps (pulse per second) when gps is locked (3-4 sat or more) and 0 pps when antenna or signal is missing.

If you buy a ublox neo 6m. It's by default.

Interesting information:

On a ublox m8n, you can choose an output of 10mhz. So why doing a gpsdo when i could have 10mhz directly of a gps module ? It's because ublox module is using speed of 48 Mhz and this is creating jitter at the output. 48Mhz isn't dividable by 10. This is an exemple at 1 Mhz. At 10 Mhz it's worst and very ugly.

Yellow is a 10mhz reference gpsdo divided by 10. Trigger is channal 1 (yellow). Blue is the timepulse output 1mhz 50% duty of a ublox m8n. As you can read in Timing Consideration book page 10-11, it's because Ublox is using a speed of 48 mhz. And this one isn't dividing by 10. So, at the end the software is doing a correction.

In addition, after some test and experience with pll gpsdo, the pll was sticking on a moving waveform. Resulting by a moving instant frequency. It wasn't too bad when the reference frequency was at 10 Khz but it was easy visible.

In other word, waveform was moving back and forth a bit. And this wasn't just the ublox jitter problem. It's the pll itself doing his correction to keep the right frequency. But it was always following the reference. So in average, on long term, pll gpsdo is very accurate. But if we measure the instant frequency, this one can be higher or lower a bit.

It was also slower to have a sticky waveform. I have finally choose to do an over time uC pwm gpsdo instead.

Another way would have been to make a pll gpsdo and add a uC but only as a frequency counter.

Step 3: OCXO

Oscillator OCXO. Simple or double, 5v or 12, sine or square will do.

On my side i tried the Isotemp square 5v et the C-Mac sinewave 12v and both are working fine.

OCXO take around 600ma alone. So be sure to have a good power supply (transformer).

Also, keep in mind that the pwm output is doing dc from 0 to 5v. If you have a 12v OCXO, maybe the vfc needed will be higher than 5v. In this case, an op-amp can be use to match the pwm output to the correct vfc voltage.

Step 4: LCD 2x16

LCD is optional. If you install one. Only pin 1 to 14 is needed. For pin 15 and 16 (backlight),I installed a diode and wire exactly like picture. This one dim the backlight a bit. You can also connect pin 15 directly on Vcc without any problem but double check on back near pin 15 if a resistor is already installed on your lcd.

Step 5: Those for Gps Module

This cable is:

High Frequency Coaxial Connective Cable Cord RP-SMA Female Connector IPX

and antenna:

28dB LNA Gain 1575.42MHz RP-SMA Male GPS Active Antenna Stronger Signal

Exemple here on and here

I do not recommend to use the little antenna provided with the gps module.

Step 6: PCB

For PCB i used the toner transfer method. Not perfect but ok for this project. I'll give you PCB to print at next step.

Step 7:

Here is the file you will need to do the PCB. Top one is mirror for toner transfer method. I also added the gerber files if you want to use a professional way.


Step 8: Check Voltage

Before to add atmega and 7404, voltage must be checked.

I know my heat-sink is HUGE but i'm using what i have :) An old pc heatsink

You don't need to install both connectors to program the atmega. Choose 6 or 10 pins. It depend of your programmer.

Step 9: LED Board

I did a board for the LED. At the end i glued the transistors on the metal box.

I'll give you pcb file on next step.

I suggest these flat cable. If by mistake you plug the cable upside down, no worry. everything will be fine. Just no LED will turn on. That's all.

Why do I use transistor instead direct connection ? Yes the uC can support those LEDs. But the output current was disturbing the PWM (DC output for vfc). That way, the most of the current is provided by the transistor collector.

Step 10: LED Board Files

The files for the little board

Step 11: Program Your ATMEGA and Below Here Is the .HEX File and Now, Source Code.

This is an easy part but a lot of poeple fear or hate to program a uC. I'll try to do it simple.

You need an Atmega328p and the .hex file below. You must also choose the right fuses bits.(E0 D9 FF)

Those fuse bits are programmed automatically on USBasp and tiny. no worry.

They are many way to do that:


-USBasp (see next step)

-USBtiny (see next step)

-Arduino to program another atmega328p (search on internet, many how to availble)

Myself, i'm using a stk500 with ISP directly in Atmel studio. You can use any other method. A lot of cheap programmer are available on ebay. Next step show an ease alternative.

You must choose the right fuse bit. Here is Picture of stk500 fuses bits. (E0 D9 FF)

-Be sure that external oscillator is selected and the low.ckdiv8 clock is unchecked. See picture. Pay attention, when the external clock fuses bit, you must provide an external clock to program or run the code. In other words, connect the Oscillator in xtal1 pin.

So for short, send the gpsdo.hex file to the Atmega328p and program the fuses bits. (E0 D9 FF)

If you have a stk500, there are many chance that you already know how to program a .hex directly.

Version change:

-Version 1.5 i added some code to always start counting at same time after the pulse. Like that, i dont have any pulse arriving in timer overflow sub routine.

This correct an intermittent problem where between 10,000,000.006 or so were displayed. The count was wrong.

Now the device is much more stable. In fact, it never go higher or lower than .001

In fact, if this happen, suspect your gps time pulse or temperature change too fast.

-I also change. When you turn off and on the device, if a config is found, it will at phase 4. Some time the drift is to far to go in running mode directly.

-Version 1.51 i added some routine to track when the pwm overflow. In other word, when pwm arrive to 0v or 5v. Unreachable Frequency message will be display if your OCXO isn't compatible. Some OCXO have input 0-8v instead 0-5v. In this case you will need to add an op-amp to match the OCXO. See here you will find a schematic. If your ocxo have less than 0-5v, you can try tension divider to match your OCXO.

-Add pwm value and 16 last know frequency when pus button is pressed. Value are from newer to older. Exemple: 00FF0000010000001. Last frequency was .000 before that was .999 and so on.

-Also enhanced the frequency finding algorithm. Arrive to run mode faster than before. Now if for exemple at phase 4 you find 2000000006. Instead to drop of 0.4 hertz at each of 200s until reach 0, i multiply the difference (here 6) by the know step of 200s. ie 1/(200x152,59uv) = 32.77 So i remove 32x6 directly from pwm to target 2000000000 directly. Doing this for phase 3,4,5 (no phase 6 anymore). But if the difference is only 1. I kept the 0.4 change.

-Also remove phase 6, yes a 15 minutes less. In fact phase 6 is now phase 5. With the new finding algorithm no need to do a step of 900s anymore. We pass directly to 1000s. Now often in run mode < 1 hour.

-Version 1.52 Some users had no good results with the new algorithm. This one was suppose to be more quicker and it is. But if your ocxo isn't moving 2hz/Volt this can be a problem. So i did 2 algorithms in one. To have the classic version and quick.

For Classic, adding a jumper to have pb5 to gnd. I programmed pb4 to 0 so just add jumper between pb4 and pb5 see picture (blue jumper)

Also, one user is using an old gps module running at 4800 baud. For him just add the red jumper will change the Baud rate to 4800 instead 9600.

Remove the averaging algorithm. After 20 good know values, an average was made and the pwm was programmed with this new number.. The goal was to have better accuracy in a long run. But after many reading of results, this was more a problem than a good thing. Often after this pwm change, the frequency was plus or minus 2 instead of 0. I have better result without this.

-Version 1.53

-Enhanced anti bouncing on push button. Fix when lost and signal reapers display problem. Add led display on startup

-Version 1.54

-Counting LED is now blinking when counting. Led toggle at each 1024 tcnt0 overflow. Led frequency is 19,07 hz. If you see the counting led steady on or off. You will know that the gpsdo is halted.

-Version 1.55

-remove phase1,2,3,4,5 and replace it by the pwm value.

-Version 1.56

-Add serial data output (pin 3) 9600 8 1 to display same information of lcd 2 lines.

-Version 1.57

-Change the watchdog to 2 seconds instead of 1. Some user had self running message no pulse detected. The watchdog was to tight in some cases. So I change this to 2 seconds and add some code to track when a pulse is missing in a different way.

-In some gps module GGA code are slightly different. In the string, some have ,09, other have ,9, (no zero) I added some code to fix this and now have more compatibility with different models.

-The RUN led is also now a Hit LED. This LED turn on at the first time when 10,000,000.000 is Hit (Run mode). The LED will stay on if frequency is staying between + or - 0.001 If not the LED will be off.

Source code (assembly):

Here to have the file compile and ready to program.!AnKLPDy3pII_xV9vTtWnbMD9teF_?e=X7G2Ms

Step 12: Program Your ATMEGA With Avrdude and a USBasp or USBtiny

This method is very simple and cheap. search on ebay or amazon for USBasp or USBTiny. It's between 2 and 5$.

Plug in your USBasp or USBtiny device in your computer and let Windows detect the device (it will report driver not found). If a window pops up asking to search for driver, just close it or click on Cancel.

At this point, download and run Zadig, it should detect the USBasp or USBtiny, or any libusb device that you have. Then in the selection box (see picture), choose libusb-win32 (v1.2.6.0), click on Install Driver, and wait for the installation to complete.

Check in device manager for atmel usb device = ok. No excalmation mark anymore

Download avrdude 6_3 with HEX.rar here below on this page and unzip files in a folder. You will have 5 files, see pictures.

I create a batch file to program the chip with .hex and fuses bits in same time.

Connect USBasp or USBtiny cable in gpsdo board, see picture and turn on the project.

Double click on program usbxxx.bat

At the end, code and fuse bit are programmed, again see picture (black one)

Pay attention, with new fuses bits setting, clock must be now, external.

If programmation is ok and you see happen on lcd, check for oscillation. If you use 12v option, turn the pot

until something is lit on display. Use oscilloscope to adjust duty to 50% if you have one.

Step 13: Jumper Config, (Quick Vs Classic Mode and Baud Rate Speed)

Here are jumpers setting configuration.

PWM correction mode

Quick mode (No jumper default)

Classic mode (Blue jumper)

GPS module transmit speed

9600 bps (No jumper default)

4800 bps (Red jumper)

Quick vs Classic, what's the difference:

Quick mode: will try to correct the pwm by doing large jump when the error is far from the target.

Advantages are, it's quicker to arrive at 10,000,000.000 Hz

Disadvantages are, If the ocxo isn't the same range of correction programmed, the step will be too high or too low. At the end it will jump around and never reach the target.

PWM Corrections for quick mode:

1 second gate. PWM move 0x0222 (41.66mv)

10 seconds gate. PWM move 0x0100 (19.53mv)

60 seconds gate. PWM move 0x006D x missing HZ (8.31mv x missing Hz) if missing Hz > 1

60 seconds gate. PWM move 0x0034 (8.31mv) if missing Hz < 1

200 seconds gate. PWM move 0x0033 x missing HZ (3.89mv x missing Hz) if missing Hz > 1

200 seconds gate. PWM move 0x0010 (3.89mv) if missing Hz < 1

1000 seconds gate. PWM move 0x0008 x missing HZ (610.36uv x missing Hz) if missing Hz > 1

1000 seconds gate. PWM move 0x0003 (228.88uv) if missing Hz < 1

until to find 10,000,000.000 (run mode)

1000 seconds gate. PWM move 0x0004 x missing HZ (305.18uv x missing Hz) if missing Hz > 1

1000 seconds gate. PWM move 0x0001 (76.295uv) if missing Hz < 1

Classic mode: will do little jump even when the error is large.

Advantages, you will eventually reach the target.

Disadvantages, Slower to arrive at 1000 second gate.

PWM Corrections for classic mode:

1 second gate. PWM move 0x0222 (41.66mv)

10 seconds gate. PWM move 0x0100 (19.53mv)

60 seconds gate. PWM move 0x002B (3.28mv)

200 seconds gate. PWM move 0x000C (915.54uv)

1000 seconds gate. PWM move 0x0003 (228.88uv)

until to find 10,000,000.000 (run mode)

1000 seconds gate. PWM move 0x0001 (76.295uv)

Witch one to choose ?

For sure try the quick mode first. It's the default, nothing to do. If you are seeing the frequency jumping up and down and never reach .000 it means that the correction algorithm is too large for your ocxo.

In this situation, just to add a jumper and switch to classic mode.

Step 14: Try Your Project

Before to put all the thing in a box. Try it. Be sure that all is working fine.

Here i fixed GPS module on heat-sink. I used an old transformer 16v AC. Too large for the project but again, I'm using what i already have.

Step 15: OCXO Insulation

If you want, you can insulate the OCXO with foam. Here i used depron foam. This is optional only.

Step 16: Holes in Your Box

Prepair your box. Do hole, put some paint! For square i'm using this tool, see picture. Hand Nibbler Sheet Metal Cutter Tool.

Here is an alternative 3d printed box. External 5v power supply.

Step 17: Time to Put All in a Box

Here i used a metal box.

Step 18: On Scope Results

Like you can see, sine wave is nice. 3,44V peak to peak. (1 volt/div)

Square wave is 2v/div

Here i'm using a 74LS04.

Step 19: Accuracy From User Experience

These images come from Dino (MAC1). I had never measured accuracy by myself with frequency counter. I was very happy to see these results.

10,000,000,000.0 Mhz +.0003 Hz and -.0006 Hz It is even more precise than I thought. My specification was + or - .001 Hz. Super happy :)

Thanks to him for these photos.

Step 20: Instruction Manual

At turn on GPSDO wait 15 minutes. It do nothing. This is for warming the OCXO and satellites reception.

If you haven't any configuration in eeprom. the starting PWM output is at 50% 0x7FFF. You should be reading 2.5V dc on the pwm output if the vcc is 5V.

If the OCXO is already hot, just push button to pass this wait time.

uC will find the good voltage for your OCXO. If frequency is lower, PWM duty will rise, meaning DC value output will rise. If it's higher, PWM duty will drop. See step 13 for more information about the algorithm of this.

Now begin calibration phases. 5 phases total. 1 second, 10, 60, 200 and 1000 seconds. At 1000, uC is counting 1 billions of cycles (ticks) for exactly 10,000,000.000 Mhz

As soon this 1000 seconds achieved, uC keeps the pwm value in eeprom and continu at run mode.

Meaning it looping at the last 1000 seconds gate correction algorithm. If counter reach 10,000,000.001 or 9,999,999.999 the pwm value (16 bits) is adjusted plus or minus 1 and so on. Again it's depend of the classic or quick mode see step 13.

Important, keep in mind, in all calibration phase and run mode, the display is showing the actual count or frequency. If the value isn't normal, bizarre or understandable, suspect a gps pulse problem or a low antenna signal. Problem is coming from the pulse. This one isn't arriving at the right time.

When GPSDO is in run mode, config is saved in eeprom. So if this one is turned off and on, GPSDO go directly in phase 4. But be aware. If power if off for a while. You will probably need to do a whole re-config process. Sometime even with pwm in eeprom, frequency have drifted to much and it's just quicker to restart with default setting.

If for any reason, satellites are lost or weak (below than 3), gps pulse will be lost as well. So pwm value will be not changed anymore until pulse come back. OCXO will run by itself at last good eeprom value. On scope you wont see difference when pulse is there or not.

If you press button, uC will stop counting and you will see UTC time and localisation for 10 seconds.

Localisation is in Degrees and decimal minutes (DMM). This is how to enter this on google map:

46 19.81750 N 072 35.33259 W

If you want to erase the eeprom value and restart calibration, just push button and hold at startup.

LED explanation:

1 1hz and warming. This led is ON at startup meaning the uC is waiting 15 minutes. This is for give some time to the OCXO to warm-up and stabilize. This is a shared LED with the GPS pluse. As soon as the waiting time is done, or push button press, the uC release the LED and gps pulse can be see.

2 Satellite LED. This LED turn on when 3 or more satellites are detected.

3 Counter LED. This LED is flashing when the uC is counting.

4 The RUN led is also now a Hit LED. This LED will turn on at the first time when 10,000,000.000 is Hit (Run mode). The LED will stay on if frequency is between + or - 0.001 If not the LED will be off until the target is hit again.

Meaning if the frequency is 10,000,000.002 the LED will be off and stay off until .999 .000 or .001 arrive.

Step 21: Conclusion

I hope you will enjoy this project. Questions, commentary are welcome English or French.

Step 22: More Information in Eeprom

In run mode, uC store the frequency in eeprom. You can see here about 50 hours of count. The 2 first byte is the pwm config. Here we have 864A. All byte after is all frequency counted. Each 1000s a bytes is stored.

00 is for 10,000,000.000

FF is for 9,999,999.999 or eeprom empty (at the epprom end)

01 is for 10,000,000.001

Before v1.5 i had some 02,03,04,05,06. Very intermittent. I tough it was a large drift in the frequency but in fact it was a bug in software. As you can see now, the eeprom is full of FF,00 and 01 like it should do. Very accurate.

You can see v1.4 eeprom, you can compare.

Step 23: OCXO Vfc Range.

I did a test code to know the OCXO frequency range. uC send pwm 0 and ffff and display the frequency result and restart. I know that base code can tell us unreachable frequency but you can't know exactly the range. This can help in trouble shooting.

If you try this code, it's the same fuse bit.!AnKLPDy3pII_v2E4Gr37X3LmmYp9?e...

Step 24: Since Version 1.56 TX Pin Can Now Be Connected to a Serial Port

Since version 1.56 TX pin can now be connected to a serial port. With this feature, you can see the same information on a computer. No need to install a display if you want to. But both is supported as well.

The TX is on pin 3 of atmega328. Connect this pin to the RX of your com port.

You can download putty and open a standard com port, 9600 8 1.

You can also enable the session log in putty to save the communication and see or monitor all your frequencies.

On the picture you can see the beginning of my double ocxo config. Pwm Value, gate time, number of satellite and frequencies.

Step 25: Blog From Other User

Here is some Blog link from other makers:

From Pierre (In french):

From astromeier:

Feel free to give me your link if you have did this project. I'll post this here.

Step 26: Cleaning the Harmonics

User Neunziger added a filter to clean the remining harmonics. The result is looking very good.

You can see his tip on the comment section below or here

15 People Made This Project!


  • Science Fair Challenge

    Science Fair Challenge
  • Tinkercad to Fusion 360 Challenge

    Tinkercad to Fusion 360 Challenge
  • Make It Modular: Student Design Challenge

    Make It Modular: Student Design Challenge



Question 5 weeks ago

I tested new OCXO in my project. Your OCXO frequency range program helped me much, but I think it will be better if test program will work att 3333-1V and CCCC-4V (more linear comparing to now used edges 0V-0000 and 5V-FFFF). We will use (fmax-fmin)/39321 instead of (fmax-fmin)/65535 to know the frequency step but result will be more accurate I think. On the edges are usually non-linearity and then counting of the f. setp is no so exact as it can be.


Question 2 months ago

Hi Yannick.
Where in code I can change preheating from 15 to 60 min?


Answer 2 months ago

Line 1357 and 1358
ldi xh, $03
ldi xl, $84
for 0x0384 seconds. = 900 seconds
So for 60 minutes you will need to have 3600 = 0x0E10
so replace it by:
ldi xh, $0E
ldi xl, $10


Reply 8 weeks ago

Is it possible to make version where LED will
be ON in range -+0.005 Hz? Not only after it reaches 0.000 first(RUN
mode) but even in first time it will reach -+0.005Hz(1000s mode). In one
of my applications it is accuracy +-0.005 acceptable and I do not want
to use display. (even 0.009 is good enough but OCXO can easily keep
0.005) I am not hurry with it. I will work on 0.001Hz version next week -
if PCB will come from china on time :-)


Reply 7 weeks ago

hex will not help me, I need to set my OCXO and minutes warm up too. But I will try it later after i finish with the "main" version. Or maybe I will send you my OCXO settings.


Reply 7 weeks ago

I said, OCXO can easily keep .001 Very rare I havo more that. But I modified the code like you asked. Testing now. I'll let you know.


Reply 7 weeks ago

I tested two different OCXO. Both works well and tolerance +- 0.001 is mostly not problem. (one device is boxed, second one is PCB only) Problem will come when temperature is changing. Opening the window for 10 minutes will case not stability for an hour sometimes for 3 hours. (f change is up to 0.003Hz) This is now weakest part I think. Yesterday I soldered one GPSDO version (PCB from China finally came) I will test it couple of days. I have to adapt code to OCXO but it looks like it works well after first tests. The -+0.005Hz version I will test a bit later but thank you very much.


Reply 2 months ago



Question 2 months ago on Step 20

Hi Yannick
After shelving this project for a week or so I have jumped back at it. I received 4 more OCXO's and I am trying them. I have one that is looking good I think.
Below please find the attached log file.

The question I have is, Why when the counter reaches 10 mhz does the lock LED not illuminate?

Also notice the jump between some of the .xxx hz in the log display, and the strange thing while I monitor the control voltage it changes only maybe 10 milli volts, so this is a strange one.

0x6395,1000,S=09, 9,999,999.998 Hz
0x6398,1000,S=11,10,000,000.001 Hz
0x6395,1000,S=11,10,000,000.000 Hz:)
0x6395,1000,S=12, 9,999,999.881 Hz
0x6396,1000,S=11, 9,999,999.997 Hz
0x6397,1000,S=12, 9,999,999.997 Hz
0x6398,1000,S=11, 9,999,999.998 Hz
0x6399,1000,S=12, 9,999,999.999 Hz
0x639A,1000,S=12, 9,999,999.882 Hz
0x639B,1000,S=12,10,000,000.002 Hz
0x639A,1000,S=11,10,000,000.003 Hz
0x6399,1000,S=11,10,000,000.002 Hz
0x6398,1000,S=11,10,000,000.002 Hz
0x6397,1000,S=11,10,000,000.002 Hz
0x6396,1000,S=12,10,000,000.000 Hz
0x6396,1000,S=11, 9,999,999.882 Hz
0x6397,1000,S=10,10,000,000.000 Hz
0x6397,1000,S=12, 9,999,999.883 Hz
0x6398,1000,S=12,10,000,000.000 Hz
0x6398,1000,S=12, 9,999,999.883 Hz
0x6399,1000,S=12,10,000,000.002 Hz
0x6398,1000,S=11,10,000,000.000 Hz
0x6398,1000,S=11, 9,999,999.883 Hz
0x6399,1000,S=12,10,000,000.001 Hz
0x6398,1000,S=11, 9,999,999.883 Hz
0x6399,1000,S=10,10,000,000.001 Hz
0x6398,1000,S=11, 9,999,999.883 Hz
0x6399,1000,S=11,10,000,000.001 Hz
0x6398,1000,S=10, 9,999,999.883 Hz
0x6399,1000,S=12,10,000,000.001 Hz
0x6398,1000,S=10, 9,999,999.883 Hz
0x6399,1000,S=10,10,000,000.001 Hz
0x6398,1000,S=11, 9,999,999.882 Hz
0x6399,1000,S=12,10,000,000.001 Hz
0x6398,1000,S=11, 9,999,999.883 Hz
0x6399,1000,S=11, 9,999,999.999 Hz
0x639A,1000,S=11, 9,999,999.883 Hz
0x639B,1000,S=12,10,000,000.001 Hz
0x639A,1000,S=12, 9,999,999.883 Hz
0x639B,1000,S=12,10,000,000.002 Hz
0x639A,1000,S=12,10,000,000.001 Hz
0x6399,1000,S=11, 9,999,999.882 Hz
0x639A,1000,S=12,10,000,000.000 Hz
0x639A,1000,S=12, 9,999,999.883 Hz
0x639B,1000,S=12,10,000,000.002 Hz
0x639A,1000,S=11,10,000,000.001 Hz
0x6399,1000,S=12, 9,999,999.883 Hz
0x639A,1000,S=09,10,000,000.001 Hz
0x6399,1000,S=11, 9,999,999.883 Hz
0x639A,1000,S=11,10,000,000.001 Hz
0x6399,1000,S=11, 9,999,999.883 Hz
0x639A,1000,S=11,10,000,000.001 Hz
0x6399,1000,S=11, 9,999,999.882 Hz
0x639A,1000,S=12,10,000,000.000 Hz
0x639A,1000,S=11, 9,999,999.883 Hz
0x639B,1000,S=11,10,000,000.001 Hz
0x639A,1000,S=11, 9,999,999.882 Hz
0x639B,1000,S=11,10,000,000.001 Hz


Answer 2 months ago

0x6395,1000,S=11,10,000,000.000 Hz:)
0x6395,1000,S=12, 9,999,999.881 Hz

This is not normal. It's impossible to have 119 cycles missing with the same pwm value.
You should be lower than 3 cycles maximum. Fixing this will fix the strange jump you are talking about.

That's said, 1/2 the count isn't good. some cycle is missing. Pretty sure the speed is right on spot but, uC is missing some clock.

Try this. Change fusebit to 0xCF instead E0.
E0 = external clock
CF = external Cristal.
To do this edit the .bat file and change E0 fo CF and reprogram.
lfuse:w:0xE0:m -U for lfuse:w:0xCF:m -U


Reply 2 months ago

Thanks Yannick
I will try that and will up-date you on my findings



Question 3 months ago

Question for all of you:
Is your GPS DO also sensitive to device connected/disconnected to output? Even if I connect f-counter (or change its input impedance) GPS DO frequency will change (about 0,012 Hz). GPS DO will calibrate it, but it takes a time. I thought if output is through two logical gates(inverters) " it can not afect OCXO. But both, f-counter and GPS DO's display shows the same frequenci change... Big surprice for me. I thought I am better in elektronic... I tested some gates 74AS04, 74AC04, 74AHC14 with similar result. I see only explaining - It has to somehow affect OCXO output but what a way? (if there are two separately powered logical gates in the circuit).


Answer 3 months ago

Hi Yannick.
I have to write there is definitely bug in software 1.57 I just tested. OCXO was set using trimmer powered from its own reference output (without PWM). To be sure it works well I let it work couple of hours (picture one).
Then I wanted to know how different output impedance will change frequency. Second picture (different colour represents different impedance).
Sometimes when frequency changes the display show non-real value.
It happened sometimes but here it showed wrong value 9,989,999.986 three times in row. (10kHz fault).
Fault on kHz range I can see quite often when I play with GPSDO output ( mean connecting/disconnecting counter or changing impedance on output) Value 9,959,... happened when I changed impedance for couple of second only. ( regulation voltage was the same and I not touched it during all the test at all, even it shoved wrong f at 60s and 200s)
I will not test couple of days because I have to do something more useful but maybe later.
I already read article that I have to use independent output (using transformer) to resolve frequency fluctuation when something is connected (or impedance will change) but I thought it good to know there is something wrong in your counter software.


Reply 3 months ago

You have rebound somehow and count is finishing one second ealier. One second at 10mhz is 10E6 cycles = 00,010,000.000 of counting. This is exactly the number you miss. Running 1.57q for one week now.


Reply 3 months ago

Somehow I kept thinking about it. Isn't the answer at the beginning? As I have already written, the ocxo's input was not connected to the PWM but to the voltage reference. How is it possible that the counter counted 0600000001 then 0599999999 or 2000000001? That is not possible. The maximum error (OCXO fluctuation) could be - + 0.002Hz. (Far away from to come to result 0600000001) I think the problem is in the first or last counting interval. ( I thing it is not one continuous count) What about adding one interval forward, one backward, and not to count them in the frequency result? I mean to delay the time when the impulses start to count and stop counting a while before the uC starts doing other work. (Maybe 1s pulse delay.) Or... some buffer maybe was not clean if there was jump from 001 to 999.


Reply 3 months ago

Hi Jan, I'd like to add a thing. I think, sometime there are some correction in the satellite frequency. Maybe you will see the same thing happen to you. All is very fine for weeks. And somehow, look the frequency, .016 lower. So 16 cycles is missing. I touched nothing, I'm in quick mode and even so ,the correction isn't larger to correct the next result. So the frequency has really changed. The pwm value it's far from before to have .000 again. I dont know exactly what's happening but I dont think it's my hardware. Was running fine for week and bang this happen. Maybe the gps module or the gps network, I do not know. Tell me if you have something like that on your side.


Reply 3 months ago

Hi Yannick,
I cannot test it now because I am not at home. But similar picture I had quite often.
And just now I realized when I played with GPS module and disconnect antenna it took 3-5 second to 1s pulses stopped. (watching to GPS LED) It means not all pulses are fully synchronized but there surely is some prediction (how else can GPS module generate pulse when there is not GPS signal.... and those predicted pulses have accuracy of internal GPS crystal). I think it happens even when signals from satellites is weak. Then there is will to keep device working a while and wait if better signal will come.... It can cause such a measuring error...
I do not know how it really works in GPS module these are my ideas only, but I’m sure module generates 1s signal even if no satellite is received for a while therefore, I think it is similar when signal is weak. Take it as an idea, not as a fact, because I haven't verified it. (but I am usually right :-) )
I focused on one part of device and fully forgot that precision of measuring is actually given by precision of 1s pulses. Yes, it explains a lot for me. Thank you. I finally left the circle in which I focused only on OCXO and your counter.


Reply 3 months ago

I use u-blox NEO M8N I looked at datasheet and to my surprise it says "Accuracy of time pulse signal" is 30 or 60ns. At 10Mhz it gives accuracy 0.3 or 0.6 Hz and not more... I know, our regulates are looking virtually better, but maybe for short time only or we see result with constant systematic error. It looks like we can stabilize OCXO on some frequency and keep fluctuation in +-0.001Hz but we cannot be sure the frequency is 10MHz-+0.001, due to control unit itself has accuracy only 0.3Hz.
U-blox NEO M8T has accuracy "better than 20ns" (Clear sky). The best I found is ZED-F9T for 200 USD with Accuracy of time pulse signal 5ns. But it is still only 0.05Hz accuracy when unit will control 10Mhz.
It looks like to control OCXO by GPS has it limits and the limits by datasheets are far away from accuracy +-0.001Hz I wanted to reach.