LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting voltage to temp and flow

Solved!
Go to solution

Hey everybody!

 

I'm currently trying to make a SubVI that can convert voltage from a VFS 2-40 QT vortex flow sensor to a temp and flow. I have it connected to NI myDAQ, to acquire the voltage through both AI0 (Temp) and AI1 (Flow). I will be using DAQ assist, in the block diagram to read the inputs.

 

So my question is, how would I go about making such a program? I'm kinda stuck on how to start, as I have never tried it before or gotten any lectures on this specifically.

 

I have attached a picture of both graphs, that show what the temperature or flow is at a specific voltage.

 

I have also attached the data sheet for the flow sensor.

Download All
0 Kudos
Message 1 of 13
(2,622 Views)
Solution
Accepted by topic author TomasMathe

Don't use express VIs. They obscure a lot of details and force you to use dynamic data wires, which are discouraged to use. Instead you just needs a few DAQmx functions:

Basjong53_0-1681820151695.png

 

Now you just need to make 2 subVIs, one for each data reading. The conversion is simple, just solve the linear function from the graph in the form y = ax+b. Be sure to swap the axes, since voltage is on the y-axis in your example.

 

Then make your subVI like this:

Basjong53_1-1681820365116.png

Repeat for flow rate.

Message 2 of 13
(2,603 Views)
Solution
Accepted by topic author TomasMathe

Hi,

 

the charts are linear for Flow vs Voltage and Temp vs Voltage so you simply have two   y = mx + c  type  relationships . . . 

 

Flow:  3v for 11L   so m = 3.666  with a c of -0.8333

 

Flow = Voltage * 3.666  -0.8333

 

Temp:  3V for 100C     so m = 33.333  with a  c  of  -16.6666

 

Temp = Voltage * 33.3333 -16.6666

 

Double check these for yourself against the charts in the PDF

Message 3 of 13
(2,596 Views)

A custom scale would be a nice option to add in here . . .

 

SimonGn_0-1681821246814.png

 

Message 4 of 13
(2,585 Views)

Wow seems easy, why didn't I think of that in the first place hahaha? Thank you so much for the help, I will try to make the program, and then report back when it's working.

Message 5 of 13
(2,584 Views)

Ooh I guess I have just one more question, how do you get flow:  3v for 11L to be m = 3.666  with a of -0.8333 and the same for temp?

0 Kudos
Message 6 of 13
(2,568 Views)

Hi Tomas,

 


@TomasMathe wrote:

how do you get flow:  3v for 11L to be m = 3.666  with a cof -0.8333 and the same for temp?


From your datasheet.

There are graphs showing the relation between signal (temp/flow) and output voltage…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 13
(2,563 Views)

My question is more on how can m=3.666 and c=-0.8333. How do 3v and 11L result in being 3.666 and c in being -0.8333. I dont see those numbers for and m on the graph, or am I’m missing something.

 

Thanks for the replies so far, really appreciate them.

0 Kudos
Message 8 of 13
(2,556 Views)
Solution
Accepted by topic author TomasMathe

The values SimonGn are wrong. Not sure where he got 11L/min at 3V (at 3V, flow rate is ~34 L/min). 

 

In the formula y = mx + c, m is the slope, c the offset on the y-axis (i.e. the value at x=0). The slope is (3.5-0.4) / (40 - 0) ~= 0.077. and offset is ~0.4.

Since y = voltage and x = flow, you get voltage = 0.077*flow + 0.4. Solve for flow. Flow = voltage/0.077 - (0.4/0.077). i.e. m = 1/0.077 = 12.9 and c = -0.4/0.077 = -5.2. 

 

Now do the same for temperature.

0 Kudos
Message 9 of 13
(2,544 Views)

Hi,

 

sorry, I was looking at the charts for the VFS 1-12 QT,  the principle holds though . . . 😉

0 Kudos
Message 10 of 13
(2,533 Views)