LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

arduino serial

Solved!
Go to solution

Hi all ,

drog said:

----------------------------------------------------------------------------------

My Arduino continuously sends room temperature readings as part of a text string and I wrote a VI to buffer the text, extract the temp digits, display the value and graph the data.?

-----------------------------------------------------------------------------

       
i have used u r vi and able to set up visa configuration,, and able to read the values (in the cancatenated string portion).Just check the jpeg attached.

I am also attaching arduino sketch .I am not getting the Temperature graph and temperature array values....

 The descrition of the  the vi ie; TempMon2.vi?  says :

--------------------------------------------------------------------------------------------------------------------------

This program is designed to work with the March 2009 version of the Arduino Temperature program which sends a header, the raw A/D value and the temperature as an integer value.?

----------------------------------------------------------------------------------------------------------------------------

Just explain what is header ?

how to send temperature reading as part of a text string?


I am greatful if u send arduino program?????

(I am struggling to get the result from almost a month)

Thanks


 

0 Kudos
Message 1 of 9
(3,074 Views)

Hi drog,,

I have tried u r arduinio program also but i am not getting the temperature graph ,, and array values,, I aam getting only cancatenated string values at the bottom,,,

I am attaching the Pde and jpeg for reference,,

If u did't get anything about my project here is the description:\

I am trying to read LM35 values through arduino to labview ,,, The vi's are in the previous post attchments,,,,

 

Thanks

Download All
0 Kudos
Message 2 of 9
(3,072 Views)

First, a header in this instance is a short string that precedes the main message. A message header may contains control or descriptive information. A timestamp could be placed in a header, for example. Since the structure of the header is usually constant, it can be used for parsing a message.

 

In drog's example he converted the voltage to a floating point temperature value. The message starts with the header "A/D val & Temp in C." The voltage as an integer and the temperature as a floating point number are added. The message terminates with a blank line. Each message field is terminated with a carriage return/newline.

 

Here's the Arduino code containing 4 carriage returns:

temp = 30 * val / 1023 + 10;  // Convert the reading to Celsius value
 
  Serial.println( "A/D val & Temp in C");  // Print the reading and the Celsius value
  Serial.println( val, 0 );                // Print the a/d val as an integer
  Serial.println( temp, 1 );               // print the Celsius value to 1 decimal pt
  Serial.println("");


In your other examples posted elsewhere, you send a single line with the temperature and its label.


On the LabVIEW side, your VI concatenates the message string into this form:

 

 A/D val & Temp in C
 206
 16.0

 

If you enable slash codes, it looks like this:

 A/D\sval\s&\sTemp\sin\sC\r\n204\r\n16.0\r\n\r\n

 

The message is passed to a Match Pattern primitive VI. The pattern to match is given as:

 \r\n[0-9]+\.[0-9]+\r\n\A

 

The string should split at the A character. The match, containing the temperature then is expected to be be:

 \r\n16.1\r\n\A

 

In the second Match Pattern primitive VI, the temperature is extracted from the other message components, which are discarded.

 

That's what should happen. Except the pattern for the first match in the posted VI  is missing the second carriage return generated by the blank line.The message ends with two carriage returns. The pattern to match has only 1 carriage return preceding the A character. The pattern to match should be:

 \r\n[0-9]+\.[0-9]+\r\n\r\nA

 

It is important when using regular expression to match a message field to make sure that all the non-printable characters are accounted for.


JohnCS

 

 

 

Message 3 of 9
(3,057 Views)

Thanks man i didn't understand but i ll analyze and tell u ,,

0 Kudos
Message 4 of 9
(3,046 Views)

Even i tried the same thing what u gave ,, the arduino code ,, i am attaching the code ,, only cancatenated string is coming but not graph and array values....

See previous post ....the jpeg and program

0 Kudos
Message 5 of 9
(3,045 Views)
Solution
Accepted by topic author Chintha

Your problem was in the LabVIEW VI  In the VI TempMon2.vi, did you change the first Pattern to Match (which is labeled as "Search for text pattern containing temp reading" )  to match to this?

 

\r\n[0-9]+\.[0-9]+\r\n\r\nA

 

JohnCS

0 Kudos
Message 6 of 9
(3,038 Views)

can u explain ,,, what to do now

0 Kudos
Message 7 of 9
(3,035 Views)

Hi all ,, i followd u r suggestions and got the result,, thanks for every thing,,,

I am attaching the image of results i got

 

0 Kudos
Message 8 of 9
(3,030 Views)

The problem is that i am not getting the temperature values correctly,,,

is there anyproblem in conversion?

0 Kudos
Message 9 of 9
(3,029 Views)