≡ Menu

07 VISV Getting Started With the LabVIEW Interface for Arduino

 

In this video tutorial, I give an overview of what the Arduino hardware is and how the LabVIEW Interface for Arduino (LIFA) works. I demonstrate a simple program I wrote that scrolls 12 LEDs with a variable speed similar to a Larson Scanner.

Download Code Used in this Tutorial: (LabVIEW 2010)

There are many Arduino boards out there. A complete listing of all of them can be found here. More information about the Arduino can be found on the Arduino project website.

Overview

The Arduino, is a programmable micro controller board that has several analog inputs and digital IO lines. The Arduino language is text based and is used to create embedded programs which you download to the board.

The Arduino’s claim to fame, is that all of the hardware and software is open source. You can build your own Arduino board from published designs, or purchase one of the ready-made boards. The Arduino has a USB interface used for programming the device and reading data from it.

There are quite a few daughter boards on the market that you can plug onto the arduino. These are nicknamed: shields. For example, there’s an Ethernet interface, Xbee wireless, Bluetooth module, Motor control module, Can-Bus interface, GPS Receiver, Video output and hundreds of others.

The labview interface for arduino is a vi based API that was written and distributed by national instruments. The code also includes and arduino embedded program which must be downloaded to the device. This program which runs on the Arduino, responds to commands sent on the USB bus from the LabVIEW program. It then sends back data to the the computer via the USB.The LabVIEW VIs provided, allow you to read back the analog inputs, control the digital IO lines and use several other features of the Arduino hardware.

Step by Step Startup Guide

Here is a step by step process to get up and running with Arduino and LabVIEW:

  1. Purchase an Arduino board and accessories. You can find them at many locations. Here’s the best place to buy:
  2. Make sure you have LabVIEW 2009 or newer installed. The VIs that are included in the LIFA are saved in LV 2009, so this is the version of LV that you must have to be able to use the LIFA. If you do not have this version of LabVIEW, you can download a 30day evaluation of it from ni.com/trylabview
  3. Install NI-VISA Drivers. To LabVIEW, the arduino appears as a serial instrument device. To communicate with serial instruments in LabVIEW, you need to have the latest version of the NI-VISA driver. You can get the latest NI-VISA drivers here. Make sure to select the latest Windows or Mac versions.
  4. Install the Arduino IDE and drivers for Windows. You can download them from the Arduino website here.
    • Step-by-step instructions for setting up the Arduino software on Windows can be found here.
    • For Mac look here. Mac does not need drivers but you still need the IDE environment.
  5. Install the LIFA. The LIFA is available as a VI package through the LabVIEW Tools Network. You must first install VIPM. Once VIPM is installed, click on this link to get and install the LIFA under LabVIEW 2009+.
  6. Upload the sketch ‘LIFA_Base.pde’ to the Arduino. The LIFA comes with a sketch program that must be uploaded to the Arduino before you can use the VIs to communicate with it. You must use the Arduino IDE software (which you installed in step 4) to do this. I show how to do this in the video tutorial – above. The sketch is located at:
    • C:Program FilesNational InstrumentsLabVIEW 2010vi.libLabVIEW Interface for ArduinoFirmwareLVIFA_BaseLVIFA_Base.pde
  7. Start Playing. For support, join the Arduino LabVIEW community at ni.com/arduino

Hey, this is Michael Aivaliotis! Thanks for reading my post, listening to the podcast or watching the video on this page. When I’m not posting content on this site, I help companies develop automation powered by LabVIEW. If you want to find out how I can help you succeed with your next LabVIEW project – Contact Me.

  • http://www.facebook.com/RoRo.DrEaMeR Roroty Chan

    Thank You ^^

  • Aditya

    Hello,

    my arduino mega2560 not providing sufficient out voltage

    I checked all digital pins and the problem is same.

    The pin output is 4.2-4.5V,and this output is not sufficient for my load.

    So, kindly tell me why is the cause of this reason and how to rectify it.

    (I don’t wont to use external amplifier circuits)

    Thank you.

  • Taimur

    Nice job, dude.

  • ponchobonjo2008 .

    i got an erroR on afmotor.cpp…”CHIP NOT supported”, i am using labview 2011 and the file i have found is LVIFA_BASE.INO….I WIL TRY TO RUN….HOPING IT WORKS…REGARDS

  • ponchobonjo2008 .

    SORRY FOR THE “AFMOTOR NOT SUPPORTED” ISSUE…I DID A MISTAKE I HAD AN ATTINY 84 SELECTED INSTEAD ATMEGA2560….

  • Bert123

    Hi,

    I can´t compile the lifa_base.cpp.
    It makes same erros:

    LIFA_Base.cpp.o: In function `loop':
    D:Programmearduino-1.0.4-windowsarduino-1.0.4/LIFA_Base.ino:59: undefined reference to `checkForCommand()’
    D:Programmearduino-1.0.4-windowsarduino-1.0.4/LIFA_Base.ino:65: undefined reference to `sampleContinously()’
    LIFA_Base.cpp.o: In function `setup':
    D:Programmearduino-1.0.4-windowsarduino-1.0.4/LIFA_Base.ino:39: undefined reference to `syncLV()’

    Have anyone same solutions?

  • Sergio

    How can I know if I have ready NI-VISA? Because when I Run some program, I have the ERROR 5002

  • Jose

    Can anyone tell me if I can use this to interface with a Mega board running Ardupilot Software? Basically, I am trying to use an Ardupilot board with GPS add-on and read the GPS information using a LabView VI.

    • rahul

      When I execute the program in labview, the RX light flashes intermittenly. The pin 13 LED doesn’t turn off as it should, and I have no control over the LED on/off feature. I’ve also tried a servo control program with no response and the same RX flash. The TX never flashes. so plz help me to sort out this problem

  • karthikeyanselvamkarthi

    while compiling LIFA Base in arduino IDE , I am getting below error

    Arduino: 1.5.5 (Windows 7), Board: “Arduino Uno”

    C:Program FilesArduinolibrariesRobotIRremotesrcIRremoteTools.cpp:5: error: ‘TKD2′ was not declared in this scope

    This report would have more information with

    “Show verbose output during compilation”

    enabled in File > Preferences.

    can any one help me to get out of this error

  • karthikeyanselvamkarthi

    while compiling LIFA Base in arduino IDE , I am getting below error

    Arduino: 1.5.5 (Windows 7), Board: “Arduino Uno”

    C:Program FilesArduinolibrariesRobotIRremotesrcIRremoteTools.cpp:5: error: ‘TKD2′ was not declared in this scope

    This report would have more information with

    “Show verbose output during compilation”

    enabled in File > Preferences.

    can any one help me to get out of this error…………..

  • Ka

    Thank you!