Hello,
I'm currently developing a solution for acceleration data extraction with the M5Stack ATOM S3 module which already includes a MPU 6886 IMU sensor. In its datasheet I'm told it is capable of reaching 4 kHz of sampling rate for the accelerometer. However, while trying to change the registers in what I thought would be the correct settings for highest performance in terms of sampling speeds, it always outputs acceleration in the range of +-8 g and with sampling speed of 250Hz. This is true for any register values I write. Thus, I suspect the writing of such registers is being wrongly handled.
My questions are:
Is there any library that handles the writing of these registers without fail?
Am I choosing the right register addresses and new values?
I also add here a portion of my code corresponding of the writing of the IMU registers:
// Setup for IMU
void setupIMU() {
Wire.begin();
writeRegister(0x6B, 0x09); // Wake up MPU6886
delay(10);
writeRegister(0x1C, 0x18); // Set accelerometer to ±16g
delay(10);
writeRegister(0x1D, 0x08); // Disable Low-Pass Filter (more noise)
delay(10);
writeRegister(0x6C, 0x07); // Disable gyroscope
delay(10);
writeRegister(0x1B, 0x03); // Set gyroscope configuration (if needed)
delay(10);
}
void writeRegister(uint8_t reg, uint8_t value) {
Wire.beginTransmission(0x68); // MPU6886 I2C address
Wire.write(reg); // Register address
Wire.write(value); // Value to write
Wire.endTransmission(); // End transmission
}
void setup() {
Serial.begin(115200); // Initialize serial communication at 115200 baud rate
while (!Serial); // Wait for serial to initialize
M5.begin();
auto cfg = M5.config();
setupIMU();
}
Thank you