matthewflynn_
matthewflynn_
DIIDevHeads IoT Integration Server
Created by matthewflynn_ on 10/10/2024 in #code-review
.Net Class for Invensnese ICM-20948
I've written the attach class to get the accelerometer and gyro data from the ICM-20948 unit. Unfortunately the data fluctuates massively when I am trying to do a basic calibration. Can anyone help me? Am I getting the reading correctly or is it my calibration that is off. The unit is by itself flat in another room with not noise or anything there. My current usage is
var i2cSettings = new I2cConnectionSettings(105,1);
var i2cDevice = I2cDevice.Create(i2cSettings);
_icm20948 = new Icm20948(i2cDevice);

// Set bandwidth for accelerometer and gyroscope
var bandwidth = 50;
_icm20948.SetBandwidth(bandwidth, bandwidth);
var i2cSettings = new I2cConnectionSettings(105,1);
var i2cDevice = I2cDevice.Create(i2cSettings);
_icm20948 = new Icm20948(i2cDevice);

// Set bandwidth for accelerometer and gyroscope
var bandwidth = 50;
_icm20948.SetBandwidth(bandwidth, bandwidth);
For completeness from the pi
sudo i2cdetect -y 1 # for I2C bus 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
sudo i2cdetect -y 1 # for I2C bus 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
6 replies