How to obtain absolute rotational angles from SparkFun 6DoF IMU Breakout - ISM330DHCX (Qwiic)?

Hello, I connected the sensor to ESP32-S3 Thing Plus and tried Examples→SparkFun 6DoF ISM330DHCX→example1_basic. However, under Gyroscope in the Serial Monitor, I got very large values like ±4000, ±7000, -17000, etc. rather than angles like [0, ±180] degrees. What is the unit of these large values from gyroData.xData, gyroData.yData and gyroData.zData? Could you please let me know how to get the angles about the pitch/yaw/roll axes in degrees? Thanks

Any accel/gyro AHRS algorithm will work. Mahony filter example

Of course, with a 6DOF sensor, the yaw angle origin cannot be determined, so yaw will not be absolute.

2 Likes

Thanks. Do you know which offers better accuracy and consistency?

SparkFun VR IMU Breakout - BNO086 (Qwiic) - SparkFun Electronics

or

SparkFun 6DoF IMU Breakout - ISM330DHCX (Qwiic) - SparkFun Electronics

The Bosch sensors self-calibrate using proprietary firmware, which is designed for ease of use rather than accuracy and consistency.

You can do much better with open source code, if you are willing to put some effort into the calibration process.

1 Like

Thanks. Is there a tutorial on how to do the calibration properly? The README file doesn’t say how to use those files in the link you provided.

I tried ism330_Mahony and it asked me to keep the sensor still. I put it on a desk. Then, it outputted 343, -3, -156 continuously. Am I supposed to then uncomment the definition of GAL_GYRO and change the gxyz_offset[3] to these values? What next after this?

// if gyro is to calibrated upon startup, define the following:
#define CAL_GYRO
float gxyz_offsets[3] = {0};
// otherwise, define the gyro offsets explicitly
//float gxyz_offsets[3] = {131.0, -579.0, -183.0};

Another thing is during the calibration, am I supposed to put it on a desk or mount it on the object where I will use the sensor? The floor in my room is not flat.

Watch youtube tutorials or search the forums for other examples…most of this stuff has been answered in previous threads

The offsets are used if either your sensor is consistently offset in its readings, or if you’ll be mounting in on a chassis of some kind where it won’t be on the center of its axis of rotation

1 Like
1 Like