LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interface arduino with labview

Solved!
Go to solution

Hi,

 

I have connected MPU9250 sensor to Arduino and have programmed the Arduino using Arduino IDE. The code runs fine and I'm getting the sensor readings on the Arduino serial monitor window. 

 

Now I want to make a GUI page through LabView, which would have dials on it showing the sensor readings, and convert it to an application (exe. form). 

Any guidelines on how can I do it? What software do I have to download? Are there any YouTube links that could help me?

 

Also, programming Arduino through Labview, and making a GUI for an Arduino program, are these two different things?

 

Please help!

0 Kudos
Message 1 of 10
(3,531 Views)
Solution
Accepted by sarwatsarfaraz

yes, everything are different things.

 

you can program arduino with LabVIEW by using an add on Arduino Compiler (which may not be supported anymore)
you can interface arduino with LabVIEW by using LINX (hobbyist toolkit), there is a section in the community forum with people that can help
you can program arduino with IDE and send data using whatever protocol to you PC, and read that protocol with LabVIEW (it seems that since you already are up and running, this could be the best solution). I suggest Serial USB communication, since it is also easy to test in serial monitor.

Try using LabVIEW community edition if this is a non commercial application.

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
Message 2 of 10
(3,505 Views)

@sarwatsarfaraz wrote:

Now I want to make a GUI page through LabView, which would have dials on it showing the sensor readings, and convert it to an application (exe. form). 

Any guidelines on how can I do it? What software do I have to download? Are there any YouTube links that could help me?

 

I highly recommend reading this article and watching the presentation: https://labviewwiki.org/wiki/VIWeek_2020/Proper_way_to_communicate_over_serial.

It will cover 95% of what you need.

 

Also, programming Arduino through Labview, and making a GUI for an Arduino program, are these two different things?


It is difficult to answer, because "programming" can mean very different things.

 

When talking about Micro-Controllers like the Arduino, "programming" can mean to take the compiled binary files and transfer them to the on-chip-memory. Some people want to automate this task and use LabVIEW to do so. They are programming (writing the binary files) using LabVIEW (as an automation tool).

 

You could also say you are programming the source code that can then be compiled into a binary file that can be executed by the microcontroller. If you do so, you are programming (writing source code) for the (program that can be run on the) Arduino.

 

You could also say that you already loaded a program on the Arduino and it just just fine (i.e., you get the readings on the serial monitor) and then want a tool that can automatically read and display these values, as you asked in the first paragraph. If you do so, some people say you would program (write source code) for (a program that runs on your computer that communicates with a program that runs on) Arduino.

 

 

Being precise with these terms is difficult and people often mix these terms around, leading to much confusion. It is good that you asked and I hope I could clarify it.

Message 3 of 10
(3,503 Views)

In general there are three ways of using LabVIEW with an Arduino

 

  1. Program the Arduino in the native Arduino language. LabVIEW can communicate with an Arduino using VISA just like any other instrument on a serial port.
    1. IMHO: this is the best way as you have full control over the communications protocol and access to all of the of Arduino libraries and LabVIEW toolkits that are already out there.
    2. I highly recommend watching this video on serial communications: VIWeek 2020/Proper way to communicate over serial
  2. Use LINX (LIFA has long since been deprecated)
    1. Full LabVIEW integration, but limited amount of Arduino libraries and peripherals directly supported
    2. The Arduino basically becomes a tethered DAQ device that needs to be connected to a computer/LabVIEW to work
  3. TSXperts Arduino compiler for LabVIEW
    1. Actually turns LabVIEW into compiled Arduino code. (A real feat on its own)
      1. Limited subset of LabVIEW vi's and primitives
      2. Very limited support for Arduino libraries 
      3. Development seems to have stopped, so those annoying bugs are here to stay
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 10
(3,480 Views)

@sarwatsarfaraz wrote:

Hi,

 

I have connected MPU9250 sensor to Arduino and have programmed the Arduino using Arduino IDE. The code runs fine and I'm getting the sensor readings on the Arduino serial monitor window. 

 

Now I want to make a GUI page through LabView, which would have dials on it showing the sensor readings, and convert it to an application (exe. form). 

Any guidelines on how can I do it? What software do I have to download? Are there any YouTube links that could help me?

 

Also, programming Arduino through Labview, and making a GUI for an Arduino program, are these two different things?

 

Please help!


Which Arduino?  

 

When I was prorgramming the Arduino Mega and wanted to have it communicate with LabVIEW running on a Windows 10 PC, I used a USB-to-TTL adapter cable.

I then used VISA in LabVIEW.

 

If you are using the Arduino Uno, which has just one serial port, it gets a little tricky.

 

Do you intend on having the Arduino continually spit out data or only when the LabVIEW program sends out a query?

 

 

0 Kudos
Message 5 of 10
(3,453 Views)

@psuedonym wrote:


Which Arduino?  

 

When I was prorgramming the Arduino Mega and wanted to have it communicate with LabVIEW running on a Windows 10 PC, I used a USB-to-TTL adapter cable.

I then used VISA in LabVIEW.

 

If you are using the Arduino Uno, which has just one serial port, it gets a little tricky.

 

Do you intend on having the Arduino continually spit out data or only when the LabVIEW program sends out a query?

 

 


Honestly there's no trick to using an Arduino Uno. In fact I don't understand what would be tricky about it as I have use an Uno in all three of the methods I mentioned above without any issues.

 

The Arduino Uno bootloader goes into a "looking for new firmware" mode for a couple seconds when it comes out of a reset condition. This allows you to stop it from autorunning and reprogram it. Once the Uno goes to "run mode" the serial port becomes available for your program to use to communicate with the Uno.

 

The only time things get "tricky" with an Uno is when you need more than one serial port on the Arduino.

 

As for constant data streaming versus a query and response scheme. It depends on where you want to do the (hard) work. Constant streaming has the advantage of easy Arduino implementation but more complicated string parsing may be needed in LabVIEW. While a query/response is easy LabVIEW implementation but more complicated Arduino code.

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 10
(3,447 Views)

@RTSLVU wrote:

@psuedonym wrote:


Which Arduino?  

 

When I was prorgramming the Arduino Mega and wanted to have it communicate with LabVIEW running on a Windows 10 PC, I used a USB-to-TTL adapter cable.

I then used VISA in LabVIEW.

 

If you are using the Arduino Uno, which has just one serial port, it gets a little tricky.

 

Do you intend on having the Arduino continually spit out data or only when the LabVIEW program sends out a query?

 

 


Honestly there's no trick to using an Arduino Uno. In fact I don't understand what would be tricky about it as I have use an Uno in all three of the methods I mentioned above without any issues.

 

The Arduino Uno bootloader goes into a "looking for new firmware" mode for a couple seconds when it comes out of a reset condition. This allows you to stop it from autorunning and reprogram it. Once the Uno goes to "run mode" the serial port becomes available for your program to use to communicate with the Uno.

 

The only time things get "tricky" with an Uno is when you need more than one serial port on the Arduino.

 

As for constant data streaming versus a query and response scheme. It depends on where you want to do the (hard) work. Constant streaming has the advantage of easy Arduino implementation but more complicated string parsing may be needed in LabVIEW. While a query/response is easy LabVIEW implementation but more complicated Arduino code.

 


The part I have highlighted in bold has tripped up many a newbie with Arduinos.

0 Kudos
Message 7 of 10
(3,391 Views)

So if I go for the second method, all I have to do is download LINX, install the firmware, connect Arduino to my PC and start programming it through Labview? No additional drivers are to be downloaded?

And this method has nothing to with VISA right? Because I haven't downloaded that. 

0 Kudos
Message 8 of 10
(3,367 Views)

yes, but you will have to keep connected all the time to your pc, since you wont be programming your arduino with LabVIEW (besides flashing the LINX firmware to command RX/TX)

i believe that VISA is inside LINX library, opening ports and configuring USB access. In some way, VISA is a Dependency of LINX.

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
0 Kudos
Message 9 of 10
(3,350 Views)

@sarwatsarfaraz wrote:

So if I go for the second method, all I have to do is download LINX, install the firmware, connect Arduino to my PC and start programming it through Labview? No additional drivers are to be downloaded?

And this method has nothing to with VISA right? Because I haven't downloaded that. 


I believe if you install it through the JKI Package manager it will make sure you have all the dependencies installed.

 

But I have to wonder why you have not installed VISA? It's free and the vast majority of LabVIEW communications uses it in some way.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 10
(3,341 Views)