LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging an Analog Input

I have a system with a pressure gauge connected to it. The gauge sends out a voltage which varies depending on the pressure. I have the output voltage being read in by LabView and than converting the voltage to pressure.
 
However, the voltage sensitivity is very high, with a difference of a tenth of a volt giving me a power of 10 difference in my pressure reading. The analog input naturally varies rapidly with time, however, that makes the pressure reading change to quickly to be truly useful.
 
I wish to average the input coming in and use that in my calculations to obtain a more stable result. I was thinking of trying to put the incoming data into an array of size 10 or 100 and using the average value of that array for my voltage to pressure conversion. However, I was unsuccessful in getting this to work.
 
I looked through the forum and saw other examples of averaging, but was unable to get them to work in my case correctly. This may have been due to the differences in what was being averaged, but I thought I accounted for that, yet still I could not get it to work.
 
Any aid or ideas would be much appreciated.
0 Kudos
Message 1 of 11
(6,163 Views)
Hi,
 
How are you acquiring voltage from this pressure sensor on labview?, if you are reading the data continously in array form, all you have to do is take this array, find its mean and use it as your average.
 
But then ,I am sure  you would have thought of this simple way( attached VI) and had some problem in implementing this.
 
so can u plz be more specific on how you are acquiring data and in what form is it?
 
regards
Dev
 

Message Edited by devchander on 12-23-2005 10:15 PM

Message 2 of 11
(6,155 Views)

Hi

I think averaging can help you out. but  it appears you are averaging the chunks of data as you get it from data acq. card.

this can lead you to some problems like steps in averaged data.

i think you should consider the sliding or running average methods.

you can get ready made vis for that on forum, or if you need i can provide it to you.

also if you have tried different averaging methods try to analyse following things.

1. How many samples are getting averaged (try different nos)

2. What is the variation in data being averaged.

3. what kind of distribution you get in data  etc. etc.

 

 

 

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 3 of 11
(6,150 Views)
If you use the full development version, you could use the "point-by-point" average vi which calculates a running average of the input, as demonstrated in the attached vi.
 
To define the number of point required to smooth your signal, there is a simple rule of thumb: assuming a normal distribution of the "errors", the standard deviation of the average is equal to the standard deviation of the samples divided by the squareroot of the sample number.
 
 
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 11
(6,148 Views)
I am aquiring the voltage with a breakout box, PCI-6251, with the analog output and analog ground pins of the sensor attached to pins 33 and 66 respectively. I am reading the data in from a DAQ Assistant and it is currently coming in as Dynamic Data.
 
I was able to covert it to a double to implement the method you demonstrated. From my remote connection it seems to be working, but it is slow and I won't be able to get into the lab to test it directly until Monday or Tuesday.
 
I think my problem was that I thought I was just reading in one value at a time and that I had to turn them into an array and then average that array. If this actually works when I get back in the lab it just turns out I was trying to make the problem too difficult and had just dismissed this solution as too easy and trivial. I had thought that even if it was started as an array, how would it know what sample size to take the average of, and therefore thought I needed a for loop to implement it.
 
Thank you for your help and I hope that it works properly when I get into the lab as well. If it does work I was just being dumb and making the problem much more difficult than it had to be.
0 Kudos
Message 5 of 11
(6,129 Views)
Another thing to consider is make sure you have the input range of the card set to natch the overall range of your sensor.

If your sensor is only generating millivolts and you have the range set to +/-5 or 10, you will not be using the full resolution of the ADC and you get the steps or jumps in voltage that mentioned in one of the other posts.

That card has 7 different input ranges, make sure you set it up so the cards range is as small as possible with out being smaller than the sensors range or you will clip the signal.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 6 of 11
(6,118 Views)
There is no doubt that there is some superb advice here and the big guns of signal processing are certainly being brought to bear on the problem.

I would ask a few questions if I might though; which might yield effective and systemic improvements: -

  1) Are you sure that the 'noise' is not being introduced into the system by the environment?
 
  2) Are you sure that the 'noise' is not an inherent part of the signal?

  3) Is the transducer suitable for the resolution that you want to measure?

  4) Have you fitted or ensured anti-alias filters are fitted 'for the intended frequency range'?

  5) Is the grounding / shielding, adequate?

I mention these because they hopefully represent the basics that must be correct before trying to measure. Attempting to remove any signal or noise which is present as a result of omiting to take appropriate measures merely aliases the result (level or time) and increases the computing overhead as well as decreasing the software reliability (on the assumption that reliability is inversely related to complexity).

One of the problems with P.C.s is that the power supplys often float and 'earth loops' are often mis-diagnosed as noise. Inadequate or incorrect screening leads to induced noise and factorys tend to have lots of motor speed controllers and other noise sources that create huge problems if shielding and grounding are not carefully implemented. Strip lights tend to broadcast at twice mains frequency and a local transmitter can play havoc. With lack of attention to shielding, and grounding, at best system performace will be degraded, at worst you remove an isolation barrier create by some one else for safety.

If you have mis-matched sensitivitys, shielding and earth loop issues will be even more evident as you will possibly be working in the noise floor of the system.

My thoughts on averaging a signal from a pressure transducer.....an example, measuring the shop air line pressure should not require more than a ten point moving average. After that I would look at what I have got wrong with the wiring.

I hope this provides you additional tools to your armoury to help solve your problem.

Compliments of the season, wishing you a happy new year.


Message Edité par Conseils le 12-26-2005 08:27 PM

Message 7 of 11
(6,091 Views)
Some further questions to consider !
Have you calibrated the pressure gauge ?
Have you consulted the manufacters guide lines for the pressure gauge ?
What is the dynamice range of the output signal ?
xseadog
Message 8 of 11
(6,080 Views)
Well Zeprenize,
 
Seems like you have more queries to answer than you would have preferred to ask in the first place! Smiley Very Happy Smiley Wink
 
But be assured that the answers to the questions that these two Gentlemen ( hope i got their gender right!) Conseils and Xseadog pose will be valuable for solving your problem.
 
regards
 
Dev
 
0 Kudos
Message 9 of 11
(6,070 Views)
Hello,

I have some questions regarding using the mean pt by pt averaging method.
currently, I am working with a "noisy dc signal" ... and averaging does help.

it is obvious that the larger the samples, the slower the response.

Is there a better way to get rid of the appearance of noise on a dc signal without significantly increasing the time it takes to get a result?
( I am not asking about the physical connections, setup, etc.  Just the theory of using labview and alternative techniques to reduce noise )


I have been playing around with multiple pt by pt averagings in series (4, then 8, then 32). The response does seem to change, but it is difficult to quantify.

Any comments or suggestions would be helpful.

Thanks
jqm

0 Kudos
Message 10 of 11
(5,944 Views)