Sampling Rate Does Not Match Configured Value (800 Hz) #48
Labels
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Description:
When using the example script provided with the Arduino_BMI270_BMM150 library and setting the accelerometer sampling rate to 800 Hz in the BMI270.cpp file, the actual output on the Serial Monitor does not reach 800 Hz. Instead, the sampling appears to max out at approximately every 4 ms (~250 Hz).
The issue seems related to the time it takes for the IMU.readAcceleration() function to execute, which I measured to take around 4 ms per call.
The sample rate is being correctly set in the library as IMU.accelerationSampleRate() correctly returns 800. However, the observed behavior indicates that the IMU.readAcceleration() function might be causing the bottleneck.
Steps to Reproduce:
change conversion factor:
Observed Behavior:
The serial output only updates approximately every 8 ms. By editing the code and using buffer before printing I could speed the serial output to approximately every 4 ms.
The actual sampling rate is far lower than the configured 800 Hz.
Expected Behavior:
The accelerometer sampling rate should match the configured value of 800 Hz.
Code Example:
Enviroment
Additional Notes:
This issue seems to stem from the time required for the IMU.readAcceleration() function to complete. At higher sample rates, this latency is significant enough to prevent achieving the configured rate.
Could this be optimized in the library, or is there a limitation in the sensor or library design that I should consider? Any guidance or fixes would be appreciated.
Thank you!
The text was updated successfully, but these errors were encountered: