LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bluetooth data aquisition

Hello everyone !

I'm currently working on a project for my thesis and I need to aquire data over bluetooth to my PC, using labview.
I have to say that I never used labview before and that I actualy never really learned how to use it... I read this tutorial on how to develop a bluetooth application but I'm quite confused...

 

The project is an instrumented shoe containing 8 force sensors that send its data over a RN-41 bluetooth module to my PC. When the shoe is "on", the bluetooth module is automaticaly powered-up and working. My PC is supposed to: be able to power-on the shoe and to power it off; aquire the data send by the shoe and to display it on the screen. So basicaly, the program will contain one on/off button, an image of a foot with 8 color boxes (one for each sensor) changing color depending on the force applied on the sensor, 8 boxes that will display the data of each sensor.

Thus said, and after reading the tutorial: I "just" have to creat a "client "application that will open a connection using the mac address of the bluetooth module, send/get data and display it, right ? There's no need for me to create the "server client" ?

Like I said, I never really had any programming/developping lessons...

Thanks 😃

0 Kudos
Message 1 of 21
(3,939 Views)

Hello Mike,

 

If you're completely new to LabVIEW and programming, then the first thing you should start with is this tutorial:

http://www.ni.com/gettingstarted/labviewbasics/

 

Can you elaborate on how this document confuses you?

 

About the application I seem to be missing a link:

Is the pc turning the bluetooth on (or powering up) of the shoe on or is this done by a foot?

I think you might have meant that the foot turns on the power of the bluetooth, but the pc should make/start the connection

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 2 of 21
(3,916 Views)

First of all, thank you for your response and for the tutorial.

I'll try to be more specific about the shoe: I have 8 sensors connected to a microcontroller (PIC 16F1847). The PIC is programed to convert the analog input from the sensors (1 at a time) to a digital output. Then, it sends its data to the bluetooth module who transfers them to LV. The PIC sends 16 bytes each time: 10 for the data, 3 for the adress of each sensors (sensor 1 will be 000, sensor 2 will be 001, etc...) and 3 "non used" bytes.

The shoe itself will be alimented by a battery but we wanted to have a way to stop the transfert. So, we programmed the pic in a way that if it doesn't recieve any data, then it won't transmit any. The "Go" button in LabView will in fact start a loop that will send data to the pic via bluetooth, allowing the transfert to happen. It's not an on/off the to shoe itself but to the transfert.

 

What confuse me is: should I creat a server application or "just" a client application ? Is it possible for labview to analyse the 16bytes, recognize each sensor from its 3bytes adress and then display the 10 bytes data to a different graph each time ?

 

I have someone to help me but he used labview a long time ago and only knows the basics.

I'm sorry if I'm not very clear with my explanations, english is not my native language...

0 Kudos
Message 3 of 21
(3,909 Views)

Hello Mike,

 

No problem: English is also not my native language 🙂

 

There are still some parts unclear to me in this section:

 

The shoe itself will be alimented by a battery but we wanted to have a way to stop the transfert. So, we programmed the pic in a way that if it doesn't recieve any data, then it won't transmit any. The "Go" button in LabView will in fact start a loop that will send data to the pic via bluetooth, allowing the transfert to happen. It's not an on/off the to shoe itself but to the transfert.

 

- So, we programmed the pic in a way that if it doesn't recieve any data, then it won't transmit any:

Do you mean receiving from sensor side or receiving from LabVIEW side?

Do you mean transmitting to LabVIEW side?

The bluetooth module still remains on at the PIC-side, right?

 

- Do you have any flowcharts for what's happening on the PIC and for what should be happening at the LabVIEW side?

This will make helping you alot easier and this way we can assure we're on the same page regarding the flow of the program.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 4 of 21
(3,901 Views)

Hi ThiCop,

To answer your questions: i ment that the pic has to receive data from LabVIEW in order to transmit its data to LV.

 

You have to know that the DAC from the PIC has a resolution of 10bits. 
The PIC itself sends 16 bits to labview, 10 for the data, 3 non-used and 3 for the adress.
So, the data sent by sensor1 will be like 1111111111 (data) 000 (non-used) 000(adress); decimal value = 1023
Data sent by sensor2 will be like 1111111111 (data) 000 (non-used) 001 (adress); decimal value = 9215

Data sent by sensor3 will be like 1111111111(data) 000 (non-used) 010 (adress); decimal value = 17407

Etc...


We calculated the values in decimal, corresponding to each sensors, and imagined a way where LV would compare each value and if the value is, for exemple inferior or equal to 1023, then it's corresponding to sensor1 and will display it value on a specific graph.

And then, we wanted to insert an image of a foot in labview with colorboxes for each sensors, changing color corresponding with the data values.

Hope the flowchart will help.

Best regards



Download All
0 Kudos
Message 5 of 21
(3,884 Views)

Hello Mike,

 

I think I see where you're going, but I would like to warn you about 2 things:

- I don't really see the loop in the LV flowchart, but as it looks you will only send a message from LV to the PIC once and then start transmitting.

Do I see this correct? Or are you repetitively sending this message?

In each case it is possible (based on the flowchart) that a data set will be sent by the PIC but not received by LV.

 

- Be careful with how you write down your bits:

 

1111111111 (data) 000 (non-used) 000(adress) can be equal to 1023 the Most Significant bit is "at the right side"

1111111111 (data) 000 (non-used) 001 (adress); decimal value = 1023 + 1*2^(15) = 1023 + 32768 which is different from 9215

1111111111(data) 000 (non-used) 010 (adress); decimal value = 1023 + 1*2^(14) = 1023 + 16384 which is equal to 17407

 

I know what you meant, but make sure that this is "handled" correctly on your pic.

 

 

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 6 of 21
(3,870 Views)

Yes exactly !!!
The pic sends its data (I can see it on the oscilloscope) but LV can't read it ! Why ? I thought it was because my BaudRate aren't exactly the same (I'll make them match first thing in the morning)...

I wan't LabView to transmit continuously because the PIC won't transmit if it doesn't receive anything.

The data seems to be well handled by the pic, we try several different voltage, counted the bits and it match everytime.

0 Kudos
Message 7 of 21
(3,866 Views)

Hello Mike,

 

Without the code it's impossible for me to see what's going wrong..

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 8 of 21
(3,854 Views)

Hi ThiCop,

What code do you need ? From the PIC side, LabVIEW or both ?

I'm very thankful for your interest in my problem !

0 Kudos
Message 9 of 21
(3,850 Views)

Let us first start with the LabVIEW side..

 

That part I can more easily analyze to try to see if anything might be wrong there.

If we can't find it there, then I would also need the PIC-side.. 🙂

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 10 of 21
(3,817 Views)