LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

connect bluetooth client (Android phone) to VI server

Solved!
Go to solution

Hello, I try to find a solution to be able to get data from my LabView (laptop) to my Android device. (Win7 x64, LV2014 pro, Motorola MotoX Android 4.4.4)

 

I have found the following tutorial with example AppInventor2 source:

http://puravidaapps.com/btchat.php

This is a basic BT chat between two Android devices. The code looks quite simple, but I do not understand 100%... Anyway, I compiled an apk from this source, and I tested and it works between two android devices (Nexus7 tablet and Motorola MotoX, both has Android 4.4.4).

Ok, very nice, so now I try to "mimic" the behaviour of the Android server, using LabView BT server, I have attached my test VI.

My Android phone is the BT client, I need to connect to the LV server with it.

 

So I start the LabView BT server VI to run it, and I have 10 seconds timeout, during this I click on "connect" on my Android app, and select my laptop's BT address (the laptop and the Android device were previously paired, and the connection was succesfully tested with file transfer). However, the connection is not established, I get timeout error code 56 from the Listener VI (LabVIEW:  The network operation exceeded the user-specified or system time limit.)

 

Maybe there is someone with more experiance with BT / AppInventor, and could help me how to establish a connection, and send strings to my Android phone?

Thanks,

Best Regards,

0 Kudos
Message 1 of 11
(6,146 Views)

Some additional info: I wonder, if I start to run the BT server VI on my laptop, and the "Bluetooth wait on Listener" VI starts to operate, and wait for incoming connections, should it react and accept even a simple BT client connection attempt? I mean, without using  any application, I go to BT settings on my Android phone, and I click on my laptop (in the list of the paired devices) to establish BT connection. Actually I see that, the Phone indicates that BT "connected", but on the LabView side, the "Bluetooth wait on Listener" VI just somehow does not acknowledging that the connection is built up...

Hmm, I wish I would have more experiance regarding BT networking...

0 Kudos
Message 2 of 11
(6,130 Views)

i also attach a LV2011 version of the VI...

 

Simple_Bluetooth_-_Server__mod1d.png

 

 

 

 

0 Kudos
Message 3 of 11
(6,122 Views)
Solution
Accepted by topic author Blokk

new info:

I have installed a serial terminal program for my Win7 laptop, and I set an incoming serial port for my BT adapter (COM 13).

I also reinstalled the BT driver on my laptop. Now I can connect finally from my Android phone to the laptop, and I see the message "User_xxxx" is connected" in the laptop's terminal window. Also, I can send strings to the laptop from the android...

However, I am still not able to send strings in the way back from LabView... 😞

Maybe I should try serial VI? But I could only assign an incoming serial port for the BT in the laptop, outgoing serial is not possible...

 

 

EDIT:

I am really a noob here, but I just managed to make it work 🙂

I connect via BT the laptop and the Phone, and I connect to the laptop with the above Android application.

I used the LabView example "Continuous Serial Write and Read.VI", and I am able to send and receive strings via serial port COM13 😄

0 Kudos
Message 4 of 11
(6,100 Views)
0 Kudos
Message 5 of 11
(6,054 Views)

Hey Blokk,

 

I saw your post regarding the interfacing of an android app with a LabVIEW program. I am doing something similar for my University project. Could you please explain how you did the interfacing of the app and the program? 

 

Regards,

Gg

0 Kudos
Message 6 of 11
(3,629 Views)

Everything is explained in the community doc:

https://forums.ni.com/t5/Example-Programs/LabVIEW-Android-comm-via-bluetooth-serial-using-LabVIEW/ta...

 

Do you have any specific question, because the document describes everything...?

0 Kudos
Message 7 of 11
(3,627 Views)

I have made an app on MIT App Inventor which has a set of options provided for the user. When the user selects an option, that option should be displayed in a LabVIEW program. 

I'm new to this area of LabVIEW and I don't know how to create a program where i can interface the app.

0 Kudos
Message 8 of 11
(3,618 Views)

You need to create a Visa serial connection between the app and LabVIEW. Then you can send messages back and forth...

0 Kudos
Message 9 of 11
(3,614 Views)

This block diagram actually works?

0 Kudos
Message 10 of 11
(2,665 Views)