LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

apparently "Bluetooth Write" does not write

Hello,

I have recently purchased a Bluetooth A/D converter and I had to connected to a Labview acquisition software. I tested the hardware with a third party software that allows generic string communication on serial ports and I was able to get it to work without any issues.

Next, I wrote a simple Labview client  (see attached screen capture). The code did not work, the first symptom was that the "Bluetooth Read" vi timed out (error code 56). Labview did not report any error after "Bluetooth Write".

I initially suspected some issues with the line terminators or with the format of the string and I decided to further debug using a serial port monitor. That was the moment when surprise struck: while the port monitor reported the expected activity when using the third party software, it did not record any activity while running the Labview code. Apparently no string had passed through the port associated with the BT connection while running "Bluetooth Write", in spite of the error code 0 at the output of this vi.

I have encountered the same behavior running the code on LV8.5 and LV2010.

Any ideas?

Thanks,

C

 

0 Kudos
Message 1 of 20
(3,701 Views)

Hi,

 

I had simillar issue, my solution was to play with read modes, try this and maybe will help. 🙂

0 Kudos
Message 2 of 20
(3,678 Views)

Hey,

Thanks for your suggestion. I just tested all read modes with no change, unfortunately.

I strongly suspect the issue is with "Bluetooth Write", Portmon does not show any activity while running it.

C

0 Kudos
Message 3 of 20
(3,665 Views)

C,

 

Have you tried using the Bluetooth examples that come with LabVIEW 2010 to ensure that your device is working properly?  They are listed as Simple Bluetooth Server VI and Simple Bluetooth Client VI.  Also, something that you might find useful in order to help you programmatically develop applications for Bluetooth devices in LabVIEW can be found in a white paper on our website here:

 

http://www.ni.com/white-paper/3260/en

 

A point of information on how the bluetooth communication module works: the driver only supports one active serial channel at a time.  Also, Bluetooth Serial does not work compatibly in LabVIEW with Windows XP SP1.  So if that is what you are using, it most likely will not achieve the correct results.  

 

Regards,

 

Keith M

Applications Engineering

 

 

 

0 Kudos
Message 4 of 20
(3,647 Views)

Hi Keith,

Thanks for your reply. I run the code on LV 8.5 on XP SP3. I have also tested it on LV2010 running on Windows 7 wih the same results. 

I have already used the white paper while learning how to build the program but I am a bit confused about your suggestion regarding Simple Bluetooth Server VI and Simple Bluetooth Client VI. I have run the Simple Client. It finds my device and it identifies the available service as Simple Serial. No further data gets exchanged as the device, acting as a server, should receive a specific sets of strings which I don't seem to be sending when using my program. If I run the Simple Client with my cell phone I get a similar behavior: it finds the phone, it lists all the services then it stops.

Are they supposed to  be used in a different way?

Thanks,

Codrin

0 Kudos
Message 5 of 20
(3,640 Views)

Codrin,

 

You are very correct in that the behavior specified is exactly what the Simple Bluetooth Client is meant to do.  The Simple Bluetooth Client is simply a VI that demonstrates how to open a connection to a specified Bluetooth server and channel, read the data being sent to the channel, and display the data on a chart. Because it works, however, we can verify that LabVIEW is successfully working with your Bluetooth device.  What I would suggest doing at this point would be looking at the Simple Bluetooth Server, as the code structure within that architecture is much more similar to what you are attempting to do.  It utilizes the same order of operations that you are looking for.  After looking at it, I would try to model your application's design after how it is written in the example, as I believe that the Server example would provide an excellent template for what you are trying to do.

 

Regards,

 

Keith M.

Applications Engineering

 

 

0 Kudos
Message 6 of 20
(3,633 Views)

Keith,

Thanks again for your patience.

My impression was that I needed to write a Client, as the A/D device acted as the server.

I have attached the vi I put together in case you have a quick test setup available. It was built based on the info in the white paper and the Simple/Advanced Client examples in the library. I am pretty confident in the code, what can still be an issue is the format of the strings I am sending. But what worries me is that I am not able to trace any activity (using Portmon) through the serial port associated to the Bluetooth connection when I use "Bluetooth Write", while everything looks as expected when I use a generic terminal application.

Cheers,

Codrin

 

0 Kudos
Message 7 of 20
(3,626 Views)

Codrin,

 

Have you tried using I/O Trace with your application to determine exactly what commands are being sent to and from the device?  It is often difficult to use with serial applications as it depends whether or not your VI is using our drivers (VISA), but it could give you a bit of insight as to what level of communication is actually occuring with your Bluetooth device.

 

Regards,

 

Keith M.

Applications Engineering

0 Kudos
Message 8 of 20
(3,617 Views)

Keith,

I have not used I/O Trace, it is not part of my installation. As you can see on my code, I have not used VISA but only Bluetooth specific VI's. Regardless, I think Portmon did a great job answering your question: it traced normal activity when using a regular terminal to send strings on the serial port associated with the Bluetooth connection and did not trace anything at all when using the LabView "Bluetooth Write".

Thanks,

Codrin

0 Kudos
Message 9 of 20
(3,597 Views)

Codrin,

 

This makes me think that there might be some sort of issue in getting your Bluetooth A/D converter to work with LabVIEW in general.  Are you using the traditional Windows Bluetooth drivers?  If not, this may be what is causing the issue.  In order to get back to them, please see the following link:

 

http://digital.ni.com/public.nsf/allkb/8295C04C0A038E8686257500005CCA99?OpenDocument

 

Also, as a point of note, what is the actual Bluetooth device that you are trying to connect with?  

 

Please let me know and we can try to determine what is going on and what we may be able to do to get your application to successfully use Bluetooth Write.

 

Regards,

 

Keith M.

Applications Engineering

0 Kudos
Message 10 of 20
(3,586 Views)