From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send data to arduino via labview

As the title suggests, arduino can send data back to labview using the serial.printl() command in the arduino code. Suppose I have one code on the Arduino that measures analog voltage, and the other code that will count the frequency of an analog wave. I coded these three methods of measureing data. But I want to choose from LabVIEW which data to read, making the arduino a acquisition device. I've read about NI-VISA, but there is so clear documentation on how to use it with arduino. I've also known about LINX custom commands but from what I've seen, it only sends a U8 Array as input and recieves one as output, which does not make my understanding any clearer. I have the following questions:

-How do I make LabVIEW send commands to arduino to either measure x or y, and have it sent to various outputs?

-Is this method even possible with LabVIEW or should I pivot to a different form of computer interfacing with Arduino?

0 Kudos
Message 1 of 4
(2,157 Views)

I'm sorry but your post is unreadable since you used a super light grey font.  Why did you do that?

 

I'll ask the moderator to fix your message, but since it is the weekend, it might be a few days.

0 Kudos
Message 2 of 4
(2,118 Views)

There is nothing special about communication with an Arduino if you think of it as just another device on a serial port.

 

In fact it's even easier because YOU have full control over the code running on the Arduino. 

 

Pick a serial protocol (9600 Baud, 8 bits, 1 stop bit, No Parity)

 

Write your Arduino sketch to respond to different queries. 

 

Use VISA Serial to query the Arduino and receive the response in LabVIEW.

 

OR

 

Write your Arduino sketch to constantly send the latest measurements in one line separated by a comma using the Arduino Serial.printin function. (it appends a Termination Character)

 

Volt1,Freq1

Volt1,Freq1

Volt1,Freq1...

 

The use VISA Read (enable the termination character) to read the incoming string and then parse it using Spreadsheet String to Array into a numeric array.

 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 4
(2,095 Views)

Since you are in control of the code, you just have to define your commands and implement them on both sides.  On the LabVIEW side, you use VISA Write to send the command string and VISA Read to read the data.

 

But if you are looking for some examples, start here: VIWeek 2020/Proper way to communicate over serial


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 4 of 4
(2,053 Views)