How to increase IMU sample rate on Arduino Nano 33 IoT?

Hello everyone,

In the library Arduino_LSM6DS3, the IMU sample rate is fixed at 104 Hz which is too low for my application. I need accelerometer sample rate greater than 2000Hz.

There is no functions to set the sample rates. So I try to modify the Arduino_LSM6DS3 library.

I modify value of below line in LSM6DS3.cpp
writeRegister(LSM6DS3_CTRL1_XL, 0x4A)
Tried from 0x1A to 0xAA, and expect to get sample rate from 12.5Hz to 6664Hz.

I can get the accelerometer sample rate correctly for 12.5Hz, 26Hz, 52Hz, 104Hz, 208Hz, 416Hz

But I cannot get a higher sample rate, the maximum sample rate is about 500Hz.

How can I change a sample greater than 416Hz?

I use the example from below link to read the accelerometer data.

Thanks

Ambrose

I haven't tried myself, but I noticed the library at:

is more elaborate and complete, so maybe you can use that, or at least "steal" some code:

SparkFun_LSM6DS3_Arduino_Library/SparkFunLSM6DS3.cpp at master · sparkfun/SparkFun_LSM6DS3_Arduino_Library · GitHub has the code to change settings at about line 400 .