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 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Β .
- 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