Author Topic: 3 Dollar Precision Frequency Standard  (Read 32990 times)

0 Members and 1 Guest are viewing this topic.

Offline paulieTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
3 Dollar Precision Frequency Standard
« on: April 09, 2015, 04:15:31 pm »
Playing around with my new $10 Ebay frequency counter I noticed it was a few counts off from my old 10mhz reference dug up out of the toolbox. Specs for the oscillator claimed 1ppm/yr and it was coming up a bit outside that. It wasn't obvious whether the TCXO in the counter was off or the one in the reference.

Come Saturday I took advantage of the local ham club shortwave receiver to do some zero beat tuning with WWV and turns out they were both off enough to explain the difference. Both dead on now. Another club member had also purchased one of these counters and used my reference to get his in tune. He wanted to build a cheap standard for himself so I flashed a chip and he was good to go. It occurred to me others might like to throw together something similar. If there's interest I can put up a file and diagram. Anyway here's some photos.

20mhz TCXO can be had on Ebay for a buck or so. This particular unit runs off a single AA cell. It can be alkaline or rechargeable lithium or NIxx. I prefer lithium AA because it can sit on the shelf for years and still have full charge. One of those $1 USB DC-DC converters boosts to the necessary 5v. At 50 cents for the AVR total cost was 3 dollars and change including case and push button.

Starts out at 10.000000mhz but several other useful frequencies are available by simply pushing the divide button:

Code: [Select]
; hits freq (FRQPB303 and later)
; 0 10.000000mhz
; 1  5.0000000
; 2  2.5000000
; 3  2.0000000
; 4  1.2500000
; 5  1.0000000
; 6  .50000000
; 7  .40000000
; 8  .25000000
; 9  .20000000
; 10 .12500000
; 11 .10000000
;   additional entries for FRQPB806:
; 12 80000.000hz
; 13 50000.000
; 14 40000.000
; 15 25000.000
; 16 20000.000
; 17 12500.000
; 18 10000.000
; 19 8000.0000
; 20 5000.0000
; 21 4000.0000
; 22 2500.0000
; 23 2000.0000
; 24 1250.0000
; 25 1000.0000
; 26 800.00000
; 27 500.00000
; 28 400.00000
; 29 250.00000
; 30 200.00000
; 31 152hz
;  after that starts back at 10mhz with original (FRQPB801) inc divisor once per hit (1-65536)

IIRC it eventually gets down to around 150 hz or so by pushing the button enough times. Holding it down does auto-increment but my new counter don't go down that far anyway.




Update: For those who might want to build one a hex code file is attached for Atmel atmega8. Fuseh=C0 Fusel=AF. Button input is pin 6 (PD4) and output is pin 15 (OC1A). Along with photo and info above this should be enough but I'll do a schematic and more details as time allows.




Update: Schematic added for those who like pretty pictures. Don't get much simpler than that.




Update: Another builder mentioned to me that the last couple entries in the table did not work out. I pulled out an old program that calculates divisions and sure enough he was right. Probably what happened was I pressed the button too quickly which caused it to skip entries.

Table is corrected and a copy of a program to calculate divisors and button pushes (DIVCALC.EXE) is attached. Rename w/o the .txt. To use click on it or type the name from command line and it will display results. Starting frequency and number of divisions can be entered as options. Default is 20mhz with 100 divisions. To create a text file of entries append the redirection feature to the CL (" divcalc >filename").




update: As promised a file for Mega328 (FRQPB303.HEX) is uploaded. Instead of having to hit the button a hundred times to get to 100khz only a few because each hit skips directly to next frequency in the above table. At the end it goes back to original method to allow many more divisions all the way down to 152hz.

Wiring is the same as Mega8 with addition of 20mhz clock out on PB0 pin. Not available on Mega8 because it has no CKOUT fuse option. To enable this hfuse=0xd0 lfuse=0xaf. If this feature is not used I think fuses can be left the same as Arduino. Arduino programs still work with the new oscillator. It's only necessary to tell the compiler to use 20mhz instead of 16mhz by adding an entry in BOARDS.TXT. Timing will be a lot more stable and accurate now. A friend tells me when not used as frequency reference he gets less than 2 seconds/week drift on his Pro Mini with an Arduino calendar clock program.

Note that these m8 and m328 programs also work with regular 16mhz crystal instead of TCXO. You get different frequencies but still useful like 8.000000mhz, 4.000000mhz, 2.000000mhz, 1.000000mhz, 0.500000mhz, etc.. Not everybody needs 1ppm precision.




update: Recently I needed fast access to frequencies in the 38khz/40khz range for some IR remote and ultrasonic module projects. Also working with audio circuits so the original program has been updated. The table above is edited to show the new hit counts and several more useful numbers have been added. Button pushes now skip quickly down into the audio range including 152hz. After that it restarts with one divisor per hit like the old version.

Also the button down delay is reduced so you can hit it faster. This speeds up auto increment too. A new file (FRQPB806.hex) is attached below.




...
« Last Edit: May 23, 2015, 01:38:58 am by paulie »
 

Offline indy

  • Newbie
  • Posts: 2
Re: 3 Dollar Precision Frequency Standard
« Reply #1 on: April 10, 2015, 01:54:22 pm »
I was looking for a frequency reference and a time mark generator to allign my scope (somthing  like http://www.davidbridgen.com/calbox.htm )
Here I've found very good idea, and could be the basis for a nice calibration tool. Just add a narrow pulse output like the one used into calbox or into Tektronix TG 501 and 1 2 5 steps.
So yes I'd like to know some details.
 

Offline Lightages

  • Supporter
  • ****
  • Posts: 4313
  • Country: ca
  • Canadian po
Re: 3 Dollar Precision Frequency Standard
« Reply #2 on: April 10, 2015, 03:40:37 pm »
Yes, please publish the files!
 

Offline mtdoc

  • Super Contributor
  • ***
  • Posts: 3575
  • Country: us
Re: 3 Dollar Precision Frequency Standard
« Reply #3 on: April 10, 2015, 03:58:51 pm »
Yes, please do!
 

Offline Thor-Arne

  • Supporter
  • ****
  • Posts: 500
  • Country: no
  • tinker - tinker, little noob.....
Re: 3 Dollar Precision Frequency Standard
« Reply #4 on: April 10, 2015, 10:20:23 pm »
Interesting, I'd like to know more.  :-+

I've been wondering; Does increased frequency in OCXO increase the precision when divided down ?
 

Offline Skimask

  • Super Contributor
  • ***
  • Posts: 1433
  • Country: us
Re: 3 Dollar Precision Frequency Standard
« Reply #5 on: April 10, 2015, 10:55:17 pm »
Nope.
1% off at 1Thz is still 1% off at 1Hz...
I didn't take it apart.
I turned it on.

The only stupid question is, well, most of them...

Save a fuse...Blow an electrician.
 

Offline Thor-Arne

  • Supporter
  • ****
  • Posts: 500
  • Country: no
  • tinker - tinker, little noob.....
Re: 3 Dollar Precision Frequency Standard
« Reply #6 on: April 10, 2015, 11:09:39 pm »
Ok, thanks.

So no point in going for a as high at possible base frequency and divide it down.

Nothing wrong by wanting a high max frequency.
 

Offline paulieTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: 3 Dollar Precision Frequency Standard
« Reply #7 on: April 10, 2015, 11:14:26 pm »
True, no hit on accuracy. And multiplying harmonics like the method in the link indy posted above also no penalty. Unlike boosting with PLL which may not impact frequency but does introduce jitter. I do find the transistor multiplier circuit in that link interesting and my give the circuit a try myself.

ps. Hex file and a little more info added to first post. Thanks for showing interest. A few of the onlookers at last weekend ham meeting also want to make one now so there appears to be a real need for a time calibration unit. Maybe not rubidium clock or locked to GPS but don't cost hundreds of dollars either.
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: 3 Dollar Precision Frequency Standard
« Reply #8 on: April 10, 2015, 11:46:13 pm »
Thank you skimask, that was one of the only remaining nags in my head about a frequency counter project i have been doing on and off, using a big divider so i could use a reciprocal counter to measure ppm drift over time on a frequency,
 

Offline netdudeuk

  • Frequent Contributor
  • **
  • Posts: 447
  • Country: gb
Re: 3 Dollar Precision Frequency Standard
« Reply #9 on: April 11, 2015, 02:48:07 pm »
Good project but no TCXOs for a dollar or anywhere near that on eBay UK.
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11534
  • Country: my
  • reassessing directives...
Re: 3 Dollar Precision Frequency Standard
« Reply #10 on: April 11, 2015, 03:43:31 pm »
So no point in going for a as high at possible base frequency and divide it down.
there is, your tiny device will be capable of as high as possible frequency output. there is no pll output on that avr so you cant, say 1MHz base freq to produce multiplied 20MHz. i guess the fw is just adjusting its clk prescalers by button push. to push the limit further down, you can add dummy nops in your "led blinker" loop. and btw, the $3 avr is outputting square wave right? not pure sine?
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Thor-Arne

  • Supporter
  • ****
  • Posts: 500
  • Country: no
  • tinker - tinker, little noob.....
Re: 3 Dollar Precision Frequency Standard
« Reply #11 on: April 11, 2015, 09:46:03 pm »
I took a quick search for oscillator used in the OP's pic, ebay retuned only one hit.

Seller claims "I have no further specs available for this item as is is a proprietary part made by Raltron", so no datasheet I assume.

It's $4.99 for a lot 5 units, shipping to Noway is $29.34. Which is not going to happen.  :--
Shipping rates inside US should be acceptable.
 

Offline paulieTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: 3 Dollar Precision Frequency Standard
« Reply #12 on: April 11, 2015, 11:26:40 pm »
Yeah... that's just one of the dozen or so deals I snagged since getting into this last week. It does take some shopping effort. Like favorite fishing hole, few will beat a path to your doorstep to clue you in on best bargains.  Generally to get good deals it may be necessary to buy more than one at a time and often takes some bidding or BO. Otherwise be prepared to spend a few dollars more.

Getting "pretty" numbers cheap is a little harder but if you just need stabilty and accuracy like for calibrating scope or counter then absolute frequency don't matter. With a little luck and open eyes sometimes high performance devices that might cost $10 or $20 over the counter can be had for pennies:



If you don't want to bother hunting for bargains then they are almost always available for a buck or two more:

http://www.ebay.com/itm/181032108148?_trksid=p2055119.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT
http://www.ebay.com/itm/191425644527?_trksid=p2055119.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT
http://www.ebay.com/itm/160999666268?_trksid=p2055119.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT

You can expect deals on Aliexpress to run a dollar or two below Ebay as a result of bandit Paypal fees. I rarely go that route myself though because of the excellent Ebay buyer protection.

ps. Also note that temperature compensated is not the only option here. If your environment is relatively stable around room temperature a regular crystal with trim cap will often suffice. Two of my fellow amateur radio buffs went that route and very satisfied. In my case temperature in the shop varies too much. For example in the last week recorded from 6C to 22C. I only heat when working so TC is more than a luxury. YMMV
« Last Edit: April 12, 2015, 12:10:24 am by paulie »
 

Offline paulieTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: 3 Dollar Precision Frequency Standard
« Reply #13 on: April 12, 2015, 12:00:28 am »
The comment about it running on an AAA cell made it seem like it was a PCB assembly product of some kind...?  Most discrete oscillator through hole component units run on +5V or +3.3V or +2.5V or rarely +1.8V right?

Notice the photo and reference in OP to "USB DC-DC boost converter". These are available from china for 20-30 cents or sometimes for a buck at Dollar Tree like the one in my photo. In fact the oscillator in mine runs off anything from 3.3v-5v so a bare lithium AA technically requires no converter. However it is nice to be able to pop in a 1.2v NIxx or 1.5v alkaline in a pinch.

Nothing says you have to use batteries anyway. 5v from a wall wart or USB plus works fine too. Personally I do like to be able to carry these projects around in my pocket and not depend on the "kindness of strangers" for power.

BTW if you expect to get that kind of help on these forums it's a good idea to include at least country in your avatar. Child molesters unlikely to locate your home with such general info.
 

Offline Vgkid

  • Super Contributor
  • ***
  • Posts: 2710
  • Country: us
Re: 3 Dollar Precision Frequency Standard
« Reply #14 on: April 12, 2015, 12:19:02 am »
If you start delving into part numbers, you can get some pretty schmick parts for not a lot of cash.
If you own any North Hills Electronics gear, message me. L&N Fan
 

Offline Dago

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: fi
    • Electronics blog about whatever I happen to build!
Re: 3 Dollar Precision Frequency Standard
« Reply #15 on: April 12, 2015, 06:56:27 am »
Good oscillators from a real distributor are also not that terribly expensive, like this +-0.28ppm 10 MHz oscillator http://www.digikey.com/product-detail/en/DV75C-010.0M/CW750CT-ND/3524566
Come and check my projects at http://www.dgkelectronics.com ! I also tweet as https://twitter.com/DGKelectronics
 

Offline MK

  • Regular Contributor
  • *
  • Posts: 233
  • Country: gb
Re: 3 Dollar Precision Frequency Standard
« Reply #16 on: April 12, 2015, 09:05:18 am »
The most stable quartz cuts with the best specs are usually around the 3-30MHz range, above that they are running at overtones usually, and below that they are getting quite large, and more microphonic.
 

Offline paulieTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: 3 Dollar Precision Frequency Standard
« Reply #17 on: April 14, 2015, 05:36:50 pm »
Due to some offline requests a diagram has been attached to first post:

 

Offline paulieTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: 3 Dollar Precision Frequency Standard
« Reply #18 on: April 17, 2015, 09:59:32 pm »
So one week after the first WWV "tune-up" I checked again and drift for the Ebay counter varied between 0-1 count (0.1ppm) and reference 1-2 counts (0.2ppm). Interestingly another club member brought in his rubidium based standard and it was 2-4 counts off over 10 minutes. IDK if this is normal for those or a defect but at 1% the cost these cheap oscillators seem to do very well by comparison. I may do another checkup in a month or two.
 

Offline paulieTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: 3 Dollar Precision Frequency Standard
« Reply #19 on: April 20, 2015, 10:01:00 pm »
btw, the $3 avr is outputting square wave right? not pure sine?

Yes, coming from AVR pin a VERY square wave. In fact because of Atmel output components sharper edges than you might see on any other MCU in its class. So lots of harmonics, probably way up into microwave region. As mentioned in the Ridgen Calbox blog this is good if you're doing things like calibrating scope probes, LA, etc.. Maybe not so great for distributing signals from GPSDO or Rubidium unit because in some few cases equipment being fed misbehaves w/o clean signals. Judging from that thread here asking about square vs sine not a big problem though.

Anyway in the process of playing around with transistor multiplier ckt like in the Calbox site and also a poor mans WWV receiver project I built several different 10mhz resonant LC circuits. My goal was to see how cheap one could get. I found by winding a few turns of thin wire around a paper form and tacking on a small ceramic total cost was possible under 10 cents. That includes using half an axial ferrite bead as tuning slug. I wondered what about hooking it up to output of the 10mhz frequency reference to suppress those nasty odd harmonics. Lo and behold, result was clean fundamental sine wave. At least as far as I could tell w/o a lab grade spectrum analyzer. Looks great on the scope and very little picked up on HF and VHF reciever.

For those who might be curious here's a pic.

 

Online Alex Eisenhut

  • Super Contributor
  • ***
  • Posts: 3330
  • Country: ca
  • Place text here.
Re: 3 Dollar Precision Frequency Standard
« Reply #20 on: April 20, 2015, 10:12:20 pm »
Did someone say three dollars?
Hoarder of 8-bit Commodore relics and 1960s Tektronix 500-series stuff. Unconventional interior decorator.
 

Offline netdudeuk

  • Frequent Contributor
  • **
  • Posts: 447
  • Country: gb
Re: 3 Dollar Precision Frequency Standard
« Reply #21 on: April 22, 2015, 07:36:37 am »
Could this be easily made to run with an AT Tiny85 ?

Or a 328P ?
« Last Edit: April 22, 2015, 07:39:46 am by netdudeuk »
 

Offline paulieTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: 3 Dollar Precision Frequency Standard
« Reply #22 on: April 22, 2015, 11:21:12 pm »
328 may not be favorable because it is not code compatible with m8 and provides no actual advantages. Tiny85 however is code compatible with m8. So much so that I have many hex files that run on either chip un-modified. In my case m8 was chosen because it was available at lower cost than any other AVR including the Tiny series. Even bottom of the line Tiny13.

Mechatrommer hints that an MCU with PLL would allow multiples of the input clock to be generated. The Tiny85 does have a PLL capable of 64x but unfortunately only works with internal "calibrated" RC clock which is useless for a precision frequency source. Maybe STM or some other processor has ability to use external clock with PLL. That would be nice.

BTW I was able to double and even quadruple oscillator frequencies using 74hct86 XOR gates with a couple resistors. Unfortunately that does increase complexity/build-time and bust the $3 barrier. Also maybe tough to fit in that cheapo case/battery holder.
 

Offline netdudeuk

  • Frequent Contributor
  • **
  • Posts: 447
  • Country: gb
Re: 3 Dollar Precision Frequency Standard
« Reply #23 on: April 23, 2015, 06:58:24 am »
Does the attached hex file run directly on the Tiny85 ?

Thanks.
 

Offline paulieTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: 3 Dollar Precision Frequency Standard
« Reply #24 on: April 23, 2015, 04:29:24 pm »
It's been a while since I played with that code but IIRC this version does not run on ATTiny. I do have a version that definitely does run on both and could maybe dig it up if there's interest.

It was a little different regarding divider selection. Instead of one hit you had to enter four groups of button pushes to define the divider. This has the advantage of skipping ahead to virtually any frequency without needing to push up to 65536 times. I went with the one push version here because it's simpler and only the first few frequencies as seen in that table are compatible with my new counter. It also sends the numbers out serial at 57kbaud. Maybe this version does that too, but I'm not positive.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf