LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bluetooth inertial measurement unit (IMU) sample rate problem

Hi,

 

I am connecting an IMU sensor (accelerometer, gyroscope, magnetometer etc.) via Bluetooth to LabVIEW.

I managed to read out data from the sensor and the data makes sense, so that's good.

 

But I still have a problem, my sample rate is very low (±25Hz-60Hz), but I want to measure at at least 100 Hz.

 

The data that comes out of the sensor contains strings of 182 characters. Of those 182 characters there are 20 parameters, each with a length of 8 characters. The rest of the characters is standard sensor output information. (see attached user guide, table on page 42). 

 

So my problem is the sample rate. I have no idea how I can change this to the sample rate I want it to measure. I can change it in the original sensor software, but it doesn't influence the LabVIEW sample rate much.

 

Do you have any idea how I could fix this? Do I maybe have to send something to the sensor?

 

If you have any more questions, please let me know!

 

Thank you!

Download All
0 Kudos
Message 1 of 4
(3,858 Views)

Hi Ruben,

 

Just having a quick look at your code there is no timing in your main loop. As you cannot use DAQmx with bluetooth you cannot set the sample rate that way so I believe the sample rate for this would be attributed to the speed at which the while loop is able to execute and as there is no timing it will run as fast as possible which is giving you a variable sample rate due to jitter with the operating system.

 

I would recommend splitting the loop into a producer consumer design pattern

See here: https://www.ni.com/en/support/documentation/supplemental/21/producer-consumer-architecture-in-labvie...

 

This will allow you to acquire data in the producer loop and then set timing in there to choose the sample rate. You can then do what you want with the data in the consumer loop. This will allow you to sample as fast as you want rather than only as fast as you can process the data which is what you are doing at the moment.

 

Hope this helps,

 

Luke

0 Kudos
Message 2 of 4
(3,785 Views)

Hi Luke,

 

Thank you for your reply, it is very helpfull to make sure that the sample frequency is constant, so that problem is solved this way. 

But do you think I can also solve the problem that LabVIEW doesn't get the correct sample rate that the sensor is set to? Is that maybe a LabVIEW setting?

 

Thank you,

 

Ruben

0 Kudos
Message 3 of 4
(3,765 Views)

Hi Ruben,

 

Having had a look through the Bluetooth VIs and functions in the LabVIEW help I haven't been able to find a way of retrieving the sample rate information from the device that we are connected to over Bluetooth. 

 

My suggestion would just be to match this as best as you could in the VI by using timing but other than that I am not entirely sure it is possible to retrieve that kind of information from the device using Bluetooth in LabVIEW.

 

Best regards,

 

Luke

0 Kudos
Message 4 of 4
(3,738 Views)