Community news, upcoming events and general discussions
Threads: 36 Posts: 88
Get technical support from the community
Threads: 1407 Posts: 7538
Threads: 18 Posts: 64
Tell us how to make XDK better!
Threads: 36 Posts: 119
Share and discuss community member projects
Threads: 78 Posts: 343
The question first: Is there a way to set the sampling rate of the sensors? I do not mean the reading frequency but the rate the sensors provide new values.
Based on the XDK-Example "StreamSensorDataOverUsb" (XDK Workbench), I implemented code to read accelerometer (raw data, BMA280), gyroscope (raw data, BMG160) and magnetometer (raw data, BMM150) at a frequency of about 1000 Hz and even a little more which is good for my purpose.
But when I checked the output, I realized that the magnetic field value updates very rarely. Reading at 1000 Hz, I got only 12 value updates within the 1000 values which is far away from the specified sampling rate of 300 Hz. In my application, there should be large and fast oscillations.
The following table shows the number of value updates per second of the different sensorcis:
Certainly, the number of value updates can not be seen equivalent to the sampling rate, but I expected similar to the accelerometer a number of value updates close to 300 per second.
I also used a different code (from xdk2mam) as a starting point. Here, I got the following number of value updates per second:
Surprisingly, the gyroscope (same sensor used, also raw data read!) provided a higher update rate than the accelerometer and furthermore a significantly higher update rate for the gyroscope itself (980 instead of 400). Still, the magnetometer results in about 12 updates per second.
So the question again:
Is there a way to set the sampling rate? Or why do different codes provide different sampling rates?
Please use datalogger application for configuring the sensor from SD card.
From the demo page of XDK, please direct to IoT Marketplace https://xdk.bosch-connectivity.com/demos In IoT Marketplace, you can find Data Logger Firmware. https://rb-iot-marketplace.bosch.com/boschiotcustomermarketplace/en/EUR/Industry-4-0/Data-Logger-Firmware/p/405862100105/
The Data Logger firmware has 2 versions,
Thank you for your fast answer. However, I prefer using my own software code. So far, I really like the XDK, but would like to get a higher resolution of the magnetometer. Looking at the different results of the gyroscope provided above, I assume there should be an easy solution to modify the sampling rate directly without your additional software. I would really appreciate to get your support for this!
Furthermore, to download the data logger, it seems that I must register first but "Registration is only allowed for entrepreneurs and freelancers, as this offer is only for commercial customers" wich I am actually not and I can not provide the recommendes fields "company name" and "VAT ID".
Thank you for your support.
Sorry to hear that you are not able to register and use datalogger.
In StreamSensorDataOverUsb application, you cannot configure the sensor.
To do so, navigate to SDK/Common/source/Sensor/Sensor.c -> Sensor_Enable(). In this function you can modify the function or call functions from Platform/Sensors/include
To set magentometer data rate,