Author Topic: Possible to make a quality universal timer/counter using $12 PIC counter+GPSDO?  (Read 7767 times)

0 Members and 1 Guest are viewing this topic.

Offline cdevTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
Over the last few weeks I've been playing around with an inexpensive frequency counter that I purchased from ebay for $12. (Translation of PDF Manual attached below) It appears to have a TCXO and displays eight digits. I have (translated) PDF docs for it and it has a decent level of configure-ability. Its supposed to be able to measure frequencies to 2.4 GHz, but I have no idea what it can actually go to in reality.

Anyway, Ive also read a bit about the use of the PIC microprocessor for simple transformations - accurate to picosecond level using these unique it seems PIC chips. Their uses include these described on the leapsecond.com site, http://www.leapsecond.com/pic/picpet.htm or maybe this is better..

http://leapsecond.com/pic/picpet2.htm
http://www.leapsecond.com/pic/
http://www.leapsecond.com/pic/picdiv.htm

These are frequency dividers which can be used to derive precise intervals from a 10 MHz standard..


    pd03.asm / pd03.hex / PD03 -- "4-pin" 10^3 frequency divider (10 MHz to 10 kHz)
    pd04.asm / pd04.hex / PD04 -- "4-pin" 10^4 frequency divider (10 MHz to 1 kHz)
    pd05.asm / pd05.hex / PD05 -- "4-pin" 10^5 frequency divider (10 MHz to 100 Hz)
    pd06.asm / pd06.hex / PD06 -- "4-pin" 10^6 frequency divider (10 MHz to 10 Hz)
    pd07.asm / pd07.hex / PD07 -- "4-pin" 10^7 frequency divider (10 MHz to 1 Hz)
    pd08.asm / pd08.hex / PD08 -- "4-pin" 5x10^6 frequency divider (5 MHz to 1 Hz)
    pd09.asm / pd09.hex / PD09 -- "4-pin" 10 MHz to 1PPS frequency divider (20 us pulse)
    pd10.asm / pd10.hex / PD10 -- "4-pin" 10 MHz to 1PPS frequency divider (10 ms pulse)
    pd11.asm / pd11.hex / PD11 -- 10 MHz to 1PPS frequency divider (3 pulse widths), with sync
    pd12.asm / pd12.hex / PD12 -- 5 MHz to 1PPS frequency divider (3 pulse widths), with sync
    pd13.asm / pd13.hex / PD13 -- 10 MHz to three frequencies divider (1-10-100 Hz), with sync
    pd14.asm / pd14.hex / PD14 -- 5 MHz to three frequencies divider (1-10-100 Hz), with sync
    pd15.asm / pd15.hex / PD15 -- 10 MHz to three frequencies divider (1-1000-10000 Hz), with sync
    pd16.asm / pd16.hex / PD16 -- 5/10 MHz to four frequencies divider (1-10-100-1000 Hz)
    pd17.asm / pd17.hex / PD17 -- 1/2.5/5/10 MHz to 1PPS frequency divider (100 ms), with sync
    pd18.asm / pd18.hex / PD18 -- 1/2.5/5/10 MHz to 1PPS frequency divider (10 ms), with sync
    pd26.asm / pd26.hex / PD26 -- 10 MHz to 1PPS divider, with sync and micro-step
    pd27.asm / pd27.hex / PD27 -- 10 MHz to 1PPS divider, with sync and milli-step
    pd28.asm / pd28.hex / PD28 -- 10 MHz to sidereal 1PPS divider, with sync and milli-step

The PicPets speak to a microcomputer via a UART..  An out of the box RPI usually has two UARTS, but then you can of course tell a RPI to use additional GPIOs as yet more UARTS if you need more...

The PICs seem like a simple, cheap way to make a great many transforms and timestamp events with timing related value possible in a way that minimizes quantization error..

I  also got a low cost (True Position) GPSDO for $42 on ebay. (see thread at https://www.eevblog.com/forum/projects/gpsdo-loss-of-satellitesfix-troubleshooting/ )

 Which is quite a decent GPSDO, as far as I can tell so far. It is getting typically five sats with an indoor antenna and seven if my antenna is outside in the middle of my yard.. But deer like to run through my yard and kept knocking it over.. So now its back inside

It seems to work okay with an indoor antenna once its been going for a while..

 it can serve as a 10 MHz standard of known accuracy.

But thats the problem, I have no way of measuring anything else that well, really, yet. As I went looking for counter/timers I found either old classic equipment thats either huge too big for my tiny desk area, or so old its likely to not be as reliable as I'd like it to be. Other equipment will likely require repairs.. If certain parts die they are 'unobtainium'

At the same time I have this new frequency counter that cost $12 thats right on frequency.. I have this surplus GPSDO that I venture to say is likely as good as the timebases that cost $600 that went into the classic HP 5335a Because it has GPS atomic clocks to reference itself to. These PIC chips are also super accurate.

They arent about to become hard to source in the immediate future.

I don't really know much about precise timing at all, besides what Ive read. I'm not some kind of technical whiz at all. I just like learning and saving money and having fun with science and electronics and computers, cheaply.

This has led to my thinking that - why cant it be possible to make a full featured universal counter timer to measure other stuff, using these fairly modern, really cheap elements, and do it right, for less? It seems like all the elements are there? Also, the specs of a device making use of modern hardware in the most cost effective manner possible may end up being as good or perhaps better than the old classic equipment, because silicon and mass production, and using this approach might be less likely to suddenly break or fail and not be fixable.

An open source project like the AVR TransistorTester for time and frequency measurement makes a lot of sense.
« Last Edit: November 21, 2017, 02:11:29 am by cdev »
"What the large print giveth, the small print taketh away."
 

Online edpalmer42

  • Super Contributor
  • ***
  • Posts: 2268
  • Country: ca
I suspect there are many projects around to do what you want, but here's one that comes to mind:

http://www.ko4bb.com/doku2015/doku.php?id=precision_timing:pictic

I've got a couple of Pictic II boards.  Performance is similar to a Racal-Dana 1991/1992 or an HP 53131A.  You'd have to build a front-end circuit to square up a sine wave input.  This project was discussed thoroughly on the Time-Nuts mailing list a few years ago.

Ed
 
The following users thanked this post: cdev

Offline cdevTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
Thank you!!!

This is interesting too, just found it..

http://www.rmham.org/wordpress/wp-content/uploads/2016/03/A-High-Quality-Time-and-Frequency-Laboratory-on-a-Budget-KD5SSJ.pdf

Also, the specs below are the two devices used in the GPSDO that I have.
« Last Edit: November 21, 2017, 02:02:11 pm by cdev »
"What the large print giveth, the small print taketh away."
 

Offline texaspyro

  • Super Contributor
  • ***
  • Posts: 1407
Look into the TAPR TICC.  Two channels with 60 ps time interval resolution.  Their main limit is the max sample rate is around 100 Hz.  You use something like a TAPR TADD-2 Mini as a prescaler to divide 10 MHz to 1 PPS (it uses a PICDIV chip to divide down the input).

The new (soon to be released) version of Lady Heather can talk to and control the TAPR TICC.  It can also work with generic counters in frequency, interval, period, or timestamp mode.
 

Offline cdevTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
It's too expensive for me right now, unless I can make one myself.
"What the large print giveth, the small print taketh away."
 

Offline texaspyro

  • Super Contributor
  • ***
  • Posts: 1407
It's too expensive for me right now, unless I can make one myself.

In the world of precision time and frequency,  good and cheap are rather mutually exclusive.  And the price scales exponentially with the Cg (coefficient of goodness).
 

Online edpalmer42

  • Super Contributor
  • ***
  • Posts: 2268
  • Country: ca
It's too expensive for me right now, unless I can make one myself.

In the world of precision time and frequency,  good and cheap are rather mutually exclusive.  And the price scales exponentially with the Cg (coefficient of goodness).

Very true, but it also depends on what you want to measure.  If you want to measure frequency, you don't need picosecond resolution.  If you want to measure Allan Deviation at 1 sec., neither PICTIC nor TAPR TICC will work very well.  But either will work for measuring drift - they will just take a little time to average out the GPS jitter. 

Cdev, I have enough oscillators and frequency references (okay, I probably have too many) that I can pick and choose what I want to do.  I choose to make my house standard a free-running Rubidium, currently an HP 5065A, that runs 24x7 and clocks all my test equipment as well as being a frequency source for whatever else I want to do.  This gives me a quiet jitter-free reference with low drift.  Occasionally, I check the Rb against my GPSDO to see how it's doing.  I can take as long as I need for that test because I only do it every few months.

The problem with using GPS as the reference is that it has a very distinctive 'signature' that will then appear in all your measurement data.  Rb and Quartz also have a signature, but it's easier to recognize and remove from the data or, in many cases, it can just be ignored.

Ed
 
The following users thanked this post: cdev

Offline cdevTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
Well, I plan to be using a TruePosition GPSDO which seems to be quite decent, however at its core it has a Bliley OCXO and its controlled by a surplus telecom card that has virtually nothing in the way of literature on the web..

its a quartz OCXO which we know about, and a furuno timing GPS which is well known but the rest is largely a mystery still..

So you mean GPS's introduce a particular kind of variation?

These GPSDOs are kind of new to the testing and measurement community, it seems. But also an exceptionally good value..

There is a thread here..
https://www.eevblog.com/forum/projects/gpsdo-loss-of-satellitesfix-troubleshooting/
------

Do you mean like a sawtooth if the underlying OCXO is not set up properly?

? I know that GPS variations short term look very much like waves. The Kalman filter on a single GPS needs to be told its stationary..

Currently the GPS's I have the most experience with are various skytraq non-timing units..

I have no experience with precision timing. I kind of want to learn more because a lot of interesting things that I would like to be able to do depend on timing and frequency measurement.
« Last Edit: November 21, 2017, 02:04:39 am by cdev »
"What the large print giveth, the small print taketh away."
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Interesting.  I just ordered a VC3165 which I suspect is pretty much what you got for $12, but in a more  convenient package. The specs are rather similar.  I'll probably get one of these just to compare to the VC3165.  At $12 it's worth it for the education derived from figuring it out.

The discussion in the Feeltech FY6600 thread makes me think that a small amount of tinkering would improve cheap Chinese instruments quite a bit.  There's lots of room in the boxes for auxiliary stuff.  Boxes, switches and connectors add up quickly.  I've put $1 of electronics in $10 of enclosure far too many times to count.

Thanks for the heads up
 

Offline cdevTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
I will add the documents that I have for the frequency counter and the GPSDO's thread to the top of this thread..

When I tested the PIC counter against my GPSDO it just said 10.000000

So, pretty decent, for the money really a good deal.
« Last Edit: November 21, 2017, 02:15:07 am by cdev »
"What the large print giveth, the small print taketh away."
 
The following users thanked this post: rhb

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
I'm afraid it's a bit hard to find the TruePosition GPSDO for $42.  What I see is more in the $150+ range which makes Leo Bodnar's unit more attractive.
 

Offline cdevTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
You are right.. the ones on ebay are gone..

 :palm:

But, there will be more. Everything gets cheaper. Just wait a while.

 :clap:
« Last Edit: November 22, 2017, 01:46:48 am by cdev »
"What the large print giveth, the small print taketh away."
 

Online edpalmer42

  • Super Contributor
  • ***
  • Posts: 2268
  • Country: ca
Well, I plan to be using a TruePosition GPSDO which seems to be quite decent, however at its core it has a Bliley OCXO and its controlled by a surplus telecom card that has virtually nothing in the way of literature on the web..

its a quartz OCXO which we know about, and a furuno timing GPS which is well known but the rest is largely a mystery still..

So you mean GPS's introduce a particular kind of variation?

These GPSDOs are kind of new to the testing and measurement community, it seems. But also an exceptionally good value..

There is a thread here..
https://www.eevblog.com/forum/projects/gpsdo-loss-of-satellitesfix-troubleshooting/
------

Do you mean like a sawtooth if the underlying OCXO is not set up properly?

? I know that GPS variations short term look very much like waves. The Kalman filter on a single GPS needs to be told its stationary..

Currently the GPS's I have the most experience with are various skytraq non-timing units..

I have no experience with precision timing. I kind of want to learn more because a lot of interesting things that I would like to be able to do depend on timing and frequency measurement.

The standard method of evaluating oscillator performance is to measure the Allan Deviation.  That's where the GPS pattern really shows up.  Take a look at this page:  http://www.leapsecond.com/pages/gpsdo/ , you'll see measurements of 4 GPSDOs.  Look at the composite graph at the bottom of the page.  The heavy lines with the dots all follow the same pattern.  The exact shape of the graphs depends on the performance of the OCXO and the PLL parameters.  But at the right side of the graph, they all end up running parallel because that's the performance limit of GPS.  Every properly functioning GPSDO will end up running along that same straight line, some a little higher, some a little lower.  By the way, if your GPSDO doesn't follow that line, it isn't working right!

So if you measure a really good oscillator against GPS, you may see nothing but the GPS pattern because the oscillator's performance is much better than your GPSDO.  This problem doesn't occur with a simple frequency measurement, only with something like an Allan Deviation measurement.  This can happen with any Allan Deviation measurement, GPS isn't unique.  You always have the problem where your reference can interfere if it isn't much better than the device you're testing.

Ed
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
We're in an odd situation in that certain parts of very sophisticated test gear have gotten cheap.  However, other parts are still quite pricey.  Relative to the reported accuracy of the $12 counter, the GPSDO is expensive and superfluous for the purposes of an inexpensive set of test gear.

I started a HackaDay project to build a multipurpose test instrument around an STM32F4.  I spent a good bit of time reading datasheets before I realized that the Chinese were banging out most of the stuff already.

I am quite sure that a very high accuracy counter can be built by using a GPSDO as the reference for the $12 module.  But new GPSDOs are 15x the cost of the counter module.  The counter modules are "to die for" good relative to 30 years ago.  So why bother?

There are a slew of educational purposed multifunction test sets.  But all that I have seen are too limited to be of interest to a ham or university level experimenter.  Unpackaged modules are problematic.

I should like to pose a slightly different question.

How can one package existing cheap modules to best provide an inexpensive T&M bench?  What does one need for that?  The counter needs a PS as does everything else.

My general thinking is that if a good open source design exists, it will get copied.  Especially if it's just repackaging of eBay parts.
 

Offline cdevTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
ChrisLX200 suggested using magnets to hold modular components. That does sound like the best way to go to connect cheap instruments together. When I get desperate to put some device in a box to protect it and don't have a suitable other box to put them in I just put them in a cardboard box. Its also good for figuring out what you want to do with a better case when you get one.
« Last Edit: November 22, 2017, 01:57:06 am by cdev »
"What the large print giveth, the small print taketh away."
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
My thinking is more a standard enclosure that's easily fitted with different devices for a particular function.  The enclosure defines the functions and the modules implement them.

For example, for the frequency counter, define a 10-12 digit space.  That way an 8 digit counter can be fitted to a flat plate and mounted.  An integral part of the enclosure is an MCU with a set of knobs and buttons and a UI display which allows selecting a particular module.  Have a set of connectors and if appropriate, switch them using relays.

A miniature relay rack might be a good model. Multiple output PS in the base along with the UI controller.  Standard panels for functional elements. Use per functional module LDOs to limit the number of supply voltages if needed.
 

Offline cdevTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
"What the large print giveth, the small print taketh away."
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
My work space would probably fit *inside* a small switch.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
A PIC would be entirely adequate for implementing a universal counter.  A part like the PIC18F26K22 might even be desirable because of its built in Charge Time Measurement Unit (CTMU) for implementing interpolation.

But even with the built in CTMU, the support circuits including signal conditioning are not trivial.

 

Offline KE0LFX

  • Contributor
  • Posts: 12
  • Country: us
Questions from a Newbie,

I just received a batch of these GPSDO True Posistion modules and when I have the serial TTL connected I get a constant cycle of "GETVER 12.0.1 BOOT 10 fdbe 7437 xxxxxxxxxxxxxxxxxxxxxxxxxx" can someone verify this is normal or is my serial wiring incorrect?

I have GPS antenna connected and leaning up against south face window.

Any help would be great.......

And on another note these will be for sale if I can get help verifying them.


Regards,
J
 

Offline cdevTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
Thats what you want the units to be doing. Sounds promising.

You need to connect up, as you have done, to either their RS232C port (12 volt serial) or their 3.3 volt UART connection and type the command "$PROCEED" <return> (without quotes)

Then you need to tell it to do a location survey. Depending on the antenna it should go fairly quickly. If its unable to make progress with the survey the antenna needs to be more in the clear.  Antenna location is important.

The location of the headers is enumerated in a set of documents I downloaded from http://www.packratvhf.com/ last year. There are several kinds of cards with slight differences.  But it sounds like you already have that working.

There is another thread here where there is a lot of info.
https://www.eevblog.com/forum/projects/gpsdo-loss-of-satellitesfix-troubleshooting

Most of the actual command strings are listed in the source code for this program:
https://github.com/pigrew/trueposctrl  >> look for the file named GPSDO_commandset.h

Thats probably the most complete reference available.

There is also quite a bit of info on them on the time-nuts mailing list

https://www.febo.com/pipermail/time-nuts


« Last Edit: February 02, 2018, 09:59:44 pm by cdev »
"What the large print giveth, the small print taketh away."
 

Offline texaspyro

  • Super Contributor
  • ***
  • Posts: 1407
Lady Heather now works with the PICPET.   Here it is being clocked by a 10 MHz TTL oscillator.  The 1PPS input (the reference clock in this implementation) is from a HP-5071A cesium oscillator.  The room temp varied about 2.5 degrees C.

Although the PICPET only has 100 ns resolution, with enough samples you can get some interesting data.  Here the cheap canned oscillator has an average freq of 10,000,171.161666 Hz and a tempco of around 0.166 Hz/deg C.  The oscillations are the heating system keeping my toes nice and toasty.

I have laid out some interface boards to connect a LPFRS/LPRO and EG&G TS-RFS rubidium oscillators to my connector breakout board for the X72 rubidium.  These boards have a PICDIV for doing a 1PPS output and also a PICPET for doing time interval measurements.   There is now also an interface board for the SA22.c rubidium (which already has a built in 1PPS and a time interval counter).

I also did a board that takes a 10 MHz sine/square wave in and outputs a squared ACMOS 10 MHz output, a filtered sine wave output derived from a square wave input, and has the PICDIV and PICPET.
 

Offline KE0LFX

  • Contributor
  • Posts: 12
  • Country: us
I can't thank you enough CDEV...... that worked.......


Wanted to make sure I could get in and test these before i start selling them.....

I will have many coming in from the field over then next couple weeks......

 

Offline cdevTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
@pigrew and @texaspyro deserve your thanks especially.

It would be nice if we could get more info on them. Having more people own them will likely lead to more investigations of their internals.

I am sure there is still a lot more to learn.

I can't thank you enough CDEV...... that worked.......


Wanted to make sure I could get in and test these before i start selling them.....

I will have many coming in from the field over then next couple weeks......
"What the large print giveth, the small print taketh away."
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3802
  • Country: au
The original question was for making a quality universal counter cheaply.

There are big differences between a quality universal counter and cheap counters.

Quality counters use a number of techniques to give as many digits resolution as possible with a short gate time. On a cheap counter, if you want to measure 1Khz to 8 decimal places, you might have to wait 100,000 seconds which is over 1 day. A good counter can do this in 1 second or less.

The way the quality counters measure 1KHz is that they have a gate time - say 1 second. During that time, they measure the period of as many cycles that can be fit within the gate time as possible, divide the total period by the number of cycles and then invert. With a 10MHz clock, you can usually get between 6 and 7 digits resolution with a 1 second gate time with any frequency over 1 Hz.

If you want to read about this, it is method that HP explained for their 1974 5245A counter:

http://www.hparchive.com/Journals/HPJ-1974-06.pdf

If you look at more recent HP/Agilent/Keysight counters, you will notice something very strange. They can display way more digits then the 1974 counter ever could with a 1 second gate. Not only that, they can measure well down into the picosecond area even though they they use clocks at 100MHz or so.

They take the 1974 idea and make it better by having two clocks - say 100MHz and 100.1Mhz. Now these two clock will only have rising edges at the same time once every 1000 cycles. On the 556th cycle after this coinciding of edges, there would be a difference of exactly 5.56 nanoseconds between the leading edges. They use this trick to achieve the magical "impossible" resolution.

HP described this idea with their 5359A counter in 1978:

http://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1978-08.pdf

So the higher the clock speed the better. You could use a microcontroller running with the 10MHz GPS based clock, but if you did look at adding a FPGA, then the FPGA can convert that 10Mhz clock to a 200MHz clock. You can also implement all the needed hardware for precise edge transitions, high speed counters and so on. The higher the counter can directly read frequencies and periods without a pre-divider the better.

If you want to put in the extra effort, you may be able to get a counter that is still pretty cheap but can show 9 digit accurate frequencies with a fast gate time.


« Last Edit: February 03, 2018, 05:55:38 am by amspire »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf