Simple circuit to identify an 1Hz signal

JDT

Joined Feb 12, 2009
657
There are many ways of doing this. If you want to detect that the square wave is a particular frequency, you need to decide what bandwidth you are going to detect as 1Hz. For example: will 0.9Hz to 1.1Hz be detected as 1Hz? The narrower the bandwidth, the longer (more input cycles) it will take to decide. Whatever method you use - analogue or digital. It's a fact of life!

I have attached a simple circuit diagram that uses a monostable followed by a low pass filter and an analogue window comparator. The monostable has a time period of 0.5s. It is triggered on the rising edge of the input signal (which does not have to be a square wave). The output passes through a low-pass filter. If the input is 1Hz, the output of the filter will be approx 1/2 the supply voltage. The window comparator will give an output high if the voltage is between two voltages set-up by the three resistors. You adjust to suit.

The time constant of the LPF needs to be many times the period of the detected frequency. The output of the LPF will always have some ripple on it. Longer time-constant = less ripple. So for a narrow detection band, the time-constant has to be long.

If you also want to detect that the input is not only 1Hz but is also a square wave, another LPF and window detector is needed.
 

Attachments

kubeek

Joined Sep 20, 2005
5,794
The narrower the bandwidth, the longer (more input cycles) it will take to decide. Whatever method you use - analogue or digital. It's a fact of life!
I have to disagree with this fact, in digital domain the decision whether the pulse is the correct length will take no longer than 1.1s in the 0.9-1.1s case, and no longer than 1.01s in a 0.99-1.01s case, so narrow band doesnt make things worse at all.
 

JDT

Joined Feb 12, 2009
657
OK, I know what you are saying. You could measure the time the square wave is high and low and get an answer in a single cycle. But is this measuring frequency or the time of a pulse? Surely it's only a "frequency" if you have a repeating waveform (with a spectrum). Any mathematicians in the house?

Probably going off topic here - but what the heck!
 

kubeek

Joined Sep 20, 2005
5,794
If you measure the time between same polarity edges, then you do get frequency, albeit of the single cycle. Nevertheless, if you are trying to determine whether there is a 1Hz wave or a steady level there is no need to capture multiple cycles.
 

cmartinez

Joined Jan 17, 2007
8,220
From an engineering point of view, it's usually not acceptable to sample a single cycle to determine if something has a valid frequency. Multiple data has to be sampled and averaged (and sometimes variance comes into play too) for it to be considered valid. I speak from personal experience in this case... but of course, in the end it all depends on the application's requirements.
 

GopherT

Joined Nov 23, 2012
8,009
From an engineering point of view, it's usually not acceptable to sample a single cycle to determine if something has a valid frequency. Multiple data has to be sampled and averaged (and sometimes variance comes into play too) for it to be considered valid. I speak from personal experience in this case... but of course, in the end it all depends on the application's requirements.
From the OP's description, the options are: high, low or 1 Hz. He is not looking for 1.1 Hz, or 0.997 Hz. From an engineering point of view, the goal is to solve his problem to a degree that is system works. The goal is not to split hairs or wax poetic.
 

cmartinez

Joined Jan 17, 2007
8,220
From the OP's description, the options are: high, low or 1 Hz. He is not looking for 1.1 Hz, or 0.997 Hz. From an engineering point of view, the goal is to solve his problem to a degree that is system works. The goal is not to split hairs or wax poetic.
Yeah... I have to admit that I like a little poetry here and there every once in a while, and maybe I broke the KISS rule with my suggestion ... but then again our friend hasn't told us what his application is for...
 

ErnieM

Joined Apr 24, 2011
8,377
OK, I know what you are saying. You could measure the time the square wave is high and low and get an answer in a single cycle. But is this measuring frequency or the time of a pulse? Surely it's only a "frequency" if you have a repeating waveform (with a spectrum). Any mathematicians in the house?
Frequency is the inverse of the period. And the period only happens once.

And stop calling me Shirley.
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
look for a "retriggerable one-shot" or "missing-pulse detector"
I think this is the way to go, but I don't have these kind of chips available. I will try this with a 555 timer. (which I have a lot handy)

With a 555 missing pulse detector, (watch-dog timer) if the input is via a input capacitor, only the pulses are received by the 555, any permanent high or low the timer times out.
Pulses keep it in reset.
Max.
I have tried a simple 555 missing pulse detector (schematic here, page 13), it won't work if the input stay low. And I have tried feeding the signal via a input capacitor, still no luck. Maybe I am missing something here??

But I combined a 555 timer missing pulse detector with input stage from GopherT, it seems to work.

Please see attachment for circuit.



I guess you cannot expect a very fast response time between status changes.

How about a simple capacitor coupled inverting op amp amplifier with rail-to - rail input/output and a low reference voltage.

Here is a filtered, capacitor-coupled amplifier. It will turn on for about 0.5 seconds when signal goes high, but no divice will be able to tell the difference between a high and a 1 Hz signal for the fist half second.

View attachment 76149

And one short pulse when "high"

View attachment 76150
Inspired by your circuit, combine with a 555 missing pulse detector, I think I got a solution. Please see above comment and attachment.

It works on LTSpice.

Try a retriggerable monostable such as MC14528 or MC14538:

I would like to try something like this, but I don't have this chip available. But thanks for your input, as always!


And to all:

I think my circuit will work, but if you see something is missing, please let me know.

PS: decoupling caps are omitted.
 

Attachments

Last edited:

tindel

Joined Sep 16, 2012
936
So I continue to wonder why this isn't being done with a microcontroller... This can be done very easily with a single very small microcontroller... is this a exercise in masochism?
 

MikeML

Joined Oct 2, 2009
5,444
How about a non-microprocessor, but digital solution?

Most high-end frequency counters have a "period measurement" mode, where an unknown, low frequency signal gates a precise oscillator into a counting register. The number in the counter is a direct measurement of the period of the unknown. To display its frequency, the period is divided into the precise oscillator's frequency. My old HP counter can do this.

For example, suppose you gate a 8.00Hz oscillator into a digital counter with the period of your unknown signal. To get the unknown period, you will have to divide the frequency of the unknown signal by two using a positive edge-triggered flipflop to get the duty-cycle out of the process.

If the resulting count is equal to or greater than 9, the frequency of the unknown signal is greater than 8/9 = 0.888Hz.
If the resulting count is equal to less than 7, the frequency of the unknown signal is greater than 8/7 = 1.143Hz.
If the resulting count is exactly 8, the frequency of the unknown signal is between 0.888Hz and 1.143Hz.

This process can find the frequency to any degree of precision. The higher the frequency of the precision reference oscillator, the longer the counter needs to be, but the resulting tolerance window gets narrower and narrower. A single 4017 decade counter with an 8 Hz reference oscillator could do this.

To what resolution do you want to do determine the frequency?

ps: I forgot to account for the counting ambiguity in the above example. You would have to make the "target" window two counts wide, instead of only one like I used in the example.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,156
Ah I see, I am sorry to confuse you guys.

The circuit I want is the output stay high when the input is 1hz square wave.

The output is low when the input is always high or alway low.

This should clear up the confusion. Sorry about that.
To review.

Input is low, output is low.
Input is high, output is low.
Input is 1 Hz square wave, output is high.
Hi Nandu,

My simulation shows:

Input high -> output high
Input low -> output low
Input 1Hz -> output 1Hz
Hi Bug13,

That's correct. It ought to behave that way with the 'trigger' & 'reset' shorted.
But that behavior is not what Bug13 is looking for, as the other quotes document. Am I missing something?
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
So I continue to wonder why this isn't being done with a microcontroller... This can be done very easily with a single very small microcontroller... is this a exercise in masochism?
Short answer, no.

My goal is to look for a simple solution, I expect a non-mcu but simple solution exists. That's why I asked my first question.

But it turns out not as easy as I thought. Then and I am curious, and would like to know how simple it can be done without an MCU?

At the end of the day, if no simpler solution exists (for my case), I will just stick a MCU in there.

And still, I have learned a lot by looking into different peoples solution and idea, and it open my eyes up.

Thanks a lot guys, to all replied to this post!
 
Top