My frequency counter - Page 1
Forum section: electronics / projects

author: Analog Kid
author_rank: Super Contributor
timestamp: December 01, 2024, 05:31:02 am
content: I decided I wanted a frequency counter. I guess it was for a future project (inverter) that never came to pass, but I thought it would be a cool thing to do anyhow, so I set to work. My criteria were 1) no microprocessor, no Arduino, etc., 2) with a digital display, not an analog meter and 3) simple but accurate. I looked around on the web first to see what other folks had come up with.Of course I found a whole slew of projects. Discarding the half that were μprocessor-based, I found that most of them used a 555 as the timing element (the timing window). This I did not like, as that isn't all that accurate. I figured since I was going to be in the digital realm, why not make it dead-accurate?Well, long story somewhat shorter: I came up with that I though (still think) is a fairly clever scheme. The idea is to generate a very accurate 1-second interval, measuring the frequency with counters during that interval. Here's what I came up with:What I did was run the 1MHz crystal oscillator through 2 4040 counters. Then I scratched my head a while, scribbled on some paper, and figured out this scheme:1 megahertz = 1,000,000 cycles. That number isF4240in hexadecimal, or1111 0100 0010 0100 0000in binary. Counting ones, there are 7. Hmm, maybe I could use an 8-input AND gate? Sure enough, that's what I ended up using. When the count hits exactly 1 million, those 7 outputs of the 4040s (plus one wired high) will set the 4068 NAND low, stopping the counters.Ackshooly, I first tried using the 4068 as an AND, but it didn't work. Very frustrating: I thought I had defective chips, thought the stupid breadboard was causing problems. But then I figured out that the problem was that the (high) pulse from the AND gate wasn't long enough to reset my flip-flop (4013). So that's why there's a 555 here, as a "pulse stretcher" (one-shot). Since it requires a negative-going pulse, I used the 4068 as a NAND instead.The rest of it is pretty obvious.I will say that if I had this to do over again, I would't do things this way. There are, of course, many ways to skin this particular cat. It was really more of a self-teaching experience for me, as I'm just really getting into things digital. But it works, and it works well; dead accurate. The (theoretical) range is up to 9.9999 MHz, but I haven't tested it up that high; it does work accurately up to 1MHz.I should say a couple things: while I came up with this idea on my own, I did have some help along the way, from my friend (the one who's a friend of Paul Horowitz). And after I finished this I foundthis circuiton the web that uses my same clever scheme with a 4068; I guess you could say that great sometimes run in the same gutter.Anyhow, you can pick this apart all you want: I don't really care, as it's done and as I say, it works well. So knock it all you want. (Constructive criticism welcome, though.)Oh, and this joins my other projects using the tin-as-a-project-case form factor:

author: Gyro
author_rank: Super Contributor
timestamp: December 01, 2024, 11:44:42 am
content: A nice 'old school' project. It's nice to see someone using discrete logic.I suspect that it might struggle to reach 10MHz with 4000 series logic at 5V but if it reaches high enough to meet your needs then that's not a problem. You would probably need some improvement on the input too - even a low value cap between the input and pot wiper would squeeze you a bit more.It's good to see somebody reusing the biscuit tin housing approach - potentially the most impressive thing is the quality of the cut-outs in that thin tinplate!

author: Manul
author_rank: Super Contributor
timestamp: December 01, 2024, 11:58:54 am
content: Nice build. +1 for compensation capacitor. 1N5819? 200pF each. Ouch.

author: Zero999
author_rank: Super Contributor
timestamp: December 01, 2024, 01:35:01 pm
content: Quote from: Manul on December 01, 2024, 11:58:54 amUse BAT54 and add a 10k resistor in series with the gate input, otherwise it won't have any protection when the potentiometer is set to no attenuation.

author: Manul
author_rank: Super Contributor
timestamp: December 01, 2024, 05:53:16 pm
content: Quote from: Zero999 on December 01, 2024, 01:35:01 pmMaybe less than 10k, cause 10k will be 3Mhz lowpass togehter with gate input capacitance. 1k should be plenty. Most important is effective clamping. And effective clamping first of all means low inductance. It does not matter how beefy diode is used, if it has long leads and bad layout with high parasitic inductance, it is not very effective at clamping short, high current ESD strikes.

author: CaptDon
author_rank: Super Contributor
timestamp: December 01, 2024, 07:20:40 pm
content: Ohmite will have to start up the 220 ohm resistor line to replace all the ones you used.

author: Analog Kid
author_rank: Super Contributor
timestamp: December 01, 2024, 07:31:07 pm
content: Quote from: Gyro on December 01, 2024, 11:44:42 amThank you kindly. The cutout for the LED displays was made by marking the cut lines with tape, cutting the metal with a Dremel with a cutoff wheel (surely one ofthemost useful tools ever invented!), then carefully filing to final size.Like many things, patience is the key here.

author: Bud
author_rank: Super Contributor
timestamp: December 01, 2024, 09:51:53 pm
content: Define "accurate". Accurate to what. You rely on the 1MHz oscillator to generate gate signal but did not say anything about its accuracy and temperature stabilty. Also, the width of the gating signal is going to be affected by the combined jitter of the glue logic that generates it.

author: Zero999
author_rank: Super Contributor
timestamp: December 01, 2024, 10:02:31 pm
content: Quote from: Manul on December 01, 2024, 05:53:16 pmGood point, but the 50k potentiometer will have an impedance of up to 25k, when the wiper is in the mid position.Perhaps a lower capacitance diode is a better option. I had a look and found the RB876W which contains two diodes in series with a centre tap.https://www.mouser.com/datasheet/2/348/rb876wtl-e-1017134.pdf

author: Analog Kid
author_rank: Super Contributor
timestamp: December 01, 2024, 10:26:14 pm
content: Quote from: Bud on December 01, 2024, 09:51:53 pmPlenty accurate enough for my purposes. We're not talking about PPM here ...