LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read numbers sent by Arduino in Labview

Solved!
Go to solution

Hello everyone,

 

In my project I have an arduino uno (1) that is sending float numbers (temperature and humidity) via a nrf24L01 module to another arduino uno (2). I want to show the temperature and humidity that my arduino uno (2) is receiving in Labview. The arduino uno (2) is connected via USB to the PC.

 

I downloaded LINX to achieve that but I'm really lost.

How can I read and show the data in Labview ?

 

Ty.

0 Kudos
Message 1 of 14
(5,822 Views)

Hi Naxmouk,

 

don't use LINX for that task…

 

Use the default Arduino IDE to create a sketch for the Uno (2) to receive the data from Uno(1) and then forward the data to its serial port. On LabVIEW you can then read data from serial port using VISA functions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 14
(5,798 Views)

Hello Ty,

 

You can use Visa interface of Labview to read data from arduino. You don't need LIFA for that

 

Here is a snippet.

 

layman93_1-1593617392553.png

P.S- You're serial monitor in Arduino IDE should not be open while you run the labview loop.

 

-LAYMAN93

 

0 Kudos
Message 3 of 14
(5,790 Views)

Hello Layman !

 

Thanks for your answer !

I tested it and it worked.

 

The only problem is that there are 2 numbers in the buffer, the temperature and the humidity.

My goal is to save those value in a file every 5 seconds, how can I save them separetly ?

 

0 Kudos
Message 4 of 14
(5,775 Views)

Hi Namouk,

 

You can use a spreadsheet string to array function to read different values and put them in an array.

 

layman93_0-1593623218050.png

 

Hope this helps.

 

0 Kudos
Message 5 of 14
(5,767 Views)
Solution
Accepted by topic author Naxmouk

@Naxmouk wrote:

The only problem is that there are 2 numbers in the buffer, the temperature and the humidity.

My goal is to save those value in a file every 5 seconds, how can I save them separetly ?

 


On the Arduino side, send out the data in a format like "temperature,humidity".  You can do this with something like the following (note: I am not very familiar with Arduino, I have pieced together enough to help people here):

 

serial.print(temperature);
serial.print(",");
serial.println(humidity);

 

Notice the last value is using the println command.  This appends the carriage return and line feed characters, indicating the message is complete.  And we put a comma in there to separate the values.

 

Then on the LabVIEW side, you use the VISA Configure Serial Port to set up the port.  Leave the termination character settings unwired.  Then tell the VISA Read to read more bytes than you expect to ever receive in a message; I tend to use 50 or 100.  I would use Spreadsheet String To Array to turn the string into an array.  You can then use Index Array to get your two readings out.


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 6 of 14
(5,766 Views)

Ty so much guys, it worked !!!

 

I have a last question, if I save my data every 5 seconds in a file, is it possible to choose the last 10 values of this file to draw a graph? For example, I want to know the evolution of my temperature over the last hour.

 

0 Kudos
Message 7 of 14
(5,688 Views)

@Naxmouk wrote:

is it possible to choose the last 10 values of this file to draw a graph? For example, I want to know the evolution of my temperature over the last hour.


Just use a chart.  You can set the chart history so that it only displays the last X samples (defaults to 1024 samples).


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 8 of 14
(5,679 Views)

Hello !

 

I made a VI that saves my values every seconds and it works.

Now I want to open this file in labview and create a graph with my temperature and humidity but I don't know how to do it.

In the file there are 3 columns : The date, the temperature and the humidity.

 

For example, if something happened yesterday, I want to be able to read my file and access the data of yesterday.

 

Ty in advance !

0 Kudos
Message 9 of 14
(5,635 Views)

Use Read Delimited Spreadsheet.vi to read the file. Then use Index Array to get columns 1 and 2.


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 10 of 14
(5,619 Views)