DIY frequency counter - Page 1
Forum section: electronics / projects

author: technix
author_rank: Super Contributor
timestamp: May 11, 2015, 05:08:21 pm
content: So another of my DIY gear posts. Here instead of DMM or voltage reference with some volt nuttery, this is about frequency and slight time nuttery. I am thinking about rolling a frequency counter.Specs: 10Hz to 100MHz, 10Vp-p max input voltage.The MCU is ATmega32U4. USB is used to talk to a computer. (I think it is obvious now that my projects usually talks to a computer, so data logging and digital calibration can be made real easy, and heavy-haul calculation is allowed with a computer attached)Questions:1) Is DS3231 a good enough time base alone?2) Since my time base emits 32768Hz, how to measure frequencies orders of magnitude above, below or around the same of the reference clock? How does the math pan out? Which pin is to interrupt and which pin is to count?

author: kjs
author_rank: Regular Contributor
timestamp: May 11, 2015, 06:39:28 pm
content: It all depends on what you want to achieve. For my purposes that time-base would be utterly useless as I need 10E-12 worst case. The good thing is that with that thermometer as a reference you won't have to worry about differences in the gate transition time (vs temp and voltage).

author: lincoln
author_rank: Regular Contributor
timestamp: May 11, 2015, 07:02:15 pm
content: Here is a good primer:http://www.npl.co.uk/upload/pdf/20060209_t-f_johansson_1.pdfThere is a lot of interest over at the time nuts using this chip and an integrator :http://www.acam.de/tdc-gp22/

author: dom0
author_rank: Super Contributor
timestamp: May 11, 2015, 07:16:22 pm
content: A 32 kHz reference clock is, honestly, just shit for a bench frequency counter. You'll get, with the usual reciprocal technique, only 4.5 digit/seconds out of it. Use at least a 10 MHz ref clock.

author: technix
author_rank: Super Contributor
timestamp: May 11, 2015, 08:57:21 pm
content: Quote from: dom0 on May 11, 2015, 07:16:22 pmThose 10MHz ref clocks get real expensive real fast if treading into TCXO or OCXO lands. The Maxim chip, despite its lower frequency, is cheap and provides a good DTCXO. Also 4.5 digits performance is okay with me.

author: dom0
author_rank: Super Contributor
timestamp: May 11, 2015, 09:07:29 pm
content: New, certainly, used and thus nicely aged you can get very good OCXOs at the usual frequencies for 30 bucks or less.You must be a patient man if you're willing to not only use but tediously build a counter so slow that you need to wait just short of a full hour for a eight digit reading that a more properly designed counter can obtain in a few seconds or less. And that's just the effect of a single design parameter you fixed to some unreasonable value for... what exactly?

author: Dragon88
author_rank: Regular Contributor
timestamp: May 12, 2015, 12:07:59 am
content: Quote from: technix on May 11, 2015, 08:57:21 pmYou can get a semi-decent 10MHz OCXO for $30 on eBay, that will swim laps around any watch crystal in terms of stability and usefulness in a counter. And the design of the counter itself is not trivial. Trying this project with an RTC module will just be wasting your...time. (pun intended)You're better off buying a good used HP frequency counter on eBay, and learning how it works. Really study the theory of operation. Far more will be learned from that.

author: Liv
author_rank: Regular Contributor
timestamp: May 12, 2015, 07:31:46 am
content: Quote from: lincoln on May 11, 2015, 07:02:15 pmIn a frequency counter I used a simple interpolator scheme based on two current sources:DIY interpolating reciprocal frequency counter FC-510.

author: technix
author_rank: Super Contributor
timestamp: May 12, 2015, 12:33:54 pm
content: Quote from: dom0 on May 11, 2015, 09:07:29 pm30 bucks is three times the price point I am aiming.Cost. DS3231 costs less than 25 US cents here.

author: smjcuk
author_rank: Frequent Contributor
timestamp: May 12, 2015, 01:22:03 pm
content: A 10.000MHz standard xtal will give you better precision than that IC as the period is only likely to be relevant once per second and the number of cycles is a lot higher. If you use a precision frequency standard/OXCO with a low reference clock speed, you're going to have to make pretty large guesses on high frequencies. Plus you have I2C bus latency to consider there and the fact that it's a time standard, not a frequency standard.In fact if you have a 10.000MHz standard xtal, at 100MHz you're looking at 10.0Hz precision. 32768Hz source, you're looking at 3KHz precision. These are only approximate magnitudes of difference and I'm not rounding properly but you get the idea.Plus you can do this with just plain old TTL with a prescaler, some counters and display drivers, LED displays and a shit crystal for $50 or so or as someone said, buy one.

author: daqq
author_rank: Super Contributor
timestamp: May 12, 2015, 01:24:28 pm
content: QuoteIf you want it as a one shot project then go to ebay - you'll find lots of OCXO for reasonable prices. You can also build a thermostat around your average oftheshelf crystal or TCXO which are considerably cheaper. Don't know about the long term characteristics though.

author: edavid
author_rank: Super Contributor
timestamp: May 12, 2015, 03:42:29 pm
content: Quote from: daqq on May 12, 2015, 01:24:28 pmThat doesn't work, because crystals that are not intended to be ovenized are cut with turnover near room temperature.

author: technix
author_rank: Super Contributor
timestamp: May 12, 2015, 04:12:32 pm
content: Quote from: smjcuk on May 12, 2015, 01:22:03 pmCan I run digital temperature compensation using a normal HC49/S crystal oscillator and a temperature sensor like DS18B20, tucking the SOT-23 device between the pins of the crystal, and thermally bond them together using a bit of heatsink compound?

author: Liv
author_rank: Regular Contributor
timestamp: May 12, 2015, 04:13:49 pm
content: Quote from: edavid on May 12, 2015, 03:42:29 pmThen use the heating/cooling TEC instead heater

author: smjcuk
author_rank: Frequent Contributor
timestamp: May 12, 2015, 04:34:22 pm
content: Quote from: technix on May 12, 2015, 04:12:32 pmNo. Get a canned xtal and some snips and take one to bits. You'll find it suspended inside the can on the two leads. There will be a temp gradient between the xtal itself and the case so a delta-t in the time it takes to measure or compensate. Also then you can only adjust out the xtal with something like a varactor.Just use a normal xtal for version 1.

author: technix
author_rank: Super Contributor
timestamp: May 12, 2015, 04:43:15 pm
content: Quote from: smjcuk on May 12, 2015, 04:34:22 pmThe digital compensating is done by mathematically applying a coefficient that is a function of the temperature, as read from the temperature sensor, to crystal signal count. It is all math inside the microcontroller.

author: Nuno_pt
author_rank: Frequent Contributor
timestamp: May 12, 2015, 04:55:30 pm
content: You can get OCXO's of 10MHz like Isotemp or Marion very cheap, Marion 89a it's an DOCXO and it cost around $20, the 103 around $10, and it's a lot better.

author: technix
author_rank: Super Contributor
timestamp: May 12, 2015, 05:00:41 pm
content: Quote from: evb149 on May 12, 2015, 04:45:08 pmI do have a u-blox 6010 GPS module with TTL-level 9600 baud UART and PPS output...

author: Richard Crowley
author_rank: Super Contributor
timestamp: May 12, 2015, 05:05:19 pm
content: Are there any GPS receivers that output an HF reference (10MHz, etc.)?1 Hz (1 PPS) is fine for wall-clock time-keeping, but is GPS useful for laboratory testing?

author: technix
author_rank: Super Contributor
timestamp: May 12, 2015, 05:07:54 pm
content: Quote from: Nuno_pt on May 12, 2015, 04:55:30 pmThe cheapest 10MHz TCXO I can find is US$1.5/each SMT ones.

author: Nuno_pt
author_rank: Frequent Contributor
timestamp: May 12, 2015, 05:14:21 pm
content: Quote from: Richard Crowley on May 12, 2015, 05:05:19 pmSome, you'll see them on eBay, but they are very expensive.The best to do it's take some GPS board like Navman Jupiter, and similar and take the 10kHz signal run it trough some dividers 74H and then join an OCXO and voilà, you've and GPSDO, Google it.The GPS will give long term stability and the OCXO the short term, the power supply have to be well filter, because of the jitter.The first one are G3RUH with Isotemp, but you can put an Morion, very suite for laboratory test gear.

author: Vgkid
author_rank: Super Contributor
timestamp: May 12, 2015, 05:18:11 pm
content: Quote from: Richard Crowley on May 12, 2015, 05:05:19 pmThe u-blox 6T will run from 1Hz to 10MHz.

author: Liv
author_rank: Regular Contributor
timestamp: May 12, 2015, 05:46:39 pm
content: Quote from: technix on May 12, 2015, 04:43:15 pmFrequency counter - is a device that does not require the exact value of the reference frequency generator, for example, 10.000 MHz. It requires only know exactly the real oscillator frequency, and then in calculating the indicated value to use it. So the idea of passive temperature compensation is quite right to life. Usually MCXO use dual-mode oscillator for quartz self-sensing temperature. But if the demands are not as high, you can use an external thermometer. But it should have high resolution and be isothermal together with the resonator. Once the calibration is required to pass the entire range to produce correction table.Quote from: Vgkid on May 12, 2015, 05:18:11 pmBut with huge jitter.

author: technix
author_rank: Super Contributor
timestamp: May 14, 2015, 10:13:33 am
content: Rounding up suggestions, I will want to use a higher frequency time base for this. So will my 50MHz crystal oscillator (one of those 4-pin cans) help?Also since DS3231 have a far better accuracy than the 50MHz XO, can I use the DS3231 to digitally compensate the errors and provide a stable gate control?