LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read Serial Data from Arduino using labview VISA?

Solved!
Go to solution

I tried you code, it can read the exactly what are going on the COM port.

But, I could not see any thing on graph

0 Kudos
Message 71 of 141
(2,574 Views)

Hi drog, I am using an Arduino to read temperatures using 4 MAX6675 modules. Your VI looks like the one I need... however when I tried to run it... the temperatures are not plotted, I only can see in a window below something like the serial monitor of the arduino displaying the temperatures. I will attach my Arduino code because I think that the probles is in the way I am sending the data through the serial monitor using the "serialprint" command. I will appreciate so much your help.

 

Best Regards 

0 Kudos
Message 72 of 141
(2,483 Views)

I suspect that the problem is in the text pattern recognition in the VI. It's purpose is to extract the number text and is specific to the Arduino program. In my example:

Capture.PNG

I am looking for CR/LF, a series of digits, a decimal point, a series of digits, CR/LF and then a capital A. This is specific to the text format from my sample Arduino program.

 

I suggest reading up on regular expressions, review the text format coming out of your Arduino and changing the text pattern to match. I only used one temp sensor so you will have to alter the code to extract multiple readings. If you don't need the text coming out of the Arduino to be human readable then you could insert control characters at the Arduino end to make temp extraction easier.

 

Cheers

 

0 Kudos
Message 73 of 141
(2,463 Views)

hello drog, i am still working on my project using arduino and labview. i using your TempMon2.vi but i got a problem. the temperature doesnt show on diagram. the temperature only show on concatenated string.

 

i hope you can reply this, coz i really really need your help.

 

thanks,

best regards,

Angga

0 Kudos
Message 74 of 141
(2,422 Views)

Mind showing your code so we can tell you what is wrong with it?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 75 of 141
(2,416 Views)

hello crossrulz, this is actually not my program, but i tried to use this because i think this can worked since this program for reading temperature just like what i need.

i used max6675 and arduino mega 2560, i already get the code for the arduino. but unfortunately the program only read the temperature form arduino but doesnt show in graph. i hope you can help me.

 

thanks in advance.

0 Kudos
Message 76 of 141
(2,393 Views)

What is the string you have in the Concatinated String?  I'm thinking we can simplify this quite a bit.  If you can supply the Arduino code as well, that could be helpful.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 77 of 141
(2,409 Views)

i still don't really understand about the concatinated string, i'm still new in labVIEW.

here is the arduino code

 

#include <max6675.h>
#include <Wire.h>

 

int thermoSO = 51;
int thermoCS = 49;
int thermoCSK = 47;

 

MAX6675 thermocouple(thermoCSK,thermoCS,thermoSO);
int vccPin = 53;
int gndPin =45;

 

void setup() {
Serial.begin(9600);
//use Arduino pins
pinMode(vccPin,OUTPUT);digitalWrite(vccPin,HIGH);
pinMode(gndPin,OUTPUT);digitalWrite(gndPin, LOW);

//Serial.println("MAX6675 test");
//wait for MAX chip to stabilize
delay(500);
}

 

void loop() {
//basic readout test, just print the current temp

//serial.print("C=");
int temp = thermocouple.readCelsius();
Serial.println(temp);
//Serial.print("F+");
//Serial.println(thermocouple.readFahrenheit());

delay(500);
}

 

 

any suggestion sir ?

much appreciate for your help sir.

thanks

0 Kudos
Message 78 of 141
(2,404 Views)

We can simplify this code A LOT with that information.

 

1. Instead of a graph, use a chart.  A chart keeps a history, so you can just wire in your latest value into it.

2. Use the termination character.  The Serial.PrintLn sends your data and a Line Feed at the end.  VISA can detect that Line Feed and stop the read when it finds it.  This alone eliminates most of your code.

3. Since all that is being sent is the temperature, you can just convert staight to a number directly after reading.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 79 of 141
(2,399 Views)

thanks alot for your help sir, but now i have one more problem.

when i click run there is a window pop up, it said "VISA:  (Hex 0xBFFF0015) Timeout expired before operation completed."

 

what sould i do ? and one more thing, actually i use this program to read temperature and the data that was read is gonna control solid state relay to heater.

previously i use thermistor for reading the temperatur. and now i want to use this thermocouple. since the thermistor that i use in the program that i already made before is in arduino example, can i make the program that you gave to me as a sub Vi that work like the thermistor Vi ?

 

thanks a lot sir for your kindness,

0 Kudos
Message 80 of 141
(2,393 Views)