I’ve seen a lot of neat projects using the LabVIEW interface for Arduino (LIFA). It’s a quick way to communicate with an Arduino, build a nice GUI for prototyping or testing sensors, and integrate it into a larger system (the Waterloo Labs Science Fair Mashup is a great example). It’s also pretty cheap to try ($50 for LV SE + Arduino Uno).
Recently I ran into a bit of a hiccup in trying to use LIFA with a newer Arduino Leonardo to graph some sensor data. Reading the forums, I found others who ran into the same two problems:
- The AFMotor library used by LIFA does not yet support Leonardo
- The Leonardo USB-Serial interface may not be recognized in VISA
For others who run into these issues, here are a few quick workarounds:
For #1, simply contribute a patch to the AFMotor library to add Leonardo support. Alternatively, you can remove the AFMotor and Servo libraries from the Arduino project (assuming you don’t need motor control). This is done by clicking the down arrow on the right of the tab bar in the Arduino IDE, and deleting these files from the project. The last step here is to comment out “#DEFINE STEPPER_SUPPORT 1″ in LabVIEWInterface.h. This will prevent compilation errors due to missing servo libraries (thanks for including that Sam!).
As for the VISA issues, I had no success debugging the issue with VISA 4.6. The USB-serial resource was detected, but listed as ‘incomplete’. Fortunately, updating to NI-VISA 5.1.2 solved this problem.
With those two changes, I was able to compile and upload the LIFA firmware, and communicate with the Leonardo from a LabVIEW VI. The only caveat (besides losing motor support) – some of the IO definitions listed in LIFA VI comments do not apply to Leonardo. For example – Leonardo I2C (aka ‘Wire’) IO are on pins 2/3, not on A4/A5 as on the Uno. Here’s a photo of using the Leonardo I2C interface from LabVIEW via Sam’s BlinkM Example: