Frequency counter is one of the basic electronic measuring instruments. This is why many similar projects were published in the previous years, but they all either lacked functionality, reliability or were simply too complex. This article presents a low cost frequency counter with a rich set of very useful functions putting to shame even many professional and much more expensive models. Microcontroller does most of the work and keeps circuit simple. This is »the third« generation« of an instrument I made a couple of months ago. First two generations were assembled from classical CMOS gates.
The primary task of an instrument, described in this article, is to give meaningful quantitive result, in this case measurement of frequency. It can as well be used as an impulse counter with manual reset and for measuring duration of high or low level impulses. I'll start by describing the schematic, continue with mechanical construction and end with description of usage.
The heart of this instrument is a microcontroller 89C51, which controls input count gate, reads the data from the common prescaler and translates them into visible numbers. Circuit requires single rail +5 VDC supply.
Mechanical construction was conceived as a basic PCB with all the necessary electronics along with power supply, except for the display itself. Entire power supply section is placed on one side of the PCB, with only two wires connecting it with the rest of the board. You guessed, this complete part can be cut off, if you plan to power the unit from an external power supply (5 VDC). LED-display has its own dedicated PCB holding three keys, eight transistors, current limiting resistors for segments and transistors (R21 to R36), and the 4017. All these resistors and the counter are SMD-type since I wanted to keep this board small. LED board can be connected with the »mother-board« via an angle PIN bracket. LED board can also be connected via flat cable and connectors. LED display can be easily replaced with a LCD in such case. LCD does not require a separate board for displays, but since it carries keys, those need to be placed on a separate PCB.
All required settings are carried out with three keys. All changes are saved into EEPROM and instrument will retain all the settings when you turn it on next time.
There are four basic measuring modes, switching between those is done via TP3. First mode enables taking measurements of up to 1.2 GHz. (most prescalers exceed 1.5 GHz). Resolution in this mode is 100 Hz or 1 kHz, switching between those can be done via TP1. Lower resolution means faster measurements. This mode has a special feature. It is possible to add or subtract any value from measured result. 5 values can be selected. P0 means that there is no subtracting/adding. P1, P2 & P3 add/subtract standard fixed values for radio intermediate frequencies (10.700 MHz, 9.000 MHz & 455 kHz). Values can be either added or subtracted. P4 lets you enter any value between 00.000 MHz and 99.999 MHz. Selected value will remain in memory. Programs can be selected via TP2. Display will show P0 0000 or P1 10.700. TP1 toggles between adding and subtracting (P1 -10.700). Exceptions are programs P0 & P4. If you select P0, TP1 selects divider ratio of additional external prescaler. LED will display PrE 000. (PrE 004... etc) First measuring mode can be set to 4, 8 or 16. LCD-display has more leverage and displays options with words External prescaler followed with the selected value.
Settings of the external prescaler are related to claims that it is easy to add an external prescaler to expand frequency range of this instrument. Instrument will take the prescaler into account and display the correct value. For example: We want to expand measuring range to 4 GHz. Suitable prescaler is m PG501B, (SE, issue 46), operating from 1.5 GHz to 4.5 GHz with divide ratio of 4. Instrument will display correct value, if we place this prescaler in front of the instrument and set 4 in the input prescaler menu. Other prescalers can be used to expand the unit: m PG504B (2.5 GHz to 8 GHz, divides by 2). m PG504B + m PG501B translates into /2 and /4, which equals /8 ... meaning you’ll have to select 8 in the menu. Decimals are adjusted automatically. One note about decimals: There are always a few lit at the same time. Left one marks GHz, the second one MHz and the third one kHz. If the frequency lies below 10 MHz, all zeroes up to the value of 1 MHz won’t display. The MHz and GHz mark are adjusted automatically. Above described functions work for LCD only.
If you press the TP1 in the P4, the digit on the far right starts blinking (LED display only, LCD shows an arrow in the bottom line under the digit; ¬ ); its value can be set with TP2. After you press the TP1 for the second time the second number starts blinking.... this is the procedure to setup every decimal value separately. Decimal point starts blinking after the sixth press, and adding or disabling of preset value will be activated. LCD-display has an advantage here. Owners of the LCD version can enable display of the instruments settings in the top line of the display after pressing the key 7 times. Measurements will be displayed in the bottom line. If you select Yes, the setting will be displayed. If No, they won't.
(Display Settings YES/NO)
An example: 1.2 G + 45.000”000. This means that measuring mode of 1.2 GHz is currently selected and that 45.000MHz will be added to the displayed frequency on the display. Last three zeroes mean that external divider isn't set.
Another example: 1.2” + 45.000”008 means that use of an additional external divider is provided, using division ratio of 8, and the G letter is concurrently replaced with the apostrophe meaning that the maximum frequency depends upon added external prescaler. Instrument's highest measurable frequency has to be taken into account as well. If we do not want to display settings, only number 1 will be displayed at the start of the line. One more thing about subtracting: If the deducted value exceeds input value, the result would have been less then 0. Er000000 is displayed in such cases. In case of adding: If the result cannot be displayed with 8 decimals, the display shows Er111111.
Second measuring mode (activated with the TP3) enables measuring of up to 40 MHz with the accuracy of 1 Hz or 10 Hz, selectable with the TP1. All settings are carried out in the same manner as with the first mode, with one exception; division ratios for the outside prescaler can be selected as 4, 8, 16, 64, 128 or 256. Upper frequency limit of the circuit (40 MHz) needs to be taken into account. An example: We want to extend the frequency range up to 3 GHz, good solution would be a m PB1505GR, being able to operate between 500 MHz and 3 GHz and supporting division ratios of 64, 128, and 256. Division ratio of 64 yields upper measurable frequency limit of 64 x 40 MHz = 2560 MHz. Clearly a division ratio of 128 (128 x 40 MHz = 5120 MHz) needs to be selected if one should want to measure up to 3 GHz. Good accuracy demands longer measuring times for bigger division ratios. Shortest time is approx. 0.3 seconds, and longest approx. 5.12 seconds. The last time applies for an external divide ratio of 256 and accuracy of 100 Hz. Measuring time in this case would be 2.56 seconds. Longest theoretical value in a case, when you connect the measured signal just after the start of the measurement, is approx. 5.12 seconds. Measuring cycle in the second measuring mode without setting the additional dividers is 1 second or 0,1 seconds (depends upon selected accuracy).
Third measuring mode enables measurements of low frequencies up to 1 MHz with accuracy of 1 Hz or 10 Hz. Adding, subtracting or taking an external prescaler into account is not possible in this mode. Up to 1_MHz will be displayed in the upper line when settings display is enabled.
Fourth measuring mode is designed for counting impulses.(Pulse measure) TP1 works as a reset. Input frequency is not important as long as state transitions take longer than 0.5 microseconds. LM393 cannot cope with faster transitions. Counting range is 99999999. (100 000 000 - 1).
All described measuring modes temporary display all ones, twos, threes or fourths after the TP1 or TP3 is pressed (mode/accuracy change or reset). This number tells you which mode is currently enabled. This applies only for LED display models.
Fifth measuring mode enables measuring of signal length. High or low state can be selected with TP2. H or L will be displayed at the extreme left position by the LED display. LCD will show either High level or Low level in the top line, but only when settings display is enabled. H or L will be displayed in the opposite case. Input sensitivity is 250 mV, meaning any voltage above this is considered to be logical 1. Times between 7 microseconds and 10 seconds can be measured. Accuracy is approximately +/-2 microseconds. Measurement is triggered by signal transition. If we want to measure high level, triggering takes place when the voltage exceeds 250 mV, and ends when it drops below it. Result is shown after the measurement. Result is updated 3 times per second for short intervals. If the period exceeds one second, first decimal point on the LED display starts blinking meaning that measurement is pending. This information is useful because result is shown after the measurement. LCD displays this by a left arrow in front of the value; ¬ 0.000.000 s. After the measurement the LED displays number of digits (seconds), which does not glow otherwise. HHHHHH or LLLLLL will be displayed, if the duration of the impulse exceeds 9.999.999 seconds. This means that it isn’t possible to measure times above 10 seconds. Result remains on the screen until you start a new measurement. It can be reset with TP1.
Let me add a few words about my plans.
JP5 on the drawn PCB is not used. It is provided for the RS 232 interfaces that will enable this unit to be connected with PC and use with graphical user interface. Program would enable making measurements with a PC. I have several plans for this program already; a simple frequency display on the screen, an option to enter desired frequency for comparison (a classical analog pointer would show the difference between actual and desired frequency). This would be very convenient for tuning. Frequency versus time graph would be another nice feature for validating frequency stability of oscillators. A printout should be built in as well. There would probably be other functions as well.
After this article was prepared a special feature is added to the instruments with LED DISPLAY, the possibility to measure the temperature.
MIRKO PELCL - S52PC