Hey everybody,Has anyone found a solution to increase the sample frequency of the accelerometer ?Thank you,
As a final note, I will say that I'm unsure if the gyro also needs to be updated for this to work as intended. This setting may only work when the gyro is disabled, as you'll notice when you look at the documentation. So, making changes to CTRL_REG1_G may also be necessary. I hope this helps you and please report back with what you learn.
//gyroscope settings writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG1_G, 0xD8); // 952 Hz, 2000 dps range, 16 Hz BW //accelerometer settings writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, 0xD0); // 952 Hz, 4G range //magnetometer settings //writeRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG1_M, 0xB4); // Temperature compensation enable, medium performance, 20 Hz //writeRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG1_M, 0xBC); // Temperature compensation enable, medium performance, 80 Hz writeRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG1_M, 0xFC); // Temperature compensation enable, ultrahigh performance, 80 Hz
https://github.com/kriswiner/LSM9DS1/blob/master/LSM9DS1_MS5611_BasicAHRS_t3.ino A more thorough example of manipulating the registers on LSM9DS1 IMU as found on the Nano 33 BLE Sense.
Like Biomechanist pointed out, you need to edit a line in the .cpp file of the library.See page 52 in the datasheetYou need to understand how 8 bits make up a byte. The three left most bits (= most significant) control the output data rate.writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, .....);the current value at the .... is 0x70 : 119 hz change to 0x30 : 10 hz0x50 :50 hz0x90 : 238 hz0xB0 : 476 hz0xD0 : 952 hzThe same line can be used to change the full scale setting of the accellerometer.I made new library functions for changing the full scale setting of the gyrosope in the program. they work well and I was surprised to see that setting 2, which should not be available, nicely produced 1000 dps after all.If you want I can post the code changes here.