How to get calibration values for my accelerometer

14 views (last 30 days)
Hello all, I'm building my own flight controller and I'm using the mpu9250 IMU.
I'm sampelling the data at 1[khz].
I wasn't able to find if there is a function or app in Matlab that I can use to get the desigred bias and magnitude calibration values for my accelerometer.
I want to record the data from my IMU and than use it in some Matlab function to get the calibration values :)
Thank you for the help!

Answers (1)

Bora Eryilmaz
Bora Eryilmaz on 15 Dec 2022
Edited: Bora Eryilmaz on 15 Dec 2022
It looks like this IC has a 16-bit ADC. Depending on which acceleration range you select, the magnitude would be scaled as:
range = 2; % For a full-scale range of +/-2g.
magADC = 4096; % A 16-bit value read from the accelerometer.
magG = (magADC / 2^16) * range % Magnitude in g.
magG = 0.1250
The bias correction would require reading a steady +1g from the accelerometer when it is at rest and adjusting the magADC value above as:
magADC0 = 35000; % Say you read this value for +1g, instead of the theoretical 32768.
delta = magADC0 - 2^15; % This is the bias correction needed.
magG = (magADC0 / 2^16) * range % This would be the uncalibrated value.
magG = 1.0681
magADC = 35000; % The values you would read later during operation.
magG = (magADC - delta) / 2^16 * range % This is the calibrated value.
magG = 1

Categories

Find more on Biotech and Pharmaceutical in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!