 Is there a way to speed up the frequency measument of square waves at Low freq

Hello, on my project I have a sensor that outputs a square wave and I get its value through the frequency. My problem is that I need to do one measure every second but sometimes the output from my sensor is less than 1 Hz and my measurement fails because I am unable to log one cycle.

Basically I would like to know how to measure the frequency lower than 1Hz square wave in less than a second, given that I do not know the duty cycle. Is this possible?

Basically I would like to know how to measure the frequency lower than 1Hz square wave in less than a second, given that I do not know the duty cycle. Is this possible?

I don't know how you want to measure, If I am not wrong - you want to measure it in oscilloscope.? or with the Arduino.?

if Oscilloscope :
Probably you will need an Oscilloscope with high sampling rate (1Gs/s is recommended), Before testing you need to power up both the units (Your sensor which outputs square wave and oscilloscope) with battery, Do not power oscilloscope using AC mains...

You will need to trigger the signal which is lower than 1Hz

Measure the elapsed time between 2 rising (or falling) edges in milliseconds and divide 1000 by that, if time between 2 edges is 1200 mS, frequency is 1000 / 1200 = 0.83333Hz.

laobanbr4:
Basically I would like to know how to measure the frequency lower than 1Hz square wave in less than a second, given that I do not know the duty cycle. Is this possible?

You cannot determine the frequency or duty cycle of a signal in a fixed time period if the signal does not change within that period.

My problem is that I need to do one measure every second but sometimes the output from my sensor is less than 1 Hz and my measurement fails because I am unable to log one cycle.

If you're just using integer values for frequency, and you don't need to measure frequencies below 1Hz, then you should add a timeout function to your code so that you get 0Hz when the sensor rate is below 1Hz (measurement time > 1 second).

laobanbr4:
Hello, on my project I have a sensor that outputs a square wave and I get its value through the frequency. My problem is that I need to do one measure every second but sometimes the output from my sensor is less than 1 Hz and my measurement fails because I am unable to log one cycle.

Basically I would like to know how to measure the frequency lower than 1Hz square wave in less than a second, given that I do not know the duty cycle. Is this possible?

You mean measure the time between two non-existent transitions? Think about it!

If you know the duty cycle you can go down to 0.5Hz by timing a 1/2 cycle.

I think what you are actually asking for is how to record the latest reading so it can be returned
when next asked for. The way to do that is set a variable everytime you time a cycle, and return
the value of that variable whenever you need the frequency, rather than measure it afresh.

756E6C:
Measure the elapsed time between 2 rising (or falling) edges in milliseconds and divide 1000 by that, if time between 2 edges is 1200 mS, frequency is 1000 / 1200 = 0.83333Hz.

I agree with that, you may use arduino function "attachInterrupt" and get division done correctly, declaring variable as floats or casting to