Hey everyone,

i'm trying to set/modify the sampling rate of the XDK. Based on the example "StreamingSensorDataOverUsb" and the "enbale all Sensor in one" => https://developer.bosch.com/web/xdk/enable-all-sensors-in-one

But there seems to be no sample rate variable that could be modified. 

My goal is to be able to have for example one sensor active and this sensor beeing able to get data on High speed, or more sensors on a lower sampling speed.

 

When I try to look into the DataLogger Demo, that gets its configuration from the logger.ini from the SD Card there are sampling rates provided. But this project is kind of huge to modify, and its very different from the two examples above with a different way of setting up the sensors which is very confusing.

 

I'd appreciate any help. Thank you in advance

0 (0 Stimmen)
RE: Setting the sample rate for each sensor
Antwort
04.06.19 08:11 als Antwort auf Martin Scheck.

Hi Martin,

Based on the example "StreamingSensorDataOverUsb" I find it easiest if you create several tasks and set the speed of the data over different delays. For example, you can create a task for the accelerometer sensor and set

vTaskDelay (pdMS_TO_TICKS (200));

so every 200 ms data is output, and so on.

regards

Saeid

0 (0 Stimmen)
RE: Setting the sample rate for each sensor
Antwort
04.06.19 09:14 als Antwort auf Saeid Kajlar.

Hi Saeid,

thank you for the response.

That was an solution i was thinking about too. But it didn't feel quite comfortable having such an "dirty" workaround in my eyes.

Also if i come to think about it is this delay just when you get the data from the sensor, or when the sensor actually samples a set of data?

In the DataLogger example there are 2 kind of variables for that with "bandwith" and "sampling rate" if im not mistaken.

 

Another problem that you run into is, that you only are able tohave the same sampling rate for all active sensors and you are not able to individually set their sampling rate. If you try to do this with individual delays. And to make this happen you would need some kind of multithreading, which kind of feels overboard. Because worst case szenario would have 7-8 seperate threads (if the enviromental sensor is able to have different threads which im quite not sure right now) but that looks like it would be way too complicated and there has to be a way easier solution?

 

Is there a likewise easy option to somehow merge those 2 examples to have a clean, lighwight and easy code?

0 (0 Stimmen)
RE: Setting the sample rate for each sensor
Antwort
04.06.19 09:56 als Antwort auf Martin Scheck.

Hi Martin,

In order to work a little cleaner I would use freeRTOS timer. The USB sample has been created for demonstration purposes and is not suitable for high-speed sampling. If you do not want to call the data periodically, use datalogger application:

https://rb-iot-marketplace.bosch.com/boschiotcustomermarketplace/en/EUR/Industry-4-0/Data-Logger-Firmware/p/405862100105/

user can work with datalogger trail version for free and purchase full version for 59 euro

regards

Saeid

 

0 (0 Stimmen)
RE: Setting the sample rate for each sensor
Antwort
04.06.19 12:54 als Antwort auf Saeid Kajlar.

Hi Saeid,

thank you for your response. The idea with the timer sounds very interesting and might solve my problem. I thought that the USB sample might be used as some kind of template to dig into the world of XDK and try and error.

I have referred to the DataLogger application above, but sadly it's a very big poject that is very hard to understand and to keep a clear view. Therefor it's quite hard to modify or edit to your costum needs.

In the end I will try the approach using the freeRTOS timer, which sounds promising.

Thanks again!

0 (0 Stimmen)