|
Homebrew Equipment A place to show, design and discuss the weird and wonderful electronic creations from the hands of individual members. |
|
Thread Tools |
9th Nov 2016, 3:46 pm | #1 |
Dekatron
Join Date: Jun 2016
Location: London, UK.
Posts: 3,687
|
Homebrew frequency counter
A little diversion from the oscilloscope project which is awaiting my patience to return after winding a large transformer for it. I decided I needed a new frequency counter as I'm currently using a DMM with a somewhat low 5 digit resolution, so I scanned the Internet for something with a decent feature set and built one. This is a bit high tech compared to a lot of stuff on here. I was going to build one with 74-series logic and sweat but if I'm honest I couldn't be bothered to wire the whole thing! Plus the one I found has some interesting features including the ability to do some basic mathematical operations on the measured frequency to add or subtract various IFs. It has 10MHz and 455KHz pre-programmed which is very handy. Not something you get on a TTL design.
After some arguments with programming a PIC, something I haven't done for a few years, it works nicely. Construction is dead bug/PCB box style. No prizes for pretty but the RF parts are short and the rest is convenient. Lid is awaiting more FR4 stock. Legend is Inkscape generated with Futura font stuck on with scotch tape. Build photos below. Please excuse the quality. My DSLR is in for repair so I'm stuck with awful phone camera Original source: http://www.hamradio.in/circuits/freq_counter_lcd.php. I built the PIC16F628 version as I had some of them on hand already. The original design was from VU3CNS. Highly recommended. Seems to work perfectly. Note: I had to modify the source code as I had a 16x2 display available only and this was for a 16x1 display. This consisted of naively removing all 0xc0 writes to the display, assembling it and crossing fingers. Now this got me interested in obtaining a frequency reference so I'm going to go and research PLLs locked to Radio 4! |
9th Nov 2016, 10:30 pm | #2 |
Moderator
Join Date: Mar 2012
Location: Fife, Scotland, UK.
Posts: 22,896
|
Re: Homebrew frequency counter
I'm not sure radio 4 is as closely controlled as it once was. You may be better off with 60kHz from Anthorn, or else something locked to the 1 second ticks from most GPS chipsets.
David
__________________
Can't afford the volcanic island yet, but the plans for my monorail and the goons' uniforms are done |
9th Nov 2016, 11:24 pm | #3 |
Dekatron
Join Date: Jun 2016
Location: London, UK.
Posts: 3,687
|
Re: Homebrew frequency counter
Its carrier is locked to a rubidium standard still. Good enough and it's pretty good excuse for me to play with PLLs.
|
10th Nov 2016, 11:28 am | #4 |
Dekatron
Join Date: Nov 2006
Location: London, UK.
Posts: 3,496
|
Re: Homebrew frequency counter
Nice concept and build , like it!! Can you post pix of the readout and front panel when you have them ??
Cheers
__________________
Al |
10th Nov 2016, 11:49 am | #5 |
Dekatron
Join Date: Jun 2016
Location: London, UK.
Posts: 3,687
|
Re: Homebrew frequency counter
Yes. Here you go. Signal source (function generator) is set to ~135KHz in all the examples below and the IF is selected as IF 9 (10MHz). Hard coded IFs are supported as follows:
D = direct frequency measurement 0 = 455KHz (AM typical IF) 1 = 4915KHz 2 = 9MHz 3 = 10MHz 4 = 10.7MHz (FM typical IF) 5 = 4333KHz 6 = 10.245MHz 7 = 10MHz 8 = 10MHz 9 = 10MHz I've picked IF 9 (10MHz) and gate time of 1s for these as it's easy to see it working. You can pick a 125ms gate time at loss of precision. Mode = >D direct measurement. 125ms gate time VFO = 135KHz. Mode = >9N IF+VFO, IF = 10MHz, VFO = 135Khz Mode = >9N VFO-IF, IF = 10MHz, VFO = 135Khz Mode = >9N IF-VFO, IF = 10MHz, VFO = 135KHz Mode = >9N IF+VFO, IF = 10MHz, VFO = OFF |
10th Nov 2016, 5:21 pm | #6 |
Octode
Join Date: Jan 2014
Location: Oban, Scotland, UK.
Posts: 1,129
|
Re: Homebrew frequency counter
Very nice project. I admire your skills with circuit-board casing!
It is certainly a good project for those not yet converse with using PIC processors and the methods used to program them. The website of the original article also has a DDS VFO project. I've built a cut-down version of it (using only the rotary encoder, no keyboard) to make an RF signal generator. Works very well. Working my way through their other articles right now! |
10th Nov 2016, 5:38 pm | #7 |
Dekatron
Join Date: Jun 2016
Location: London, UK.
Posts: 3,687
|
Re: Homebrew frequency counter
It looks better in the photos
I only had a serial programmer and no serial ports so had to bodge a programmer with an arduino and some other hacks. I don't recommend this but it worked. Interesting with the DDS. I'm in the process of breadboarding an RF generator but fully analogue. Just waiting for my spectrum comms delivery for the tuning capacitors. Didn't fancy dealing with a DDS stack after the counter as my day job is software and that makes it a busman's holiday. Last edited by MrBungle; 10th Nov 2016 at 5:52 pm. |
11th Nov 2016, 12:54 pm | #8 |
Octode
Join Date: Jan 2014
Location: Oban, Scotland, UK.
Posts: 1,129
|
Re: Homebrew frequency counter
Fortunately my DDS VFO conversion doesn't involve any changes to the original programming - simply don't fit the unused parts (keyboard, second PIC etc) and use the rotary encoder to select the required digit to increment/decrement and then 'push-to-set' !!!
A simple 50ohm manually switched 1-2-4-8.... resistive attenuator and Robert's your mother's brother. If/when I get around to it I'll add my own VCA and properly calibrate the output. I hate unnecessary complications! |
11th Nov 2016, 1:28 pm | #9 |
Dekatron
Join Date: Jun 2016
Location: London, UK.
Posts: 3,687
|
Re: Homebrew frequency counter
I'll take a look at the design actually. It might be less frustrating and more stable than a traditional tuned circuit. I've almost got a working generator on the bench but annoyingly i managed to design the ranges badly so I've got a range break right at 10MHz in the middle of an IF which makes filter sweeps difficult. Back to the drawing board!
Switched attenuator is next project. Plan is to get this to kick out constant 10dBm with an AGC circuit and then attenuate what I need off. |
11th Nov 2016, 8:40 pm | #10 | |
Dekatron
Join Date: Sep 2010
Location: Cheltenham, Gloucestershire, UK.
Posts: 3,077
|
Re: Homebrew frequency counter
There was a similar '628 PIC based counter in Radcom a few years ago By Eamon Skelton and this had an 8 digit display, an 80MHz range and resolved down to 1Hz with a 1 second gate time. It might be worth a look if you want the extra digit and resolution? It uses the same PIC chip.
http://homepage.eircom.net/~ei9gq/counter.html Quote:
However, a few years ago I finally upgraded it to an enclosure made from an ice cream tub The same two ugly prototype PCBs are in there but I did clean all the dust off it and tidy the PCB layout a bit. It works very well and it takes less than 1 minute to lock to within about +/- 0.02Hz of 10MHz (typical). If I average the readings over a longer time it can deliver better performance than this but I am happy with a quick plug/play readout within 0.02Hz of 10MHz. I use it maybe once or twice a year to check all the OCXO references in my RF test gear. I don't use it as a 'real' day to day reference to control/lock all my RF test gear as it's too noisy for one thing and I just use it to check stuff annually.
__________________
Regards, Jeremy G0HZU |
|
11th Nov 2016, 10:00 pm | #11 |
Heptode
Join Date: Mar 2009
Location: Portsmouth, Hampshire, UK.
Posts: 674
|
Re: Homebrew frequency counter
It makes me realise how fast time flies when I remember that most of the PIC based counters are based on a Microchip application note published nearly twenty years ago. (AN592 - Frequency Counter Using PIC16C5x).
Jim |
11th Nov 2016, 11:13 pm | #12 |
Moderator
Join Date: Mar 2012
Location: Fife, Scotland, UK.
Posts: 22,896
|
Re: Homebrew frequency counter
There's always the PW 'Robin' counter project.... by a certain Swordholder once of these pages and sadly missed.
David
__________________
Can't afford the volcanic island yet, but the plans for my monorail and the goons' uniforms are done |
11th Nov 2016, 11:35 pm | #13 | |||
Dekatron
Join Date: Jun 2016
Location: London, UK.
Posts: 3,687
|
Re: Homebrew frequency counter
I saw the PW Robin counter design. That was where I started but I couldn't trade off the design with a cheap PIC. It's a remarkable piece of equipment however. Sad to hear that the creator is no longer with us.
AN592 was actually inspiration for this incarnation many years ago, I think around 1998. Unfortunately quashed by lack of funds and time and the destruction of a serial port by a poorly constructed JDM programmer (oops!). I found a reference to it in a notebook from back then and decided to have a look around for similar projects as things must have improved. Turns out they had! Quote:
Quote:
On that subject, I have my head in a 1st edition copy of Art of Electronics reading about PLLs at the moment. They have a lab experiment in the accompanying lab manual that gives you a full rundown of building a PLL based frequency multiplier with a 4020 and a 4046. I am awaiting an RS delivery on Monday to play with this idea. Last edited by MrBungle; 11th Nov 2016 at 11:40 pm. |
|||
12th Nov 2016, 4:47 pm | #14 |
Dekatron
Join Date: Sep 2010
Location: Cheltenham, Gloucestershire, UK.
Posts: 3,077
|
Re: Homebrew frequency counter
There are a few niggles with respect to the design of this type of offair standard which you probably already know but I'll list them anyway.
The R4 signal is modulated with AM and other LF information and this means it can be difficult to design a loop filter that can cope with this and settle reliably. It took me quite a few attempts to find the right filter. Also, the lock performance varies depending on the time of day. During the day my offair std generally performs at its best but there can be times in late afternoon and into the evening where it really struggles to settle reliably. So I tend to choose my moment to use it depending on reception quality. I only live about 25 miles from the transmitter which helps but even then the performance can suffer under certain conditions. Also, the performance can degrade if there are any modern gadgets like laptop or camera PSU/chargers or modern lamps running. I designed my offair standard as a crude experiment back in about 1991/2 to see if I could hard limit the signal enough to get a stable lock. So my system consists of a tuned ferrite rod antenna, a JFET preamp followed by a tight BPF made from high Q RM4 based inductors and then another amp and hard limiter ahead of a comparator. This then feeds a /99 divider made from a HEF4059 programmable divider and the PLL is a classic 4046 with a PD freq of 2kHz and I used 74HC390 dividers to divide the 10MHz VCXO down to 2kHz. At the time some of my more experienced colleagues reckoned it would never work but I tried and it worked well enough for my needs. At the time I just needed to check my counter at home was within a few Hz of 10MHz to prove I could adjust a typical ham/CB radio to be on frequency. The performance turned out to be much better than this once I'd spent some time messing with various loop filter settings. The idea was always to make a neat/proper version in a decent enclosure but it never happened. I just kept it in a cardboard box and dug it out once a year and usually it worked OK unless a wire fell off. It was just a fragile prototype after all. Now that it is in the ice cream tub I think I will never bother to make the neat/proper version. It has been very reliable since it found its new home (sponsored by Walls ice cream).
__________________
Regards, Jeremy G0HZU Last edited by G0HZU_JMR; 12th Nov 2016 at 5:02 pm. |
12th Nov 2016, 6:55 pm | #15 |
Dekatron
Join Date: Jun 2016
Location: London, UK.
Posts: 3,687
|
Re: Homebrew frequency counter
I'm listening. Any gotchas and dragons I'd like to know about beforehand so any pointers are indeed appreciated. Thanks for the tip regarding the radio data. I'm not sure what phase shift modulation will do to this. I'm not after extreme accuracy (a couple of Hz either way is fine) but confidence in the measurements I'm making with the counter.
That's pretty close to the design I did on paper this morning actually. I dumped the 4046 idea as the max frequency is getting a bit tight on that series of CMOS devices. Therefore I've now got a 1MHz crystal tunable with a varactor, or a 36v zener pretending to be a varactor with some fingers crossed about the tuning linearity! The frequency divider does a /5, /10, /10 with a couple of 74hc390's and this is mixed with the carrier. Loop filter I will play with at the time of construction. Phase detector; it looks like you can get away with a 74hc00 for that. I still need to fully understand how that works. The RX is a simple TRF with ferrite antenna with a TA7642 (ZN414 clone) being the brains of the outfit. I built one a few years back that worked here in London. Unfortunately I'm allergic to lactose so no tubs of Walls for enclosures for me On the subject of the counter, I'm actually redesigning the front end. The current one has a slightly unpredictable and low impedance input. I've designed a FET follower, amplifier and schmitt trigger in LTspice that appears to be good to about 75MHz and is slightly more sensitive (50mV instead of 160mV) with a constant 1M impedance. I'll document that when it works. |
13th Nov 2016, 12:49 am | #16 |
Moderator
Join Date: Mar 2012
Location: Fife, Scotland, UK.
Posts: 22,896
|
Re: Homebrew frequency counter
74HC4046 is a substantially faster part.
The VCOs in these things are pretty low-Q and noisy, but if you're only using it for the phase/frequency detector, then it's no problem. David
__________________
Can't afford the volcanic island yet, but the plans for my monorail and the goons' uniforms are done |
13th Nov 2016, 12:57 am | #17 |
Dekatron
Join Date: Jun 2016
Location: London, UK.
Posts: 3,687
|
Re: Homebrew frequency counter
I had no idea there was a 74hc version of that. Will investigate. Thanks for the pointer.
|
13th Nov 2016, 1:38 am | #18 |
Dekatron
Join Date: Sep 2010
Location: Cheltenham, Gloucestershire, UK.
Posts: 3,077
|
Re: Homebrew frequency counter
Yes, I used the 74HC4046 version of the 4046 in my offair standard. Also I used the HC versions of the 390 counters. The HEF4059 was an old device that could be programmed to divide by 99 using pullup/pulldowns to its parallel interface. So no need to have a micro to program it as it could be hard programmed to /99. I looked back through my records and I put it into the ice cream tub about 3.5 years ago. See below for a plot from last year when I logged the stability over several minutes.
This is a typical 'daytime' result. At night or if there are strange conditions it can be several times worse than this. But during the day it normally wobbles up and down as per the graph below. i.e. it usually stays within 0.04Hz and often stays within 0.02Hz of 10MHz. But you do sometimes get an erratic step away from 10MHz as you can see in the plot below. This is easily good enough for my needs.
__________________
Regards, Jeremy G0HZU |
12th Dec 2016, 2:58 pm | #19 |
Dekatron
Join Date: Jun 2016
Location: London, UK.
Posts: 3,687
|
Re: Homebrew frequency counter
That's actually quite amazingly stable. I've scrapped this idea in the short term as I've got my hands on a rather nice OCXO based counter which is good enough for what I need at the moment, especially as I've managed to beg a free cal against a rubidium standard with it
Back on the subject of frequency counters, after spending 5 hours on Sunday in the guts of my Marconi 2019A, now driven from the reference output from the above (serendipity at last!), as I've revived the attenuator module! Turned out there was an open resistor which had caused it to drop everything to about -80dBm, not enough to register on this homebrew counter. So, I spent a few minutes pushing it as hard as possible and I can count reliably up to 27.5MHz with the design as shown above. This is fine for anything below the 10m band and conveniently with approval of SWMBO, living room table material unlike the big daddy counter. |
13th Dec 2016, 6:03 am | #20 |
Nonode
Join Date: Oct 2010
Location: Tintinara, South Australia, Australia
Posts: 2,340
|
Re: Homebrew frequency counter
You might want to check the biasing on the input transistor. the collector should sit at 2.5V (with a 5V supply and no input).
I've built many 16F628 frequency counters and most count reliably to 50MHz (some even higher). Terry |