Interfacing LabVIEW With Arduino

Published  August 10, 2018   0
Interfacing LabVIEW With Arduino

In previous article of Getting Started with LabVIEW, we have seen about LabVIEW and how it can be graphically programmed and executed in computer (software level). Now in this article we learn about How to Interface LabVIEW with Arduino Board.

 

Requirements

To interface LabVIEW with Arduino, you require the following software’s and hardware’s,   

  • LabVIEW (software)
  • NI VISA (software)
  • VI packet manager (software)
  • Arduino IDE (software)
  • LINX,  (this will be available inside VI package manager, open VI package manager and search for it, double click on it. You will reach to an installation window. Click install button visible to you in that window.)
  • LabVIEW Interface for Arduino, this will be available inside VI package manager, open VI package manager and search for it, double click on it. You will reach to an installation window. Click install button visible to you in that window, as shown below

 

LabVIEW Interface for Arduino

 

Installing Package for Arduino

 

Why we interface Arduino with LabVIEW?

As already told in previous article, LabVIEW is a graphical programming language. Arduino programme is made up of lines of codes but when we interface LabVIEW with Arduino, lines of codes are reduced into a pictorial program, which is easy to understand and execution time is reduced into half.

 

LED Blink with Arduino & LabVIEW

  • Launch the LabVIEW.
  • To launch LabVIEW refer previous article.
  • Now start graphical coding.
  • In Block diagram window, right click select Makerhub >> LINX >> Open, drag & drop the Open box. Then create a control by right clicking the first wire tip and selecting Create >> Control. Thus created a Serial port.

Graphical Coding in LabVIEW

  • In Block diagram window, right click and select Makerhub >> LINX >> Close. Drag & drop Close.
  • In Block diagram window, right click and select Makerhub >> LINX >> Digital >>Write. Drag & drop Write. Then create a controls on second and third tip of wires by right clicking each individually and selecting Create >> Control. Thus created a D0 channel and Output Value.
  • In Block diagram window, right click and select Structures >> While loop. Drag the While loop across the Digital write. Then create a Shift register by right clicking on the While loop.
  • In Block diagram window, right click and select Makerhub >> LINX >> Utilities >> Loop rate. Drag & drop it inside the While loop.
  • In Block diagram window, right click select Boolean >> or. Drag & drop or inside the While loop.
  • In Block diagram window, right click and select Timing >> Wait(ms). Drag & drop Wait(ms) into the While loop and create a constant for it by right clicking on the wire tip which is left most to the Wait(ms) and select Create >> Constant.
  • In Front panel window, right click and select Boolean >> Stop button. Now stop button appears in the Block diagram window. Drag & drop it inside the While loop.
  • Now by connecting all these created blocks using wiring connections, you can build the Graphical LED blink program to interface with your Arduino hardware.

Design Simulation for LED Blink

 

Connect the LabVIEW code with Arduino

  • After building the graphical code, select Tools >> Makerhub >> LINX >> LINX Firmware wizard.

Select MakerHub firmware wizard

  • Now LINX Firmware wizard window open’s, in that select Device Family as Arduino; Device type as Arduino Uno ; Firmware Upload Method as Serial/USB. Then click Next.

LINX firmware wizard

  • Then connect the Arduino board to your PC using Arduino USB cable.
  • Now in Next window select the Arduino port by clicking to the drop down list. Select COM4. Then click Next twice.

Select COM port for Arduino

  • Then click Finish button.
  • Now you have setup the serial port and interfaced Arduino board with LabVIEW.

 

Run the Program

  • Now select the Continuously Run Icon, then in the front panel window select the port and enter the digital pin.
  • Then by switching the Output Value (which acts as an On & Off switch), you can see the in-built LED of the Arduino board blinking till the Output Value is turned Off .

Working simulation of LED Blinking using LabVIEW

 

Complete process is also explained in the video below.

Video

Have any question realated to this Article?

Ask Our Community Members