LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Communication with Arduino

Solved!
Go to solution

I am trying to read some temperature sensors DS18B20 with Arduino and then display the readings from the two sensors on a string display using Labview 

the problem I am facing is that there is a new character that appears in the middle of the string 

 

also if anyone can help me with that string manipulation, that I want to separate the address of the sensor and its readings in two different arrays of strings, is that possible 

 

\

Download All
0 Kudos
Message 1 of 5
(1,872 Views)

It would also help if you posted your Arduino sketch so we can verify your message protocol.

 

Now with your LabVIEW code...

  • You only need to configure the serial port once before your loop.
  • DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (still not enough emphasis)
    • It looks like you are using a termination character.  So use that.  Just tell the VISA Read to read more bytes than you ever expect in a message (line of data).

 

Unfortunately, that is all the help I can really give without seeing the Arduino code.  But you still might want to give this a good look: VIWeek 2020/Proper way to communicate over serial

 

EDIT: One more thing.  I would not send the units from the Arduino.  Just send the channel and value.  You can then just use the Match Pattern to find the colon in the string.  Before the match will be the channel name and after match will be the value.



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 2 of 5
(1,863 Views)

thanks a lot for your fast reply, I appreciate it 

I will attach the Arduino code below and the string i am sending is as follows ("Sensor 1: 24.06 °C") and what I get at the Labview string display is as follow ("Sensor 1: 24.06A°C") where did that A came from as attached in the first picture 

0 Kudos
Message 3 of 5
(1,849 Views)

@mentawy wrote:

where did that A came from as attached in the first picture 


It appears to be from the sensor driver.  It is a 0xC5.  I would have to get into the sensor driver code to see if there is something in there.  It could be reading an extra register or the string is not properly terminated.



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 4 of 5
(1,824 Views)
Solution
Accepted by mentawy

@mentawy wrote:

thanks a lot for your fast reply, I appreciate it 

I will attach the Arduino code below and the string i am sending is as follows ("Sensor 1: 24.06 °C") and what I get at the Labview string display is as follow ("Sensor 1: 24.06A°C") where did that A came from as attached in the first picture 


I haven't looked at your pictures, but very much suspect this is to do with UTF-8 Encoding.

 

In UTF-8 the degree symbol is given by the code 0xC2B0 "°"

 

Your string is being read as the two ASCII characters 0xC2 "Â" and 0xB0 "°"

 

0xDEAD

Message 5 of 5
(1,773 Views)