I'm using ni usb-6002 to read voltage signal. The signal comes from a feed-horn. Then it was processed to normal DC voltage(frequency downconversion, filtering, envelope detection) that ni usb-6002 can read. The vi I'm using looks like this.
I do not have the usb-6002 attached to my computer when I took this picture but as you can see it's pretty simple. I set the samples to read to 50 and I use the RSE mode. Then I save the data to a TDMS file. I found a matlab script that could convert tdms file to m file so that I could edit the data in matlab.
I then plot the data in matlab. The raw data looks like this
Through some previous tests and measurements I was expecting the data to be around 0.9 - 1. However, as you can see in the plot, there are a lot of spikes(the ones at about 16:00 and 18:30 are just fluctuations on the actual signal so these ones are good).
So what did I do wrong? Should I lower the sampling rate or samples to read(I am trying to maintain the sampling rate at 50hz)? Or is it just because there's too much environmental noise and these spikes cannot be eliminated?
Solved! Go to Solution.
You see a noisy signal. A lot of signals look like this ...
Two common methods:
1- Avoid the EMI
cables, shielding, low impedances, ... every wire is an antenna , every loop a magnetic pickup , ground is fantasy 😄
2- Filter the signal
a low pass filter with 1Hz ? or a median filter with a span of 20-50 points?
thank you for your reply! I am using the system in a noisy environment(dusty,windy,hot) so I guess noise consistues a great deal of the problem. But I am still not quite sure about these spikes smaller than 0.5 or greater than 2. The envelop detector I use have a output range from 0.5v to 2v. You can see this in the plot here How is it possible for the ni usb-6002 to read values smaller than 0.5 or greater than 2? Or is it that I mis-interpret these plots?
The computer that I use with the usb-6002 board is not grounded. It is a desktop computer, but it's powe source is a power strip whose ground wire unconnected(literally unconnected.). Does this grounding issue have sth to do with the noisy signal?
Your device has an voltage output (and a power supply) and you have a voltage input ... inbetween are cables ... that catch all kind of noise .. and your power supplies create noise .... even your 600x create noise 😉
If you have a scope, take a look at the signal, or sample one input channel with the highest samplerate and have a look at the signal. Look at the FFT of the signal ... give you hint's what type of noise you are dealing with.
The spikes can be real. DECT phones for example can create spikes in a lot of electronics nearby ... or: Ever noticed that you can hear in your old radio that you mobile will ring a second later?
Every dI/dt will cause a current in a loop nearby, every dU/dt will couple capacitive to a electrode (wire..) nearby... you can't cheat Maxwell (and you can't cheat mom :D)
And yes the missing ground cable together with switching power supplies CAN be one reason.
Quick solution: Filter the signal.
You sample with 50Hz. Sample with 10k, apply a median filter with 200 point width and do a decimation with mean filter by a factor of 200. (A low pass filter always help! If not, apply a even lower low pass filter :D)
For the data you already have: As already suggested, try a median filter with 10(?) points width.
You can post some tdms data (and maybe a vi to read it) and give us a try if you what....