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:
; 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.