A frequency counter that can monitor TTL and CMOS oscillators up to 50 MHz, combined with a tester for piezoelectric crystals, makes an appealing addition to any electronics bench—especially when the build is explained step by step. This instrument helps you check crystals, oscillators, operating frequencies and PLLs. In this first installment, we build a tool useful for many microcontroller and digital-circuit projects. A future installment will cover an RF preamplifier and a prescaler for measuring higher frequencies.
How often have you found a crystal whose markings have worn away, just when you need it? Or finished building an oscillator and wondered whether it really runs at the intended frequency? Sometimes, when nothing on the bench seems to work, you may not even know whether the oscillator in your new project is running at all. This frequency counter and crystal tester brings two useful instruments together in one straightforward build. Good electronics work depends both on having the right test equipment and knowing how to use it. The circuit is based on a 16F628A microcontroller, with enough guidance here to complete the build in an afternoon.
Proposed circuit for the frequency counter and crystal tester
The circuit is easy to follow and can be understood in several sections. The power supply uses a 7805, along with transistors and diodes that switch the instrument on and off with a single momentary pushbutton. Other transistors can be substituted—for example, BC548 and BC327—but check their pinouts carefully: they differ from those of the components specified here. The PCB is laid out for C1815 and BC639 (BC640), so fit these parts in the correct orientation.
When you press the button for the first time, D3 allows T1 to power the circuit. The PIC then keeps the instrument on through T2, even after you release the button. The program monitors pin RA2; when it goes low because the button is pressed while the device is running, the PIC starts the shutdown routine. One button therefore handles both power-on and power-off.
Single-button power-on and power-off system
The oscillator stage built around the 74HC00 will be familiar from our article on the harmonic generator for the Spectrum Analyzer. Just two gates in the IC form a stable Pierce-type oscillator. A movable jumper selects whether the instrument works as a frequency counter or crystal tester. A more elaborate switching circuit was possible, but would only complicate a beginner-friendly build. The same practical thinking led us to choose a simple, inexpensive and easy-to-use socket for the crystals under test. As shown in the video, the controls and socket are on the LCD display side for convenient access.
Access points on the LCD display side
The instrument uses a 16F628A PIC with a 10 MHz crystal. Input RA4 counts incoming pulses using TMR0 overflow. To provide suitable accuracy at both low and high frequencies, the program sequentially adjusts the PIC's internal prescaler, selecting different time bases to keep measurement error as small as possible. The original program designer's page, linked below, explains the software in detail. Although that site is in German, a translator can help you follow how the meter works. We adapted the design to our needs, including using a 16F628A instead of a 16F84A and adding the one-button power circuit. Our goal is to help you build it, not simply hand you a schematic and leave you to figure out the rest.
To guide you through the build, we have prepared a Picasa photo collection showing how the components are installed. Once your finished assembly resembles the one in the video, it is time to adjust and calibrate it. Ideally, calibration would use a high-quality, accurate RF generator. In practice, anyone building a frequency counter may not have access to expensive laboratory equipment. A convenient alternative is to measure the PIC's own oscillator and adjust CV1 until the display reads as close as possible to 10 MHz. This is only an initial adjustment, not a definitive calibration: an ordinary, inexpensive crystal is not a perfect frequency reference. Check several crystals marked for the same frequency and you will find that they do not all oscillate at exactly the same frequency.
CV1 and CV2 locations for adjusting the frequency counter and crystal tester
After this initial calibration, you can start testing crystals found in a parts drawer or salvaged from old equipment. Repeated measurements will help you adjust CV1 and CV2 for reliable operation. For a final check, compare against the mains frequency or a PLL circuit, such as a digital radio receiver, a TV channel selector, or—best of all—a radio transmitter with an adjustable PLL frequency.
Keep in mind that the instrument's resolution is not 1 Hz; it varies with the measured frequency. Up to 4 MHz, resolution is 4 Hz. That means a 50 Hz mains measurement could range from 48 to 52 Hz, while measurements at 60 Hz can be more accurate. From 4 to 8 MHz, resolution is 8 Hz; from 8 to 16 MHz, 16 Hz; from 16 to 32 MHz, 32 Hz; and above 32 MHz, 64 Hz. This frequency-dependent resolution results from the automatic prescaler adjustment described above, based on the signal entering RA4.
Suggested PCB drawing
Finally, R1 and R2 values depend on the LCD type you use. D1 and D2 protect the PIC input against potentially excessive voltages. Use a 74HC00—not another part number—to ensure the oscillator has good amplitude across the full frequency range. If possible, use FR4 (fiberglass) for the PCB board to get good results at higher frequencies.
There are plenty of frequency-counter and crystal-tester circuits online. What sets this project apart is the step-by-step build, with photos and videos that take the circuit beyond theory and show what you can reproduce yourself. The finished instrument is simple, versatile and easy to build—and it works.
The compressed download at the end of the article includes the suggested PCB drawing, the instrument's ASM source code, a HEX file ready to load into the PIC, and an extra image that readers often ask for. If you have questions, the NeoTeo Electronics Forum is there to help. This compact tool can be added to any project that needs its operating frequency checked. Have a 16F628A ready? You will need an instrument like this for future projects on NeoTeo.
Picasa: Image gallery
Project files: Download
Original design: German-language website