09-04-2013 07:11 PM
HI,
I am trying to reduce my baseline noise with a 3-point smoothing filter. Attached are my printscreen result and my vi. I found that the 3-point smoothing did not have a significant effect to smooth the baseline.
I wonder if I programmed it wrong or the idea of 3-point smoothing is not a ideal way to reduce the background noise. In my case, it's ~0.7+/-0.2.
Please comment,
Michael
09-04-2013 08:08 PM
Michael,
You convert the Dynamic Data Type from the DAQ Assistant to an array then select only one element from the array smooth that. All the other data in the array are lost. This distorts your results considerably even before you start smoothing.
I do not have the DAQ VIs, but I think the DAQ Assistant configures the DAQ device, reads, and closes on each iteration. This is not very efficient. It may be better to use the stanard DAQmx VIs with the configuration and clear outside the loop and only the Read inside.
To decide how much smoothing you need and how much you can use without destroying the data you need to know something about the desired signal and the noise or interfering signals. For example the highest peak is quite narrow. If it contains only 2 or 3 data points and you used 11 point smoothing, it would almost completely disappear. If the peaks with amplitudes of 0.3 and larger are desired peaks and the noise is the stuff that has an amplitude of about 0.1 then smoothing may not be the best way to reduce the noise.
What is the source of the desired signal? What would it look like if if had no noise? What is the sampling rate? You enter dt = 0.01. Does that mean you are sampling at 100 Hz? How many samples do you get each time through the loop?
Lynn
09-06-2013 02:40 PM
Hi Lynn,
The source of the signal is from a laser but I put ND filters to lower the intensity. The rate is 100Hz and the # of sample is 10 in continue mode. It happens that I have an old NI card (NI4050) in the lab. I tried with its old vi and suprisingly, it showed no noise. Result attached.
Now I want to try out this really old VI with the new NI-USB-6210. But I don't know the proper device # for NI6210. I was able to find the device # for NI4050 in "Measurement and automation explorer" but not 6210 (printscreen attached).
Attached is the old vi.
Please help to modify it so that it is usable for USB6210.
Thanks in advance,
Michael
09-06-2013 02:53 PM
Michael,
I will not be able to help much. I do not have either DAQmx or the legacy NI-DAQ VIs.
I do not know whether it is possible to use the USB-6210 with the legacy DAQ driver. You might post a question on the Multifunction DAQ Board or ask your NI sales rep.
A DMM typically does quite a bit of internal averaging. Your DAQ system takes about 100 samples per second and displays all of them. The 3-point smoothing is a lot less averaging than done by the DMM.
How fast do you need to get updates?
Lynn
09-06-2013 06:40 PM
Hello Michael,
I may be misinterpreting your algorithm, but if you are trying to do a three-point moving average then there is almost certainly a problem with your code- currently, the averaging buffers are reset for each iteration of the main loop, so your averages will be heavily weighted towards the first value in each set of ten samples. For example, you're completely ignoring the 10th sample in each set (it gets stored in the shift register but isn't ever used), and the first two values output for each set of ten will be equal to the value of the first sample.
You're also using a chart, so you shouldn't need to build the waveform manually- this is handled by the chart.
Currently, you're converting from an array to dynamic data to a waveform, you don't really need to do this- all timestamp data is lost when you convert from dynamic data to the array of DBL; converting the data to a waveform doesn't add anything back in. It looks as though you might be doing this to ensure that your t0 and dt are consistent, but this is inelegant- particularly since the DAQ data has the actual sampling time included already.
The reason you're not seeing a "device number" for the USB DAQ card is because USB ports are not enumerated in the same fashion as PCI slots. USB devices are registered dynamically with the OS as they are detected, the physical slot isn't generally resolvable.
Regards,