LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bluetooth communication (HC05) and LabVIEW

Hello. I've read a bunch of discussion boards on Bluetooth applications, but I'm afraid I'm even more confused now and still can't get my application to work. I have an Arduino Uno, HC05 Bluetooth module, and a Bluegiga dongle (which I'm not even sure if I need... Sigh...). I know the following:

 

HC05 device name: BT05

HC05 Mac address: 00:15:83:00:4A:41

HC05 UUID: (from AT command: 0xFFE0, but I can connect using the bluegiga software using 2A00)

HC05 is paired to my computer

Bluegiga dongle is attached to COM9

Arduino is attached to COM5

 

All I want to do is send the following string from LabVIEW to the HC05 module (the carriage returns need to be maintained):

 

x2,1]

15,15,2,2]

0,0,2,2]

 

 

I've tried just using the basic, built-in bluetooth vi's but I don't think the HC05 has a GUID (Basic_bluetooth.vi).

 

I've tried using the Bluegiga dongle in two different ways (using the vi package that you download and install and then not using the vi package). bluetooth_arduino_connection_v1 and v2.vi

 

I know that the Bluegiga is able to connect to the HC05 because I've used the ble_scan_devices.vi available at the recommended website (https://forums.ni.com/t5/Community-Documents/LabVIEW-BLE-Bluetooth-Low-Energy-toolkit/ta-p/3538612)

 

From viewing the serial port of the arduino, it never receives any string (let alone the string I want). What am I doing wrong?

0 Kudos
Message 1 of 5
(4,173 Views)
  1. Don't use the low level Blutooth VIs in LabVIEW
  2. The HC05 is a Bluetooth serial interface and Windows should install a virtual serial port once it is paired
  3. Simply pair the HC05 with your computer like any other BT device
  4. Once the HC05 is paired and the virtual serial port set up the HC05 becomes "transparent"
  5. Communicating with your Arduino through the HC05 Bluetooth will be no different than communicating with an Adruino connected with USB using a virtual com port.

I suggest you get your program working using the USB connection first.

As once that is working it will be simple to replace the USB with the Bluetooth connection.

 

Everything you ever wanted to know about the HC05

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 5
(4,122 Views)

Hi, I'm still having some problems accomplishing #4 and #5 from your reply. We'll start with #5:

 

5. I was able to get my program to work through the USB connection through COM5 to the Arduino board.

  • LabVIEW file: text_send_L_A.vi
  • Arduino code: USB Connections.txt

The program works beautifully.

 

However, when I try to add in the Bluetooth connection to my Arduino program, I get an error code -1073807339. Source "VISA Read in text_send_L_A.vi" My Arduino code for the bluetooth connection added is "Bluetooth Connections.txt" 

 

Part of the problem is that I don't understand how to accomplish #4 from your suggestion. I know that my device is paired to my computer, but I really don't understand what you mean by the "HC05 becomes 'transparent'". How am I supposed to connect to it? What's the COM port number/what am I supposed to wire to the VISA resource name of the VISA configure serial port vi?

 

I attached two pictures showing that my HC05 (named BT05) is paired and the port numbers in device manager. I tried port 6 but that's what leads to the error mentioned above.

 

Message 3 of 5
(4,049 Views)

My first question is why are you using software serial? Frankly I have never used the software serial so you are on your own and that's not a LabVIEW issue.

 

  1. Unplug the USB
  2. Put the HC-05 on the standard Arduino Rx and Tx pins
    1. Rx on the Arduino goes to Tx on the HC-05 🙂
  3. Power up the Arduino and pair the HC-05
    1. Power the Arduino from the power connector not USB
  4. Change VISA to use the right virtual serial port on the computer.
    1. From your picture I would say Com6
  5. Now your USB Connections.txt should run just fine
    1. You might have the change the baud rate to what the HC-05 is set to .
    2. But, that's what I mean by "transparent"

Oh BTW: Have you setup the HC-05 its self, set the baud rate, etc..?

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 5
(4,038 Views)

I'm using software serial because it was part of the original program. What I'm trying to do is take a program that communicated via bluetooth from an app on an iPhone and integrate it with a bunch of other sensors that I'm controlling through LabVIEW (that way I only have one user interface). I'm decently competent at LabVIEW. I'm not competent at Arduino (Gah!!!). 

 

I did what you said and it's still not working. The HC05 is setup, and it works well with the iPhone. I think the problem is that it isn't establishing a virtual port when it pairs. COM6 is an incoming port. Should it be outgoing? Sorry for my ignorance. 

0 Kudos
Message 5 of 5
(4,027 Views)