FreqCount Resolution change

Status
Not open for further replies.

Joostvg

New member
Hi all,

I'm trying to read frequency from a 10 MHz crystal using OpenQCM's Arduino and shield, and their default .ino uses the FreqCount library with a 100 ms interval.
Problem is, that library measures the frequency during 1000 ms, but I want to measure every 100 ms. You can shorten the measurement interval, but this lowers the resolution too. It will now count for 100 ms and count the amount of upwards slopes as the frequency, but in reality it is 1/10th of the frequency since you measured 1/10th of the time. You have to multiply by 10 to get to Hz again, but then you're basically rounding to the nearest 10 Hz since the output variable "count" is an uint32_t. Is there a way to get the unrounded number?
Has anyone tried to make it a float or is there another way to decrease the measurement time without losing resolution?

I hope anyone has a solution... I'd really want a finer resolution in my data.

Thanks,
Joost
 
You simply record 10 values per second, being the counts at 0.0s, 0.1s, 0.2s etc, and when a new value comes in take
the difference from the one 1.0s ago. Display can update every 0.1s, the counts are for a whole second so have 1Hz resolution.
Or just use a running average using floating point, and a time constant of around 1s.
 
Status
Not open for further replies.
Back
Top