Hello Community,

I'm working on a project for measurement of vibrations.  For that I use the program "SendAccelerometerDataOverBle" and the smartphone app "BLE Scanner" (tried the "Alpwise BLE" before but it didn't work). Normally the sample rate in this program is 1Hz which is not sufficient for my project.

How can I change the sampling rate to 1kHz?

 

I have another question. I get the output in the Device Control, but don't know how to export data to an Excel File. How is this possible?

 

Thanks a lot for your help in advance.

 

Marc

 

 

0 (0 Votes)
RE: Set Sample Rate to 1ms and export sensor data
Answer
12/1/17 3:46 PM as a reply to Marc Skokanitsch.

Hello Marc,

the frequency for sending in the example application SendAccelerometerDataOverBle can be set in the unmodified project's implementation file on line 50:

#define BLE_TX_FREQ    UINT32_C(1000)

Modify this to UINT32_C(1) to set the transfer rate to 1kH.

As for why the Alwipse BLE does not work, that is because the new API does not use Alpwise profiles, hence they are not recognized by the Alpwise App. BLE Scanner is a good alternative, that also lists the custom services of the XDK.

As for how to export the data that is printed in the console, this is currently not possible, as there is no option for this in the Workbench.

There are three ways to actually get the data. The first would be by redirecting the output manually from a terminal / command line interface (please refer to my answer in this thread for more information).

The second option would be similar, but doing it with a python script, or a small application in any other preferred programming language.

The third option would be to actually use an SD card and to store data on the SD card during runtime (you wouldn't have to print it to the console then, either). You may want to take a look at the demo Data Logger, available in the XDK's Demo Section

In any case, it is not entirely simple, since you would have to construct the file manually.

Please tell me if this was helpful, and do not hesitate to ask further questions

Kind regards,
Franjo

0 (0 Votes)
RE: Set Sample Rate to 1ms and export sensor data
Answer
12/4/17 11:26 AM as a reply to Franjo Stjepandic.

Hello Franjo,

first of all thanks for your fast and detailed answer.

 

Unfortunately I got a problem with increasing the transfer rate.

I can change to 100ms with no problem, but if I increase further, I get some error which is called

          "Failed to Enqueue BleAccelDataTransmit to Application Command Processor".

Is it possible to adjust a transfer rate of 1kHz?

0 (0 Votes)
RE: Set Sample Rate to 1ms and export sensor data
Answer
12/4/17 5:50 PM as a reply to Marc Skokanitsch.

Hello Marc,

to explain the message

"Failed to Enqueue BleAccelDataTransmit to Application Command Processor"

I have to briefly explain the structure of how BleAccelDataTransmit is called.

There is a structure called Command Processor. This basically allows to enqueue a function, which will subsequently be called internally by the Command Processor. But, this Command Processor only accepts a limited number of functions at the same time.

Basically, the Application's Command Processor's queue is most likely full, which is why the error message appears in the console.

This in turn means, that the functions that are already queued in the Command Processor are not worked off quickly enough. This is generally not an issue, since it is the same function over and over again, but this also means that the frequency cannot get higher.

The limit for sending the BLE messages is basically somewhere at a period of 50ms with the example's implementation. I am not sure if this frequency limit can become greater by changing the code, but it would be worth a try.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo

0 (0 Votes)
RE: Set Sample Rate to 1ms and export sensor data
Answer
12/6/17 11:38 AM as a reply to Franjo Stjepandic.
Hello Guys, let me just add a hint on this issue, as Franjo already explained the command processor is taking more time to consume messages than the time to produce messages (enqueue to it) as the consequence, the queued messages are being processing but the newer messages are lost because there is no space left, when I deal with single-producer-single-consume model I first take the average time to perform a complete process of message, then I setup the queue with a amount of slots sufficient high to not become full until the current message being processed.

Given this hint, try to:

- Pack you data to be not greater than 20 bytes;
- Increase the queue length of the command processor.

If this was useful, please let me know.

Best

Felipe
 
0 (0 Votes)