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
Why do we interface Arduino with LabVIEW?
As mentioned earlier in this article, LabVIEW is a graphical programming language. Arduino has its program in lines of code, but when LabVIEW is integrated with Arduino the lines of code are converted into a pictorial program that is quite easily understandable, and the time taken for its execution is also half.
LED Blink with Arduino & LabVIEW
- Launch the LabVIEW.
- To launch LabVIEW .
- 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.
- 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.
Connect the LabVIEW code with Arduino
- After building the graphical code, select Tools >> Makerhub >> LINX >> LINX 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.
- 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.
- 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 .
Complete process is also explained in the video below.
Source : Interfacing LabVIEW With Arduino