2

I'm a student new to sensors. I'm currently calibrating the gyroscope from the following IMU: ICM42670. I was able to get the bias by leaving the gyro for some time and getting the average of the errors. I am attempting to get the scale factor by rotating the gyro to a known angle (180 degrees) and seeing the offset but I'm having trouble integrating the data.

I configured the gyroscope to have a range of +-250dps and sensitivity of 131 LSB/(dps). The gyro also has an output data rate of 50Hz and a low pass filter at 53Hz (I can change this in case that this is the problem). These are my steps for integrating:

  1. get raw data from the gyro with a sampling rate of 50Hz as well (0.02s apart). I rotated the gyro 180 degrees and back
  2. I loaded the data onto Matlab
  3. converted it to deg/sec by dividing by the sensitivity.
  4. Applied previous found bias (which was almost 0)
  5. Used the cumtrapz() function to integrate

This is that code snippet:

dT = 1/50;
rate_raw = importdata("esp\gyro_calibration\gyro_integration_data.txt");
rate = (rate_raw / 131) + y_bias; % convert to deg/sec and add bias

angle = cumtrapz(rate*dT);
t = linspace(0,10,length(angle));

figure(2)
plot(t, angle, 'LineWidth',1);
grid on
title("Gyroscope angle output");

The output is at exactly around 90 degrees which is half and I've spent a whole day trying to understand why. Any help is greatly appreciated!

enter image description here

miiguell
  • 29
  • 1
  • Adding on to my question. Is it possible that the scaling factor is around 2? Just thinking about it, I'm doing this to find the scale factor for calibration so there isn't a reason why it can't be that. I just find it extremely big... – miiguell May 28 '23 at 05:25
  • Are you absolutely sure that you have configured the GYRO_UI_FS_SEL bits the way you want them? Have you tried changing this setting to see what happens to the data? – Dave Tweed May 28 '23 at 11:47

1 Answers1

0

This is more a list of comments but it forced me to answer.

  • Your intuition is correct. A scale factor of 2 is highly unlikely. Scale factor errors for this class of sensors might be on the order of 0.01-0.02 (i.e. 1-2 percent).
  • As was already pointed out, you may want to double check sensor settings. In particular, that it is indeed 50 Hz. Does logging data for 4 seconds give you ~200 rows of data?
  • Do know that simply using cumsum(data) * dt_sec should be plenty accurate from validation you are doing.
  • Just FYI, the output data rate should generally be AT LEAST 2x the low-pass filter bandwidth (5-10x is not uncommon). But this is not likely to be your problem. Just pointing this out for when measuring real dynamics.