Showing results for 
Search instead for 
Did you mean: 

Labview Arduino query.

Go to solution



I'm attempting a basic control project to irrigate a plant based on soil moisture readings using a moisture sensor, to Arduino to Labview Software and start stop a water pump to irrigate the plant based on moisture readings. That's the plan anyways..


So far will use an Arduino Uno, open to change Arduino if an alternative works better, I need to source an Arduino compatible moisture sensor, water pump, cables, tubing. I will use  Labview 2019 witth LIN and Arduino compatible compiler installed. I have a limited eperience of Labview but not so familiar with Arduino hardware or using Labview with Arduino. For now I've been referring to Programming Arduino with Labview by Schwartz and Manickum plus some ccollege notes and managed to get Arduino LED blinking using Labview VI.


I have a few questions: If I find Arduino code to run parts of my project is there a templaate that allows me to create VIs to run the program using Labview instead of the code? Will the hardware configuration be same running in Arduino code as using Labview?


Any other advice would be greatly appreciated.



0 Kudos
Message 1 of 7

Hi GreennRed,


As I understand it there are two main ways to use an Arduino with LabVIEW.

  1. Use a toolkit like the LINX toolkit to interface with the Arduino. In this case, the code running on the Arduino is fixed by the toolkit and then you write LabVIEW code that reads from and writes to Arduino I/O.
  2. Write your own Arduino code using the Arduino IDE (using C-like code) and then use Serial communication between the Arduino and LabVIEW. This is in my opinion the more powerful choice, because you can directly control what code runs on both parts of your setup, but does require the writing of some Arduino code. It doesn't have to be complicated, and there are plenty of examples handling serial interfaces on Arduino.

If you choose the first option, then there should be examples together with the toolkit of your choice. These will show probably only fairly simple code, but you can rearrange the LabVIEW code as you need to perform more complicated tasks. If you can get a sensor that provides an analog output to the Arduino, this is definitely possible.


If you choose the latter option, you can use the VISA Serial examples to show communication on the LabVIEW side, and places like the Arduino Tutorials page or references to help. There are also Arduino forums with probably a lot of examples available.

0 Kudos
Message 2 of 7

Hi cbutcher,


Thanks for your reply.


I have the LINX toolkit, Arduino Compatible Compiler for Labview and Labview Interface for Arduino installed from the VI Package Manager.


There are a lot of good Arduino examples similar to what I would like to do and if I can get that far with Arduino code then moving sensor to Arduino and constructing a VI for inputs should be achievable for me. That will be a very good start.The book I have is also a good starting point. 


If it's OK with you can I please leave this thread open in case anyone else replies and also I will surely have more queries in the net few months?



0 Kudos
Message 3 of 7
0 Kudos
Message 4 of 7

Nice one.


Thanks Bilal.

0 Kudos
Message 5 of 7
Accepted by topic author GreennRed

Well first off there a a couple of ways to use an Arduino with LabVIEW


  1. Use LINX
    LINX basically turns an Arduino into a USB DAQ device with access to all of the Ardunio's analog and digital I/O and lots of support for various peripherals, but the Adruino must always be connected to the PC to operate
  2. Use the Arduno's native language or the Arduino compiler for LabVIEW and communicate with it the same as any other serial device
    I prefer this method as the Ardunio can run "stand alone" or communicate with LabVIEW depending on my application.

If you chose method 2 here's a couple pointers...


An Arduino should install a virtual serial port when it is first plugged into your computer

You use that serial port and NI-VISA to communicate with the Arduino just like any other device on a serial port

You have full control over the serial protocol, query and response format since you will be writing the Arduno code

Get your Arduino code to work with the Arduino Serial Monitor, then work on the LabVIEW to talk to it

Send data using the Arduino PrintLn function as it appends a LF to the end of the data. You can use that LF as a Termination Character in your VISA Reads

Separate data by comas (data1,data2,data3) then you can use "Spreadsheet string to array" with the Delimiter set to a comma to parse the data from the string right into a numeric array.

Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
Message 6 of 7

Thanks RTLSVU. 


Some good info there. I hope to experiment a bit with both methods to see which one suits me best.

0 Kudos
Message 7 of 7