Menu:



Version:

May 8, 2019:
Revised: v1.2

5-digit Frequency Counter and Crystal Tester

- Review and 3D Printed Enclosure

Here is a review of a simple kit that is easy to build and works well. I also provide details of a 3D printed box which provides a tidy finish to the project. 

Introduction

In the past, whenever I have needed to test a crystal, I have often quickly built a single-transistor oscillator and measured the result with a frequency counter. Once the test was done, the parts disappeared back into the parts box until next time. Then I’d have to build another one.

Several months ago, I came across an online video review of a widely available crystal tester/frequency counter kit. It was not expensive, about $US6 including postage. At that price, it looked like a nice solution to my usual temporary "build it when you need it" approach. So, I ordered one.

The kit arrived promptly from the one of my regular Chinese vendors. I recognised the circuit almost immediately - It was a slightly modified version of the frequency counter designed by DL4YHF. You can find some outline details of the frequency counter section on his website. I couldn't find any mention or description anywhere about the crystal tester part of the kit, so I decided to note some of the details here.

Kit Construction

My overall impression of the kit is very positive. I checked the parts first, and nothing was missing. The components were all good quality parts. The PCB is well made, clearly marked, and parts are well spaced on the board. The kit was didn’t take long to assemble. It’s very easy to build, although I would not recommend it for the absolute beginner. I took my time, taking several (essential) coffee breaks. It took just a couple of hours to put it together.

Before inserting the PIC microcontroller, I briefly powered it up with my bench variable power supply to check that the supply voltages on the board were correct. With this done, I then inserted the PIC and turned the device on.

Initial Testing

I tested the board with as many crystals as I could find. Those tests confirmed that the tester worked accurately with all sorts of crystals ranging from 1 to 50MHz. Some higher frequency “overtone” crystals oscillated on their fundamental frequency, as expected. For example, a 27MHz crystal oscillated at 9MHz. This is quite normal - The design for an overtone crystal oscillator is quite different to the circuit used in the wide range crystal test oscillator in the crystal tester.

Several 32.768kHz and 38kHz watch-type crystals and ceramic resonators did not work with the tester, and that was as I expected. Just like the overtone crystals, these low frequency crystals and ceramic resonators require completely different oscillator designs to work correctly. (I may build a little add-on module with a couple of different types of test oscillators to provide those functions in future)

Figure 1 : 20MHz crystal being tested

The most important result from my testing of the tester/counter was that all of my standard crystals worked in the tester without any problems at all.

I proceeded to test the frequency counter. It was able to count one of my signal generators right up to 50MHz with ease. I didn’t measure its sensitivity. The counter section of thie tester doesn't have any type of preamplifier/buffer stage so it will only count relatively large signals, say around 1-3Vpp. Other pages here on my website show the details for some simple counter preamps that could be added if you wish to add a preamp to this counter. One example is here.

I also tested it with several power supplies including a standard 9V battery, a 6V wall plug pack power supply, and a tiny 5V USB-type celphone charger. They all powered the crystal checker without any problems. The LED display was a little less bright when using the 5V USB supply, but it still was perfectly usable.

To calibrate the frequency counter, I inserted a known good crystal into the tester and measured the output of the crystal tester’s oscillator with one of my frequency counters. The on-board trimmer capacitor was then adjusted very slightly to set it exactly on the same frequency as my counter.

There are some other special features available through the ‘Program’ button including automatic offset programming, but I did not test these functions. More details are found in the kit instructions and on DL4YHF’s website.

Crystal Tester Schematic

Unfortunately, the kit doesn’t include an accurate schematic, or even a schematic showing all of the sections of the device and how they interconnect. The details in the kit are taken directly from one of the drawings on DL4YHF’s website, and they only outline a small section of the frequency counter part of the tester. Frankly, even those details are unclear. There were no details of the crystal oscillator, the power supply regulation circuit, or the external connections.

Faced with that, I promptly spent an hour drawing up the complete schematic. It’s shown below:


 Figure 1 : Schematic of the crystal checker - This shows the counter, the test oscillator and the power supply (Right-click on this drawing to see the full scale version)


Circuit Description

The schematic reveals a fairly typical PIC-based frequency counter circuit. It uses one of the counter/timer inputs to count the crystal oscillator or an external signal which can be connected to the counter input via J3. The measured frequency is then displayed on the five multiplexed seven-segment LEDs.
 
The crystal oscillator is a standard Colpitts oscillator. Q1 provides the gain, and oscillator feedback is via C3 and C4. The oscillator’s output is taken from the emitter of Q1 via C5 which then goes to the PIC microcontroller. This same connection is shared with the external frequency input. This means that the crystal oscillator will load any external circuit which is connected to the external input (J2) so some care may be required in some cases.

The external power supply is connected to J3. It is regulated by a low voltage drop HT7550-1 regulator (IC2). This is a good choice since the low voltage drop means the checker will work with an external 5V power supply like the USB charger I tried.

There is one potential problem revealed by the schematic. The crystal oscillator transistor is powered directly from the external power supply. If the crystal tester is powered, say, by a 9V battery, then the oscillator output, which is connected directly to the PIC, will exceed the maximum limits of the PIC. I measured this to check. With a 9V battery, the input signal on the PIC’s pin 3 was a sine wave measuring 8V peak to peak!

While this would almost certainly cause damage to most microcontrollers, the designer appears to have used a "special feature" of the PIC chip here. This specific input pin (RA4) is noted in the Absolute Maximum Rating section of the datasheet as having a maximum limit of 14V. (Thanks to Tony AD0VC for pointing this out) The 16F628 specifications note that pins shouldn't be exposed to these values for lengthy periods. Later, in the main DC Characteristics specification tables, a maximum limit of 5.5V is given for the same pin without any further detail.

Is feeding this high oscillator output voltage into this pin a bad design choice? It is certainly a simple solution to a design problem. Modifications to address the issue are not easily identified. The 1n capacitor (C5) could be reduced in size, or Q1 could be connected directly to the output of the 5V regulator, or a resistor divider could be added to the input of the PIC chip. However, all of these options will result in reduced performance.

A better solution would be to redesign the oscillator to use, say, a 74HC04 as the test oscillator, with the 74HC04 supplied from the regulated 5V rail. Spare gates could be then be used for oscillators for those other types of crystals I mentioned earlier, such as the 32 and 38kHz crystals. Another 74HC04 gate could be used for a ceramic resonator oscillator, and a further gate (There are six in the 74HC04 IC) could be dedicated for use as a counter preamp, for buffering and counting external inputs.

Well, I gave that modification idea about 30 seconds of thought before deciding to simply ignore the problem. Given the price of the kit and the typically very short time the oscillator is used during each test, it’s a reasonable compromise, especially in light of the Absolute Maximum Ratings limit of 14V. "Ignorance is bliss", as the saying goes.

To date, my crystal tester has given four years of periodic service without any problems, so I must assume that the Chinese designer's reliance on that 'maximum limit' specification is OK. However, it's not an approach I would use or recommend, I think.
 

Finishing Touches

I searched the usual websites for a suitable 3D-printed box for the crystal tester but I couldn't find anything. That was easy to fix. It only took a couple of hours for me to design and print a suitable enclosure. I used PLA filament as usual, printed using 0.2mm layers and 20% fill. Blue PLA was on the printer when I went to print the box, so that’s what I used.


Figure 2 : My 3D printed case includes space for a 9V battery and a mounting slot for a standard slider power switch. The battery, battery connector and switch need to be purchased separately.
 
I designed the enclosure with space for a standard 9V battery. This makes it completely portable. A battery is fine for this sort of instrument where it is only likely to be used for a few seconds perhaps once or twice a week, at most. The battery (and its clip-on connector) fit in the slightly larger right hand end of the enclosure. The crystal tester PCB fits inside the cover and base. M3 self-tapping screws about 10mm long hold everything together.

inside 3D box

All told, the finished box measures 110mm wide and 60mm deep. The left hand side is just under 18 mm high while the battery end is 21 mm high. In Figure 2, you can see the hole added on the left hand end of the enclosure for a slide switch to turn the power on and off.

I also designed a simple front panel for the case. I printed it onto plain paper using a colour laser printer and covered it with clear self-adhesive plastic. It was then glued to the printed enclosure.


Figure 3 : Front panel for the 3D printed box. Crystals can be plugged into the socket on the left (blue arrows)

The grey shaded boxes on the panel artwork should be removed with a sharp knife to expose the display and the two connectors. The grey circle should be cut out to allow the on-board pushbutton switch to be pressed when those functions are required.

The little blue arrows on the panel artwork indicate the pins used to connect the crystal being tested. The red and green arrows indicate the external input pins for the frequency counter.

The standard STL files for the 3D case and a JPG file for the front panel artwork are available for downloading below.


Downloads:


XtalChecker_box: This zip file contains the industry-standard STL-format 3D print files for the case

Front panel artwork: The JPG file for the front panel





Want to go back to the main page? Click here to return directly.