Author Topic: My frequency counter  (Read 793 times)

0 Members and 1 Guest are viewing this topic.

Online Analog KidTopic starter

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
My frequency counter
« on: December 01, 2024, 05:31:02 am »
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:

2450267-0

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 is

F4240

in hexadecimal, or

1111 0100 0010 0100 0000

in 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 found this circuit on 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:


 
The following users thanked this post: BILLPOD

Offline Gyro

  • Super Contributor
  • ***
  • Posts: 10119
  • Country: gb
Re: My frequency counter
« Reply #1 on: December 01, 2024, 11:44:42 am »
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!
Best Regards, Chris
 
The following users thanked this post: Analog Kid

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1256
  • Country: lt
Re: My frequency counter
« Reply #2 on: December 01, 2024, 11:58:54 am »
Nice build. +1 for compensation capacitor. 1N5819? 200pF each. Ouch.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20274
  • Country: gb
  • 0999
Re: My frequency counter
« Reply #3 on: December 01, 2024, 01:35:01 pm »
Nice build. +1 for compensation capacitor. 1N5819? 200pF each. Ouch.
Use 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.
 

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1256
  • Country: lt
Re: My frequency counter
« Reply #4 on: December 01, 2024, 05:53:16 pm »
Nice build. +1 for compensation capacitor. 1N5819? 200pF each. Ouch.
Use 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.

Maybe 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.
 

Online CaptDon

  • Super Contributor
  • ***
  • Posts: 2144
  • Country: is
Re: My frequency counter
« Reply #5 on: December 01, 2024, 07:20:40 pm »
Ohmite will have to start up the 220 ohm resistor line to replace all the ones you used.
Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 

Online Analog KidTopic starter

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: My frequency counter
« Reply #6 on: December 01, 2024, 07:31:07 pm »
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!

Thank 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 of the most useful tools ever invented!), then carefully filing to final size.

Like many things, patience is the key here.
 

Offline Bud

  • Super Contributor
  • ***
  • Posts: 7257
  • Country: ca
Re: My frequency counter
« Reply #7 on: December 01, 2024, 09:51:53 pm »
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.
Facebook-free life and Rigol-free shack.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20274
  • Country: gb
  • 0999
Re: My frequency counter
« Reply #8 on: December 01, 2024, 10:02:31 pm »
Nice build. +1 for compensation capacitor. 1N5819? 200pF each. Ouch.
Use 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.

Maybe 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.
Good 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
 

Online Analog KidTopic starter

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: My frequency counter
« Reply #9 on: December 01, 2024, 10:26:14 pm »
Define "accurate". Accurate to what.
Plenty accurate enough for my purposes. We're not talking about PPM here ...
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf