-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arduino_BHY2: Help on high-speed sampling of accelerometer #72
Comments
Hi Gianpaolo, |
Hello! I'm having the same kind of issue here. @gmacario, have you found a suitable solution? I don't fully understand the PR linked above, so I'm wondering how you proceeded. |
Hello,
In our project we have a use case which is quite similar to the one described in the issue #48 which is still unsolved.
We want to retrieve the sensor value of the on-board accelerometer of the Nicla Sense ME at the highest possible supported by the hardware, store the values in memory then send them through the serial port and/or BLE to allow further processing (such as performing a FFT or other analysis) by external entities.
According to Table 117 in the BHI260AP datasheet the accelerometer can be sampled up to 1600 Hz, but we have been unable to achieve similar targets using the Arduino_BHY2 library.
Based on the following documentation:
We have developed the following simple sketch to be run on the Nicla Sense ME:
The sketch invokes
BHY2.poll()
insideloop()
, then reads accelerometer sensor values from Virtual SensorSENSOR_ID_ACC_PASS
and stores the results in a buffer in memory; each entry is supplemented with the timestamp when the Sensor was read.As soon as the buffer is full, the acquisition is stopped and the results are printed out in a separate loop.
Here are our questions:
ID SENSOR_ID_ACC
) vs ID 1 (SENSOR_ID_ACC_PASS
)?Is there any additional information beyond Table 88 in bst-bhi260ap-ds000.pdf?
we can call
nicla_accelerometer.begin()
and provide a custom configuration for sample rate and latency.As a matter of fact, if we call
nicla_accelerometer.getConfiguration()
afternicla_accelerometer.begin(1600, 10)
the function returns a different sample_rate from the one requested, and never higher than 400 Hz.
nicla_accelerometer.x()
,nicla_accelerometer.y()
,nicla_accelerometer.z()
just after aBHY2.update()
the values returned by those functions do not seem to change while the timestamp suffers from jitter and is not related to the sample_rate we set innicla_accelerometer.begin()
, therefore the values we are storing in the buffer for further analysis are not meaningful.The problem is not evident in the provided examples when the sensor is read every second, but as explained we want to sample the acceleration sensor at the highest frequency supported by the hardware while obtaining meaningful data.
How can we make make sure that a new value is returned when the function is called?
Any help and/or pointers to sample working code is appreciated, thanks!
The text was updated successfully, but these errors were encountered: