05-03-2022 04:05 PM
Hi,
I have a nicla sense ME IMU sensor and I want to evaluate the various sensitivity range of the accelerometer?
Does anyone have an idea how to change the acceleration range parameter in Arduino?
Or any sample code that I can refer to?
I tried to search and found something but still, I cannot get it how to implement it on the program.
Thank you
Regards
Christian
09-15-2022 04:07 AM
Hi
This has actually already been implemented, you could refer to the:
https://github.com/arduino/nicla-sense-me-fw/blob/main/Arduino_BHY2/src/BoschSensortec.cpp
BoschSensortec::configureSensorRange() invokes the API: bhy2_set_virt_sensor_range() to change the dynamic range.
you could refer to the datasheet section 13.2.8 for more details such as the units of the range.
Let me know if this helps and / or if you have additonal questions.
void BoschSensortec::getSensorConfiguration(uint8_t id, SensorConfig& virt_sensor_conf)
gets the configuration (incl. the dynamic range) of the sensor.
09-15-2022 07:31 AM
Where do I put this command into? Ignore my stupidity, I'm pretty new to this stuff, trying to do a school project.
09-15-2022 10:44 PM
Hi Jbarton
no worries.
you could try this, e.g.:
in the example sketch: https://github.com/arduino/nicla-sense-me-fw/blob/main/Arduino_BHY2/examples/Standalone/Standalone.i...
you could add a line,
void setup()
{
Serial.begin(115200);
while(!Serial);
BHY2.begin();
accel.begin();
accel.setRange(16); // this is an example, you might need to change this to 4, 8 or 16 based on your needs
gyro.begin();
temp.begin();
gas.begin();
rotation.begin();
}
09-16-2022 07:52 AM
BTW, there is a new PR on the github which adds a new example on how to read and reconfigure the range of the IMU on Nicla Sense.
Please check the details here:
you could find a new sketch which does exactly that.
11-08-2022 12:03 PM
Thank you for your solution. Is there any way to set range from Host side? for example, i read nicla sensor data from portenta h7 by BHY2_Host libra, but there isn't any function to set range