Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Frequency measurement

Hello,
 
I'm trying to measure the frequency of a +/- 138,9 Hz signal with a DAQ-6024E card. Therefore I'm using the function "Low frequency 1 Counter" and measure the frequency over 160 samples. Almost the entire series of 160 measurements give a frequency very close to 138,9 Hz however 2 or sometimes 3 samples give a completely different  frequency: 254,133 Hz and 306,326 Hz. These few strange values appear even when I redo the measurement and the they remain the same in value approximately: +/- 254,599 Hz and +/- 305,801 Hz.
 
I cannot believe that my measuring method is wrong because otherwise the error would be smaller. Furthermore I looked to my signal and didn't find any anomalies.
 
Thank you for any help,
Nicolas
 
0 Kudos
Message 1 of 5
(4,291 Views)

I can explain why you get those anomalies as sequential pairs -- the counter is seeing an extra edge in the midst of one of your true frequency intervals.  You can check this by comparing 1/138,9 to (1/254,1 + 1/306,3).  The extra false edge divides one true freq interval into 2 chunks.

It's pretty notable that such a glitch keeps occurring at the same point within your freq interval.  It sounds very likely to be something systemic.  The best solution will be to prevent the glitch from occurring, if possible.  If not, and especially if the glitches keep showing up near the middle of your true interval, it's pretty easy to detect and correct them.

Most of your samples will probably agree to within a few % of one another, right?  Any time an interval gets split by a glitch, at least one of the intervals will have a freq that is >= 2x the nominal value.  In your observations, you get 2 readings that both deviate by >50% of nominal.  These can be easily detected in software, and you can recreate the true interval according to the reciprocal formula I showed at the top of this post.

I think I posted on a similar topic before, let me see, yeah...  here it is.

-Kevin P.

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 5
(4,274 Views)
Hi,
 
I'm not able to rate your reply with the new rating rules of NI forum but it's defenitely helping me! Thanks for your observations and advice. 1st class help!
 
Best regards,
Nicolas
0 Kudos
Message 3 of 5
(4,260 Views)
Hello,
 
I prefer to find the hardware reason instead of correcting the software. I did analyze of the signal with an osciliscope and glitch detect function but couldn't find a signle glitch. The block signal (0 -5 V) entering my DAQ card counter comes from a home made comparator using a LM 339 chip and has a rise time of 1.87 μs and a fall time of 200 ns. Normally my counter works with TTL signals and thus the rise time should be lower than 50ns. Can this be the origin of my problem knowing that the counter measure the frequency correctly of almost the entire 160 pulses but misses on a few of them?
 
If yes, what chip can I use to convert my input signal to a TTL signal (my input signal varies between 0 and 10 V) ?
 
Best regards,
Nicolas
 
 
0 Kudos
Message 4 of 5
(4,231 Views)
Hello,

I can confirm that you are completely right. The output of your comparator is not TTL compatible.
As you want to solve this issue using hardware, the easiest way to me would be adding a TTL compatible schmitt trigger in the output path of the LM339.
As quick Google search pointed me to the 74HC14 schmitt trigger. 

I also want to make sure that you added a pull-up resistor to the output line of you comparator.
The LM339 has an open drain output, so a pull-up resistor is advisible.  This will not solve your TTL issue, but will improved the output signal edges.

Some nice NI Knowledge bases:
How Can I Use my Non-TTL Signal to Generate a TTL digital Signal?
http://digital.ni.com/public.nsf/allkb/771D82A44F27A0AF86256DD0007FB9A1?OpenDocument
What Is the Definition of a TTL (Transistor-Transistor Logic) Compatible Signal?
http://digital.ni.com/public.nsf/allkb/ACB4BD7550C4374C86256BFB0067A4BD

Best regards,

Best regards,
Joeri

National Instruments
Servicesg
0 Kudos
Message 5 of 5
(4,206 Views)