What am I doing wrong with this filter (counter/frequency issue), probably another newb question.

What am I doing wrong with this filter (counter/frequency issue), probably another newb question.

Post by Ralp » Thu, 16 Aug 2007 01:10:09


I extracted the part of my VI that applies here.  I have a 6602 DAQ board reading a counter for frequency, using a Cherry Corp proximity sensor.  Getting a lot of noise and errant ridiculously high readings.  Speed of shaft which it's measuring is currently 2400rpm with one pulse per revolution so 40hz. 
 
Trying to use the express filter VI to clean up the signal and ignore anything over, say, 45hz and under 35hz.  No matter what setting I choose I continually get the  20020 error, Analysis:  The cut-off frequency, fc, must meet:  0 <= fc <= fs/2.  I know this relates to sample period somehow, but for the life of me I can't understand what I'm doing wrong. 
 
I used this VI without filtering on bench tests with a hand-drill and got perfect output every time.  Now it's on the machine and being erratic.  Any help here will ease my stress level significantly, thanks.
 
VI attached


RPM.vi:
http://www.yqcomputer.com/
 
 
 

What am I doing wrong with this filter (counter/frequency issue), probably another newb question.

Post by AnalogKid2 » Thu, 16 Aug 2007 05:10:07

Hi Ralph:
If possible, try mounting the prox to the rig so it is insulated from ground. And if you have an oscilloscope around that may prove helpful at looking at the signal while you try different things.
Also try to route the prox cable away from motor leads and drive. Do you know if the prox cable is shielded?
Where does the prox get it's power from? You may want to scope the power out too. Motor drive noise can be a *** to deal with sometimes.

 
 
 

What am I doing wrong with this filter (counter/frequency issue), probably another newb question.

Post by Matt » Thu, 06 Sep 2007 10:10:05

ello Ralph,I'm not sure about mounting your sensor to your rig, but I can provide a couple ideas about the filtering. Depending on the type of noise, the digital filters on the PCI-6602 could help eliminate the behavior you are seeing. If the noise manifests as a "glitches" or a bouncing signal, you could use another counter with a minimum period to help eliminate the noise. This concept is discussed in greater detail in <a href="http://digital.ni.com/public.nsf/allkb/09A669242FC5645286256D890081EC12?OpenDocument" target="_blank">this</a> KnowledgeBase. I noticed that you are using NI-DAQmx; the practical application of the digital filters on the PCI-6602 in NI-DAQmx is discussed in <a href="http://digital.ni.com/public.nsf/allkb/220083B08217CFD686257131007E5D2C?OpenDocument" target="_blank">this</a> KnowledgeBase. A more detailed description of the behavior of these filters is provided in the NI-DAQmx Help (Start>>All Programs>>National Instruments>>NI-DAQ) in the book entitled "Digital Filtering Considerations for TIO-Based Devices".I also wanted to comment on your original post and explain why you were receiving error -20020. For convenience, I have copied the text of the error code below.Error -20020 occurred at an unidentified locationPossible reason(s):Analysis:  The cut-off frequency, fc, must meet:  0 <= fc <= fs/2.I think you may have misunderstood exactly what the Filter express VI does. The Filter express VI takes a series of values in a waveform and performs filtering on those signals. So, it will look at a waveform made up of X and Y values and apply the defined filter to this waveform. Specifically in your application, the cut-off frequency (fc) is the Upper Cut-Off level that you specified in the Filter express VI; any frequency components of the waveform outside of the range you have defined will be filtered. The fs is the sample rate based on the data that you wire to the Signal input of the Filter express VI. In your VI, this data is coming from the DAQ Assistant. So, fs will be the sample rate of the DAQ Assistant and is associated with the rate at which points are acquired. The sample rate does NOT relate to the bandwidth of the signal, except that the <a href="http://zone.ni.com/devzone/cda/tut/p/id/4653" target="_blank">Nyquist theorem</a> tells us that the sample rate must be at least twice the signal bandwidth in order to determine periodicity of the signal. So, in this case, the sample rate of the DAQ Assistant would need to be at least double the high cut-off frequency. However, you are performing a frequency measurement using a counter. I think this is where the confusion comes in. For the frequency measurement using a counter, the DAQ Assistant returns a decimal value which represents the rate of the pulse train being measured by the counter. It does not return the actual waveform that is being read by the counter. It is this waveform that would be band-pass filtered to eliminate frequency content outside of the filter's bandwidth. Instead of the Filter express VI, I would recommend that you simply discard values that are outside the range you specify. I have modified the code you posted earlier to perform this operation. The image below shows the changes that I made; rather than using the Filter express VI, I simply compare the frequency to the "Low Threshold" and "High Threshold". I use a Case structure to display the value on if it is w