Close

Counting frequency, approximately

A project log for All-hardware frequency meter and LCR

Look mom, no MCU!

HummusPrinceHummusPrince 06/06/2020 at 19:210 Comments

Now that I can count, I want a prove of concept for a frequency meter. It only has to measure frequencies up to 10khz, with reasonable accuracy (say 10%) and reasonable refresh rate (say 1 second). How could I do it?

Lets consider the counter/display module. I want to feed it with a signal source of certain frequency, and enable counting all the time. Once every second, I want to latch the counter value into the display, and right after it to reset it. so it can begin to count again.

Looking at the control signals of the module, it should look thus:

Time to build a circuit that can do it. I want to base it around the popular CD4060B binary counter with in-built oscillator circuit. At first the oscillator will be of the cheap and grossly-unstable RC type, where I chosen Rx=Rs=1MOhms and Cx=33pF.

By sheer luck, it gave a frequency surprisingly close to 8192Hz. The datasheet supposes that the frequency to be expected is more like 13.77KHz, so it's either that the cap is actually 51pF - which fits precisely with 8192Hz - or that the too low value of Rs (should be at least 2 times Rx) alters the circuit properties.

8192Hz is awesome as it's power of 2. It means that the counter generates a timebase very close to 1 second!

Now that I have a timebase, I want to use it to generate these signals. I decided to use the famous CD4017 decade counter to generate these. It will be fed from the 8192Hz signal as it's clock, and Q14 of the decade counter whose frequency is 0.5Hz will be it's enable signal. Once a second has passed, Q14 will raise and the CD4017 will begin counting. Thus I'll connect it's Q1 to the #LE signal (through an inverter), it's Q2 to the display RST, and Q3 to the CD4060's reset and it's own reset too.

The circuit look thus:

R3 and C2 should make sure that the CD4017 won't reset before the CD4060 was reset. While the circuit dysfunction without R2, C3 seems optional.

This is how the thing looks like on a breadboard:

Notice the very perfect value on the 7segs. It's no magic - this is the circuit when counting it's own clock. The expected value is 8193±1 : 8192 clocks until the CD4017 is enabled, plus 1 clock for the value to be latched - Give or take 1 as the counter value might get latched before or after the clock has incremented the CD4017 once again.

Thus, the image above is a good indication that the circuit logic is as expected, though no indication for timebase accuracy.

So how does it fare in frequency counting? Surprisingly good, IMHO. Compare the display value of some random square wave with the estimated frequency that my very chinese toy "scope" is showing.

Given one believes the little Chinese pal (I do), the meter is accurate to about 1%. This is about the deviation of the RC oscillator itself from 8192Hz.

I'll take that as a successful prove of concept.

Edit [13/06/2020]: Minor corrections for the schematic.

Discussions