07-01-2020 06:10 AM
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.
Solved! Go to Solution.
07-01-2020 07:05 AM
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…
07-01-2020 07:31 AM
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.
P.S- You're serial monitor in Arduino IDE should not be open while you run the labview loop.
-LAYMAN93
07-01-2020 08:40 AM
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 ?
07-01-2020 09:07 AM
Hi Namouk,
You can use a spreadsheet string to array function to read different values and put them in an array.
Hope this helps.
07-01-2020 09:08 AM - edited 07-01-2020 09:09 AM
@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.
07-02-2020 05:01 AM
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.
07-02-2020 05:37 AM
@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).
07-06-2020 02:39 AM
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 !
07-06-2020 07:04 AM
Use Read Delimited Spreadsheet.vi to read the file. Then use Index Array to get columns 1 and 2.