LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

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
___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 1 of 7
(3,653 Views)
It's odd, my data will read fine for a few samples, then it will throw very high exponential numbers that just aren't in the realm of reason.  Really weird.
___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 2 of 7
(3,640 Views)

I've isolated the problem but have no idea what to do with it!

The sensor is on a test rig (primarily a metal deal) which is grounded.  The motor on this rig is controlled by a Lenze AC variable speed control.  This speed control is the source of the problem!

I've tested the sensor remotely and at the rig with that motor control off, and it acts normally.  Even direct-wired the motor at ludicrous speed full RPM, bypassing the control, and it read a nice steady 12,000 RPM.  As soon as you hit the start button on that variable control, my readings go haywire.

As far as I know, everything is grounded correctly and the only other wire I have running to that controller is a normally open wire which turns the motor control off in case of an emergency condition.  Any ideas or input as far as what to look for in interference and as to how to counteract it?

Crossposting to the Signal Conditioning forum.

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 3 of 7
(3,626 Views)

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 bugger to deal with sometimes.

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 4 of 7
(3,622 Views)

My prox is powered by my 5v reference voltage coming from my PCI-6602.

We've tried insulated mounting as well.  No difference!  The prox cable is shielded up til the last few inches which are inside a steel box.

...

We're putting shielded power wire in conduit on all motor drives now, in hopes that it will cut it down.  I'm also hoping to find a programmatic solution via the 6602 digital filters and/or lowpass filter.

This is putting a bugger in our program, for sure.

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 5 of 7
(3,555 Views)
Hello 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 this 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 this 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 location

Possible 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 Nyquist theorem 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 within the limits. Otherwise, I display a "NaN" value. I have also attached the modified VI to this post.




Message Edited by Matt A on 09-04-2007 07:58 PM


Matt Anderson

Hardware Services Marketing Manager
National Instruments
Download All
Message 6 of 7
(3,523 Views)

You know, I think that simple solution you just showed me will do just fine.  I was racking my brain trying to come up with something that 'obvious'.

Thanks to all that replied, I'm still going to pursue the digital filtering as well so that I can learn how to implement it effectively, as well.  This has been a great thread for me as far as gaining some understanding.

 

"I think you may have misunderstood exactly what the Filter express VI does."

Is it that obvious?  :manmad:  My sig says I'm confused for a reason, thanks Matt!

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 7 of 7
(3,475 Views)