As an amateur radio enthusiast, I have found on several occasions that it would have been handy to have a frequency counter available in my arsenal of test equipment. But, like most amateur radio enthusiasts on a budget, I could not justify spending hundreds of dollars on said equipment. In addition I wanted a frequency counter to help with the analog dial alignment process on my vintage Kenwood TS-520S SSB Transceiver. In order to save money I decided to look at Kit Based or Build Your Own options.
Kit Based versus Build Your Own
There are plenty of frequency counter kits online. Some from reputable kit providers such as Canakit, others from providers of dubious reputation. Most kits I did find online have a limited frequency range, typically only up to 2Mhz. I also know that it is much easier to build a frequency counter these days because much of the old logic circuitry can be replaced with a single PIC microcontroller. After searching online with Google using "PIC base frequency counter" as the search phrase, I found the perfect solution for me. It was a PIC based frequency counter build by amateur radio enthusiast Wolfgang "Wolf" Buscher (DL4YHF). Wolfe claimed that his PIC based frequency counter had a frequency range of 1Hz to 50Mhz with only a handful of parts! This sounded like a perfect solution for me!
Giving credit where credit is due!
The PIC based frequency counter that I describe and build in this lens is not of my own design. It was based on a design by amateur radio enthusiast Wolfgang "Wolf" BÃ¼scher (DL4YHF). Wolf designed the circuit and created the firmware to be installed on the PIC microcontroller used in this circuit. Click here to visit Wolf's site. What I do bring to the table is, in my opinion, an easier to read schematic and complete parts list with parts numbers sourced from Jameco electronics. In addition, I provide high resolution pictures of the assembly of my frequency counter.
My updated schematic and parts list
Unfortunately you cannot see the pin numbers on the 16F628 when I converted the Visio schematic to JPG. I can provide this schematic in PDF format.
SW1 is a slide switch that controls power to the frequency counter. REG1 drops the battery voltage from 9 volts to a steady 5 volts. C2 acts as a decoupling capacitor and is used to reduce noise from the power supply. C1 blocks DC from entering the amplifier circuit consisting of R2, R3 and Q1. Q1 feeds the amplified input to pin 3 of the 16F628.
The firmware programmed into the 16F628 allows this PIC microcontroller to perform the necessary logic functions to convert the frequency of the input signal to a format readable on the 7 segment displays.
The firmware programs pin 3 as an input port. The circuit consisting of R4 and SW2, a momentary switch, allows you to enter a program function where you can set or remove a frequency offset. When pin 4 goes low, the 16F628 goes into offset program mode. C3, C4 and X1 form a resonant circuit used to provide a timing signal to the 16F628.
Pins 6, 7, 8, 9, 10, 11, 12, 13 of the 16F628 are programmed by the firmware to be output ports. They are connected to current limiting resistors R5 through R12 and drive specific segments of the 7 segment LED readout. The 16F628 firmware is setup to multiplex the output to the LED display, only one 7 segment digit is on at a time. The multiplexing happens so fast that all five 7 segment digits appear to be on at the same time.
Multiplexing of the 7 segment displays are handled by pins 1, 2, 17, 18 of the 16F628. These pins are also set up as output, when output is low one or more segments of a specific digit will be lite. There are not enough output pins on the 16F628 to directly allow a fifth digit to be multiplexed so the circuit designer came up with a creative way to drive this digit. The fifth digit lights when when Q2 is in the on state. Q2 is triggered when pins 1, 2, 17, 18 of the 16F628 are a logic high. D2, D3, D4, R13, and Q2 effectively form a four input NAND gate. D1 prevents Q1 from conducting if the base-emitter voltage is less than the forward voltage of the other diodes.
Programming the PIC microcontroller
Before you build the frequency counter circuit, you need to load the firmware into the 16F628 microcontroller. This is accomplished with a PIC programmer. While there are many plans for PIC programmers on the Internet, I recommend purchasing the Canakit CK1301 kit. It is fairly inexpensive (under 40 US dollars) and connects to your computer by USB connection where most do-it-yourself PIC programmers still require a serial port. How many computers these days are still equipped with a serial port? Owning a PIC programmer is a must for electronic hobbyist these days as many projects revolve around the inexpensive PIC microcontroller. The instructions that come with the Canakit CK1301 kit tell you how to build the PIC programmer, install the Microchip MPLAB software on your computer, and how to do initial testing. Simply insert a 16F628 PIC microcontroller into the socket making sure pin 1 is properly oriented, click here to download the firmware from Wolfgang Busher's site. It should be contained in a file called freq_counter.zip Open this Winzip file and copy the counter2.hex to your desktop. This is the firmware required for this project. Open PICKit 2 Programmer Software then choose File form the menu then Import Hex from the drop-down menu and point to the counter2.hex file on your desktop then choose Open. Click on the Write button, the firmware should be uploaded to the 16F628. You can remove the programmed 16F628 from the programmer as the firmware has been installed.
PIC Programmer kits on Amazon
I used the CanaKit CK1301 PIC programmer for this project. It was easy to assemble and worked great!
My first rule of thumb when building a new circuit is to always build it on a breadboard first before committing to a more permanent media such as perfboard or printed circuit board. You will find plans and schematic diagrams on the Internet that simply do not work. There is no governing body for schematics posted on the Internet so it is "Hobbyist Beware". Luckily this circuit performed exactly as the creator described. Check out the frequency generator in the lower left-hand corner, I built this while I was a junior in high school. It is ready for a "Extreme Project Makeover"........maybe a new case and some shiny knobs!
Committing the Frequency Counter to a Printed Circuit Board
OK, so the frequency counter circuit worked on the breadboard. Now it is time to commit it to a printed circuit board. I like to use Radio Shack (Model 276-170) printed circuit boards because it closely matches the layout of my breadboard. This makes it easy to transfer the circuit from breadboard to printed circuit board. I use a dab of hot glue to keep all of the wiring in place.
Once committed to the printed circuit board you need to re-test the frequency counter. This time I tested the circuit by connecting it to the VFO output of my vintage Kenwood TS-520S SSB Transceiver.
Finishing the project
Now it's time to complete the frequency counter project by mounting the printed circuit board in an enclosure. I use small crafted wooden boxes that I find at our local craft store. They are certainly much more pleasing to the eye than the drab black and blue plastic boxes intended for this purpose. The next step is to drill the holes for the switches, for mounting the frequency counter printed circuit board, the 9 volt battery clip, and the input terminals. At this stage I also gather all of the screws, nuts, lock washers and other hardware required to finish the project. You can see in the picture that all of the hardware needed is in the red sandwich keeper above the wooden box.
Finishing the wooden craft box
The wooden craft boxes from the local craft store are unfinished. I like to put a couple coats of clear polyurethane on them so that you can still see the natural beauty of the wood. First I use a pencil eraser to remove all of the pencil lines on the box that I used to mark holes for drilling. Then I take a fine grit sandpaper and carefully hand sand the box until all of the saw and routing marks have been removed. Save yourself some time and only sand the outside of the wooden box, the only time you will see inside the enclosure is when you are replacing the battery. I typically put two coats of polyurethane on the wooden box, sand the outside with an ultra fine grit, wipe all of the sanding residue of off the enclosure with a clean damp cloth, then apply the final coat.
Final Assembly - Mounting the Frequency Counter Printed Circuit Board
Time to mount the frequency counter printed circuit board, I use four long mounting screws to secure it to the front cover. I use two nuts per screw on the back to adjust distance between the printed circuit board and the display hole in the front cover. In addition, I mount the momentary program and power slide switch. I use a dab of gold paint on the screw heads so that it matches the copper hinges and clasps that were included with the wooden box.
Final Assembly - Mounting the battery holder and regulator board
The last step is to mount the Fahnestock clips for the measured frequency input, the 9 volt battery holder, the regulator printed circuit board then connect the wiring. I salvaged a perfboard with a LM7805 regulator on it from a now defunct model railroad project. You can mount the regulator directly to the frequency counter printed circuit board. I then connected a 9 volt battery clip to the input of the regulator board and attached the output to the slide switch. You must also connect the push button switch to the negative output of the regulator board and to pin 3 of the 16F628.
Opps, I see an issue with my wiring. Can you see the mistake?
The mistake is that the power slide switch is on the positive output side of the regulator board. It should be on the positive input side. The problem with my wiring is that the regulator is consuming a small amount of current even when the power switch is off. I will need to correct this problem.
Location of the input terminals
I mount Fahnestock clips on the side of the enclosure, these terminals are to be connected to the input signal for frequency measurement.
Time for final testing before connecting it to a test signal. Upon power up, you should first see all segments of the five 7 segment digits light as a test then a 0 will show up in the fourth digit from the left. When you press the button you will be placed in program mode you will see "Prog" on the display. Please click here to read find out more about the adding or subtracting the frequency offset. Please note: A flashing decimal point indicates the display reading is in kHz, a steady decimal points indicates the reading is in Mhz.
My frequency counter connected to my vintage Kenwood TS-520S
I connect the frequency counter to my Kenwood TS-520S VFO output in order to calibrate the analog dial. When the dial is properly calibrated (on any band), the frequency counter should read 5.5Mhz when both main and subdial are at zero. Make sure you use the proper pointer for SSB(Single Side Band) or CW(Continuous Wave). There are pointers for Lower Sideband(LSB), Continuous Wave(CW), and Upper Sideband(USB).
The Frequency Counter in Action!
You too, with a minimum number of parts, can build a working frequency counter using a PIC microcontroller. Just follow this instructive Hub!
PIC Books on Amazon
I own this book. It covers Arduino and Piacaxe projects related to Amateur Radio. One of the coolest projects in this book cover how to build an Antenna Analyzer, which is typically a costly tool for an Amateur Radio enthusiast.
Who Writes This Blog?
John is an IT professional from Cleveland, OH who enjoys amateur radio, ham radio, metal detecting,
Copyright © 2017
Radio Boat Anchor
This page and all the pages on Radio Boat Anchor generate income based on an affiliate relationship with our partners including Zazzle, Amazon, and Google. Prices listed are subject to change without notice.