facebook

Visit Facebook page!

follow on facebook to get instant news and updates.

Saturday, 29 November 2014

How To Use LabVIEW With Arduino

LabVIEW Interface for Arduino


The LabVIEW Interface for Arduino (LIFA) allows users to control sensors and acquire data through an Arduino microcontroller using the graphical programming environment LabVIEW. This page describes the process of installing LIFA and its dependencies as well as running a basic LIFA example.


Hardware



Software



Procedure

Install LabVIEW
  • Install LabVIEW 2011 or later (Current Version 2013 ).
  • A full featured, non-commercial renewable 6-month evaluation of LabVIEW can be 
          downloaded here.
  • A full featured, non-commercial version of LabVIEW is available atSparkfun for $50
          and includes an Arduino Uno

Install NI-VISA



  • Install NI-VISA
  • NI-VISA provides serial (RS-232) drivers for LabVIEW and is assailable as a free
          download here.

Install the Arduino IDE


  • Install the Arduino IDE
  • The Arduino IDE is free, open source, and available for downloadhere.
  • The Arduino IDE is required to build LIFA's open source firmware.

Install JKI VI Package Manager (VIPM)
  • Install JKI VI Package Manager (VIPM)
  • VIPM is a package manager for LabVIEW and provides an easy way to install and update LabVIEW libraries.

Install LabVIEW Interface for Arduino (LIFA)

  • Launch VIPM if it is not already open.
  • Enter 'Arduino' in the search box in the upper right corner of the VIPM window and press enter.
  • The LabVIEW Interface for Arduino is displayed in the package list.
  • Click LabVIEW Interface for Arduino to select it.
  • Click the Install Package(s) button.
  • Review the package(s) to be installed.
  • Click Continue.
  • Review the Download Acknowledgement.
  • Click 'I Agree (Don't Prompt me Again)'.
  • Review the License Agreement.
  • Click I Accept.
  • VIPM will launch LabVIEW in the background.
  • If prompted with a firewall warning allow LabVIEW and VIPM through the firewall.
  • VIPM will begin downloading the package from the LabVIEW Tools Network repository.
  • The LabVIEW Interface for Arduino is now installed.
  • Click Finish.
Connect the Arduino.
  • Connect an Arduino Uno to the host computer.
  • Any Arduino compatable board should work but LIFA was designed for and tested using an Arduino Uno.
  • If this is the first time the Arduino is connected to the computer the Arduino drivers must be associated with the Arduino.
Deploy the LIFA Firmware to the Arduino.
  • Browse to the Arduino IDE directory extracted in the step above.
  • Launch the Arduino IDE by double clicking arduino.exe.
  • Click File»Open.
  • Browse to <LabVIEW>\vi.lib\LabVIEW Interface for Arduino\Firmware\LIFA_Base where <LabVIEW> is the LabVIEW directory (c:\Program Files\National Instruments\LabVIEW 20XX by default).
  • Select LIFA_Base.
  • Click Open.
  • The LIFA Firmware Source is now visible in the Arduino IDE.
  • Click Tools»Board»<ArduinoBoardType> where<ArduinoBoardType> is the type of Arduino hardware to deploy to.
  • LIFA was designed with and tested using an Arduino Uno, however most Arduino compatible hardware should work.
  • Click Tools»Serial Port»<COMX> where COMX is the COM Port associated with the Arduino (COM3 from the example above).
  • The Ports section of Windows Device Manager can be used to determine which COM port is associated with an Arduino.
  • Click the Upload button.
  • First the Arduino IDE builds the firmware from the source code.
  • Next the Arduino IDE deploys firmware to the Arduino.
  • Once the build and deploy process is complete the Arduino IDE should report Done Uploading
  • The Arduino is now programmed with the LIFA firmware.
  • The LIFA firmware will persist on the Arduino through resets and power loss and only needs to be re-deployed if it is overwritten by the user.
Run the Blink Example
<ul class='subStep'><li>

 The Arduino Blink Front Panel is shown.

</li><li>

 Press <strong>Ctrl+E</strong> to show the block diagram. (Alternately click <strong>Window»Show Block</strong> Diagram).

</li></ul>

  • Launch LabVIEW
  • Click Help»Find Examples.
  • Click the Search tab.
  • Under Enter Keyword(s) type Arduino
  • Click Search.
  • Double click Arduino Blink to open the Arduino Blink example
  • The Arduino Blink Front Panel is shown.
  • Press Ctrl+E to show the block diagram. (Alternately clickWindow»Show Block Diagram).
  • Locate the VISA Resource Constant on the far left side of the block diagram.
  • Click the drop down arrow on the VISA Resource constant.
  • Select the COM port assigned to the Arduino.
  • Note: Windows Device Manager can be used to determine the COM port assigned to the Arduino.
  • Return to the front panel by pressing Ctrl+E
  • Click the Run Arrow to run the VI.
  • The LED Indicator on the front panel will turn on and off as will the built in LED attached Arduino pin 13.
  • Adjust the Delay (mS) to change the amount of time the light stays on and off.
  • Click Stop.

No comments:

Post a Comment