Reply To: UM7 accelerometer sensor data converting
Sure. Suppose, for example, you measured the following:
X = 10
Y = -15
Z = 4230
You might not be able to get a measurement where X and Y are both exactly 0, something like the above would be close enough. In this case, you’d get
// This converts raw units to acceleration in m/s/s
float scale_factor = (float)1 / 4230 * 9.8;
accel_x = X * scale_factor;
accel_y = Y * scale_factor;
accel_z = Z * scale_factor;
This actually isn’t perfectly accurate, since there will also be biases on the acceleration measurements, and each axis will have different biases and scale factors. To distinguish between bias and scale factor, you’d want to orient the sensor so that the body frame z-axis points orthogonal to gravity (so, rotated exactly 90 degrees). The non-zero measurement on the z-axis is the bias. Let that bias be represented by the variable B_z. Then the scale factor can be computed with:
float scale_factor_z = (float)1 / (4230 – B_z) * 9.8;
accel_z = (Z – B_z)*scale_factor_z;
The scale factors and biases for the X and Y axes will be different from the Z axis, so you’d need to repeat the calibration for every axis. It’s actually easiest to get all this data of you mount the sensor on a perfect cube, sitting on perfectly level table. Then you can get measurements from each axis both aligned with and orthogonal to gravity, to extract biases and scale factors.
If you have a super-accurate gimbal, you can do something more sophisticated by collecting data from every axis along with truth from the gimbal. Then you can compute all the calibration, including cross-axis alignment, scale factors, and biases, in one batch process. That’s what we did with the GP9 while we were still selling it.
Note that the accelerometers on the UM7 are consumer-grade, and the biases and scale factors aren’t very repeatable. You can get kinda close, but you’ll always be a little off.