LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change Voltage to Pressure or Pascal (Pressure) in Labview

Judging from the data sheets for your sensor, you are going to have to build a calibration curve to convert your voltages (derived from the sensor's resistance at known pressures) into pressure measurements. There will be no "the equation," especially since the sensor response to pressure changes from logarithmic to linear at some (undetermined) point. The data the company gives is obviously based on a "typical" response.

 

Unfortunately, the time-honored equation PV = nRT doesn't even work because in this instance V = volume, not voltage Smiley Frustrated.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 11 of 45
(2,850 Views)

Use a data extraction program (such as Data Thief) to analyze the graph picture and extract the data.  The save this data in a file or as an array constant in your code.

0 Kudos
Message 12 of 45
(2,843 Views)

hi camerond, thanks for the reply. The voltage of the pressure sensor is already known (when a force is applied to it, the voltage increases on the graph- because resistance is decreasing). Are you able to show an example of how to do the calibration curve? And I am not sure the of resistance of the sensor at known pressures- it doesn't state anywhere on the data sheet?(i may stand corrected if I am wrong).

 

And I was also wondering if it would be easier to do aVoltage to Force conversion, if Pressure should prove to be "impossible". Any ideas on how to go aout this? Thanks.

0 Kudos
Message 13 of 45
(2,828 Views)

The force to pressure is the easiest part; there are other concerns to focus on first.  Lets tackle things one at a time.

 

1.  The manual is reporting force (on the various graphs) in units of grams; which is NOT a unit of force.  It seems to me that they made these response curves by placing calibrated weights on the sensors and didn't bother to convert to units of force.  IF we assume that they mean grams under standard earth gravity (9.8m/s^2) then we can convert their terrible graphs into proper units of force Newtons.

 

2.  To convert Force to Pressure, it's based on the area of the device (Pressure = Force/Area).  Use the area of the device (0.000506 m^2 from the manual) to convert (Pascal = Newton /0.000506 m^2)

 

3.  Now you have the hardwired code to convert from Force to Pressure.

 

 

4.  Create a lookup table to convert the measured voltage to Force (as per the manual, this is entirely dependent on which circuit you use).  Now, it's a relative matter of making a look up table for your specific circuit that you build. This is just an array of constants created from the response of your device, which can be simply a constant on your block diagram or a file that you read from (the file option makes future changes easier). 

 

5.  So the end result will be along the lines of Pa = ( F(V) / 0.000506) , where F(V) is the lookup table used to determine the Force for a measured voltage.

0 Kudos
Message 14 of 45
(2,808 Views)

OK, FMTYEWTK (Far More Than You Ever Wanted To Know) about making a calibration curve:

 

Well, like I said, the graphs that the company provided are just for illustration purposes, i.e., (1) the "data points" on them are drawn too large on too small a graph to use them as real data points, and (2) your individual sensor will not have the exact same response as another of the same kind, IIRC, the company said that the sensor responses are about +/- 15%, IIRC.

 

For the first part, you can use LabVIEW or do it manually, depending on your preference.

 

So, what you have to do is rig up a vessel in which you can place your sensor (with some kind of electrical feedthrough) and vary the pressure over the range you are interested in and measure it with a known "good" pressure sensor (you might even use the regulator from a gas tank for this, depending on your requirements). Then fill your container with gas at pressure A, take your measurement with your sensor, repeat for pressure B, pressure C, etc., until you have exceeded your anticipated range or the sensor shows no further response with increasing pressure. For your setup, this should be pretty quick, so take a lot of points all along the range. One thing you do know from the company literature is that there is likely to be a curved region and a straight region (maybe a curved region at the end).

 

At this point, the easiest thing to do would probably be to gather your data and forget about LabVIEW for a moment. We'll come back to it later.

 

Then, using Excel (or another spreadsheet, or graph paper), graph response (y) vs. pressure (x) and look at the graph. This last step is essential (look at the graph) and one which many students fail to do. You should be able to see where the points on the graph are in a straight line, and where they obviously curve up or down. If your graph is either one or the other, great. If not, determine approximately where the points change from one region to another.

 

If you use Excel or another spreadsheet, you can then fit each region to a mathematical model (in Excel, you do this by right-clicking on a data point and selecting "Add Trendline"). By trial and error, find a model which visually fits the data best. Then go to the next region (if more than one) and repeat.

 

Now, armed with that information, go to LabVIEW. If you didn't take your original measurements with LabVIEW, set it up to take them now. For each region determined in the last step, get response vs. pressure data as before (or use the measurements you saved from doing it earlier) and plug them into the appropriate subVI in the Mathematics->Fitting palette. You then have your coefficients for your calibration curve.

 

In order to determine the pressure from a sensor response reading, just plug in your regression equation with these coefficients (I wouldn't use scripting, just all the little math triangles).

 

If your sensors are steady over time, you won't have to do another calibration curve for a while, but you should keep your apparatus on hand and do it again soon to see just how stable your sensor is. Once the established calibration does not fit the data well, you have to recalibrate. By this time, you will know LabVIEW so well that you can do everything there (even doing your graphing in LV for the visual fit part) and it will go even quicker than the first time.

 

If that wasn't enough for you, this goes into the theory, although it deals mainly with linear calibrations. The "residuals" part starting on page 6 talks about getting the right model for each region, mathematically.

 

Have fun with it,

 

Cameron

 

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 15 of 45
(2,804 Views)

Thanks for the response pjr1121. Are you able to show me how to make this lookup table? I am quite a novice in Labview and I would very much appreciate your help. It would also help me very much in the future. Thanks for your help.

0 Kudos
Message 16 of 45
(2,789 Views)

camerond gave you good step by step instructions for creating an accurate calibration curve.  The only difference is that a lookup table stores the raw data values instead of fitting a curve.

 

If you find that +/-15 to 20% error is acceptable, which i HIGHLY DOUBT, you can use one of the circuits from the manual and their matching response curve.  You should only consider this if you need a proof of concept build to show progress.  For an actual working system, follow camerond's instructions.

0 Kudos
Message 17 of 45
(2,785 Views)

hi camerond. I am not too sure what you mean by the 1st part?

 

"So, what you have to do is rig up a vessel in which you can place your sensor (with some kind of electrical feedthrough) and vary the pressure over the range you are interested in and measure it with a known "good" pressure sensor (you might even use the regulator from a gas tank for this, depending on your requirements). Then fill your container with gas at pressure A, take your measurement with your sensor, repeat for pressure B, pressure C, etc., until you have exceeded your anticipated range or the sensor shows no further response with increasing pressure. For your setup, this should be pretty quick, so take a lot of points all along the range. One thing you do know from the company literature is that there is likely to be a curved region and a straight region (maybe a curved region at the end)."

 

I am using Force Sensitive Resistors. When a force is applied onto them, the voltage will increase because resistance decreases. The force I am applying to them is a foot (as I am designing a foot pressure mat) I want to convert this voltage into Force, and then hopefully Pressure (if that is possible!). The 1st step will probably be to convert into force as pjr1121 stated. He suggested I follow you step for step but I am kind of stumped by your 1st section!

0 Kudos
Message 18 of 45
(2,774 Views)

What camerond is describing is a controlled system where you can apply a known force or pressure and measure the resultant output.  Since your device will be slightly different from those in the manual, it is best to create your own calibration curve.

0 Kudos
Message 19 of 45
(2,762 Views)

well lets say my weight is 12 stone... I step on the mat and that gives out 5V. How do I get the force from that? I hope i am not frustrating you guys? Lol

0 Kudos
Message 20 of 45
(2,756 Views)