LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I subtract offset voltage from my data acquisition program?

I have a simple program (attached) that reads a voltage input and outputs the results to a file. The voltage has an offset (which changes from test to test), and I am interested in zeroing out this value at the start of acquisition (in the 'interface.vi'). Could someone show me how to do this? Thanks.
0 Kudos
Message 1 of 9
(3,631 Views)
Is it suitable to take the offset reading prior to entering your while loop? I think this is the case based on your question. If so, take a reading (or perhaps an average of several readings) before entering the loop and subtract this value from the value inside the loop prior to processing.

Hope that helps.
0 Kudos
Message 2 of 9
(3,631 Views)
I think the best idea would be to have some sort of 'initialization' phase where it reads the offset, and then uses that value to subtract from future inputs. The problem is, I just don't know how to do that (my labview knowledge is very limited). Thanks.
0 Kudos
Message 3 of 9
(3,631 Views)
The simplest way to do this is with a precision resistor tied between either the positive or negative power supply (depending on the sense of your offset, and your input terminal. (You can also use a potentiometer, but they can be noisy unless you use an expesive film-type pot.
For small degrees of offset, you can just run your data through an ADD node in Labview, but it's always preferable to do the offset adjust in hardware, or you could end up saturating the input ("slamming it against a rail"). Look at the excellent tutorials on signal conditioning elsewhere on the Labview site.

Good Luck!

Eric
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 4 of 9
(3,631 Views)
Without doing major changes to your program the easiest way to do this "initialization" phase is, as I said before, to take a reading prior to entering your loop and then subtract this value from the value inside the loop. I have modified your interface vi with the simplest approach, using the same get data point vi that you use in the loop. You may be better off with additional modification which would a waveform (i.e., a series of data points) and average the data for the channels, thereby reducing the effects of random noise.

Certainly Eric's suggestion to handle the offset in hardware is valid, especially if the offset is significant. However, my experience has been that for many applications handling the offset in software is adequate.


Hope that helps,

John
0 Kudos
Message 5 of 9
(3,631 Views)
You said you modified the vi... could you attach it? Thanks.
0 Kudos
Message 6 of 9
(3,631 Views)
I'm sorry about that. I was focused on what I was writing and forgot to attach the vi. Here it is.

John
0 Kudos
Message 7 of 9
(3,631 Views)
I tried it out, and it seems to work perfectly, except for one crucial problem. The manner of the device I'm using is that at the start of the run, it has an artificially high signal which then runs back down to the correct amount. Thus, it zero's out the value at the very first acquisition point. Is there any way to put a timer on it (about five seconds) so it doesn't have this problem?
0 Kudos
Message 8 of 9
(3,631 Views)
What you need to do is put a Wait millisecond timer in the vi such that it is forced to occur before the data acquisition. You then wire the number of milliseconds that you want to wait into this function. There are a number of ways to force the flow of the data. One method is a state machine architecture. However, this approach requires a rewrite of your code (maybe not a bad idea since the code isn't very large). A second approach uses subvi's with Error in and Error out clusters to regulate data flow. This could be nicely integrated into your vi. I have made a simpler modification to your vi which will make it work by putting some of your inputs to the data acquisition vi into a single frame sequence stru
cture with the Wait function with a five second waiting period.

Once again, this method will work for your vi, but it is not the preferred approach, especially if the vi grows very large.

Hope that helps,

John
0 Kudos
Message 9 of 9
(3,631 Views)