Setup LabVIEW Interface for Arduino for Bluetooth Connection

Updated Nov 24, 2020

Environment

Software

  • Third Party Add-Ons
  • LabVIEW

Other

Hardware Software
  • Arduino IDE (to deploy included firmware to Arduino)
  • LabVIEW Interface for Arduino

I want to use the LabVIEW Interface for Arduino without my Arduino wired to my PC. How do I setup the LabVIEW Interface for Arduino to connect to my Arduino via Bluetooth?

You can connect to an Arduino via Bluetooth with the LabVIEW Interface for Arduino by completing the following steps. The steps below assume you are using the BlueSMiRF and Windows 7. However, the steps should be similar for most Bluetooth modems and operating systems.
  1. Make sure that your computer has a working Bluetooth modem installed. Many laptops have built in Bluetooth modems. If your computer does not have a built in Bluetooth modem you can purchase a USB Bluetooth adapter. Make sure that you install any required drivers for your Bluetooth adapter. The setup procedure will vary depending on the specific adapter.
  2. Make sure that you have an Arduino with the LabVIEW Interface for Arduino firmware installed on it. Attempting to install the firmware while wirelessly connected to the Arduino is not recommended. In addition make sure to disconnect the Bluetooth modem from the Arduino when deploying the firmware via USB or RS-232. When deploying the firmware to the Arduino take note of the DEFAULTBAUDRATE setting as it will be required later in step 7. 
  3. Connect your Bluetooth modem to your Arduino. The TX pin on the Bluetooth modem should connect to the RX pin (D0) on the Arduino. The RX pin on the modem should connect to the TX pin (D1) on the Arduino. Connect the Bluetooth modem's power and ground pins to the Arduino. The required power levels will depend on your Bluetooth modem. 
Note: The BlueSMiRF Silver or Gold is recommended since it plugs directly into the Arduino Protoshield and has been confirmed to work well with the LabVIEW Interface for Arduino.
  1. Connect the power to your Arduino and make sure the Bluetooth modem is powered on. Do not use a USB cable to supply power to the Arduino as it may conflict with the TX RX lines on the Bluetooth modem.
  2. You have to pair your computer with the Bluetooth modem on the Arduino before the modem will be registered as a COM port by the operating system. Use these sub-steps to pair the devices:
  1. Open the Bluetooth configuration software on your computer. In Windows 7 this is accomplished by double clicking on the Bluetooth icon in the system tray like shown below. (This icon will only appear once your Bluetooth adapter has been successfully installed on your computer).
  1. Click Add Device
  1. Select the Bluetooth modem connected to your Arduino. The modem will likely be identified with some or all of its serial number like shown in the figure below.
  1. Click Next » Enter the device's pairing code and enter 1234 for the BlueSMiRF and click Next
  1. You should get a message confirming that the device was successfully paired with the computer like in the figure below, then click Close.
  1. The Bluetooth modem should now be listed in your computer's Bluetooth configuration software.
 
  1. Determine the COM port assigned to your Bluetooth device. In Windows 7 this is accomplished by clicking Start » Control Panel » Device Manager » Ports (COM & LPT). Bluetooth modems will typically be assigned two COM ports like shown in the figure below. If this is the case try using the lowest numbered port first. This port number will be used in the next step.
  1. Open your application containing the LabVIEW Interface for Arduino code. Confirm that the Baud Rate input to the Init.vi matches the DEFAULTBAUDRATE in the Arduino Firmware found in step 2. Set the VISA Resource input to the COM port found in step 6 above.


Note: There is also a default baud rate programmed into the firmware of the Bluetooth bridge. In the case of the BlueSmirf Gold, this is 115200. This means that the three baud rates that need to match are: LabVIEW's baud rate, the Bluetooth link's baud rate, and Arduino Firmware's baud rate. 



Note: You cannot use the auto connect feature of the Init.vi (leaving the VISA Resource terminal unwired) when using a wireless connection to the Arduino.
  1. You are now ready to run your application. It may take a few seconds for LabVIEW to synchronize with the Arduino.

Additional Information

If, after following the above steps, you are still having trouble connecting to your Arduino via Bluetooth, consider the following troubleshooting steps:​
  1. Confirm that the correct firmware is deployed to the Arduino.
  2. Confirm that the Baud rate specified to the Init.vi matches the baud rate specified in the Arduino firmware.
  3. Connect your Arduino to your computer with a USB cable and run the same code.
  4. Ensure that your Bluetooth enabled Arduino is within range of your computer.
  5. Make sure you have specified the correct COM port to the Init.vi.
  6. Make sure the Bluetooth modem is powered.

Note: The package LabVIEW Interface for Arduino (LIFA) has been replaced with LINX. It is highly recommended to migrate to LINX as there will be no further development for LIFA. See How To Download Digilent LINX For LabVIEW? for more information.