Connect an Arduino board with LabVIEW interface

Hi,
I am currently involved in an "Blood Pressure Monitor" project. I have tried a simple code to control the pressure of a pressure sensor using a pump. I have also created an interface on LabVIEW, but unfortunately, the analog signal does not seem to transfer correctly to the interface. Below are the code and LabVIEW program I have used.



float tension, P;
int pump=2;
int valve=3;

void setup() {

  pinMode(A0, INPUT);
  pinMode(valve, OUTPUT);
  pinMode(pump, OUTPUT); 
  Serial.begin(9600);

}


void loop() { 

  digitalWrite(valve, HIGH);
  digitalWrite(pump, HIGH); 
  tension = analogRead(A0) * 5.0 / 1024;
  float P1 = (tension / 0.285 - 8.77); //Sensor calibration
  P=(P1)*7;5; //   mmHg



  Serial.println(tension);
  Serial.println(P);
 

  delay(1000);

}

image

The baud rates do not seem to match. Change to:

Serial.begin(115200);
2 Likes

Should I also set it on the block diagram if I have already set it to 9600 via the front panel?

I don't know.

1 Like

Thank you :slight_smile:

Changes made in the block diagram should be reflected in the front panel, and vice versa (as far as I can remember).
You might need to refresh one or other of the windows for the effect to take place.

1 Like

Exactly, every modification I make seems to affect both windows, but I'm not sure about the block diagram because it's my first time using LabVIEW.

I can tell you, it's just the label on the block diagram that's incorrect, your front panel value is 9600.

the analog signal does not seem to transfer correctly to the interface

You didn't give concise information about the nature of the error.
Is it just scaling incorrect? If so, one error is obvious:
P=(P1)*7;5;
Was that intended to be
P=(P1)*7.5;

1 Like

The issue is that the sensor signal displayed on the Arduino serial plotter is not showing up on the LabVIEW monitor and remains stuck at 0.
lab3

Last comment. Your Arduino is pumping out two values, with line terminator between. Try displaying those values as they come in, not in a chart.

Should these be on one line with a delimiter?

And this indicates you might gave to parse the messages:

Or given this apparent analog dropdown box in the Labview screen, is that interface looking for different server software to be running on the Arduino? Something that would be capable of delivering pin 0...5?

image

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.