# Accelerometer calibration

1. May 27, 2008

### mgeerts

background: I am working with an accelerometer to measure the tilt angle of a mechanical device. The accelerometer reads x, y, z values that can be made into a "gravity vector". The accelerometer can NOT be assumed to mount square with the device. The accelerometer is NOT well calibrated, so the axes of measure are NOT of equal sensitivity. Motion is not an issue as the device is typically sitting still, and motion is rather slow.

so far: The accelerometer is read when the device is known to be "level" so that the "Zero Vector" vZero can be set. The values from then on (vCurrent) are compared to vZero and the angle between is calculated. Scalar cross product between vZero and vCurrent is used to find the cosine of the angle, and a lookup table is used to transale into degrees of tilt.

The tricky part: the axes are not of equal sensitivity! This is what I need to solve. I need to scale the axes so that scalar cross product works correctly.

Two factors are in my favor: 1 - The x axis is practically irrelevent; the tilt is along that axis, so it is only used for minor mounting correction and does not affect the required accuracy. 2 - I am able to use another method to find the cos of the angle of the device, but only during calibration.

The question in simple terms:
How do i find a scalar to apply to the Y axis of my accelerometer to compensate for inconsistent sensitivity between the Y and X axes given a Zero Vector, a Current Vector and a Current Cosine of the tilt?

Since vZero x vCurrent = CurrentCos, then how do i use a correct CurrentCos to find the correct vZeor and vCurrent?

next question: did any of this make any sense or I am going to have to try to explain it all again?

2. May 27, 2008

### D H

Staff Emeritus
Use a level, or a high-tech equivalent. No you know the direction in which the true acceleration vector is pointing (up, not down. Accelerometers do not measure gravity. A normal force keeps you, your lab equipment, and the accelerometer from falling through the floor. The accelerometer measures this normal force.) Mount your accelerometer in three distinct but known orientations, the easiest being three orthogonal orientations aligned with the known local vertical. Take the accelerometer readings in each orientation. The differences result from experimental setup errors, bias, and scale errors. This should give you enough information to drastically reduce the scale factor errors and make estimate the biases.

3. May 28, 2008

### mgeerts

D H, Thank you for your reply. That is exactly how an accelerometer is calibrated in their factory, as well as the *ideal* way that an accelerometer system should be field calibrated. However, this system can not be held up in orthagonal orientation in some apparatus, which is why my problem is a slightly higher level one.

Allow me to strip down the details and just list the math.

I have two vectors, vZero(x1,y1,z1) and vCurrent(x2,y2,z2). These are the accelerometer vectors as they are read from the calibration point (vZero), and from the current orientation of the device (vCurrent).

To calculate the angle that the device has tilted, I use the equation:
vZero x vCurrent = cos(A) (the scalar cross product of two vectors is equal to the cosine of the angle between them)

However, the z and y axes are not equally sensitive, so this is giving me false readings. The key that I need is a scalar to multiply against the y axis to make this equation true. My saving grace is that i can use another method ONE TIME to find cos(A).

So the problem is... given [x1,y1,z1], [x2,y2,z2] and cos(A), solve for Y such that:
[x1,Y*y1,z1] x [x2, Y*y2, z2] = cos(A)

4. May 28, 2008

### mgeerts

okay, some new developments:

I appologize that the above equation was written partially incorrectly. It should read:

[x1,Y*y1,z1] x [x2, Y*y2, z2] = cos(A)*sqrt(x1x1+YYy1y1+z1z1)*sqrt(x2x2+YYy2y2+z2z2)

the cross product of two vectors is equal to the cosine of the angle between them times the magniture of each.

basically, i need to solve for Y in that equation! I tried pen and paper but got lost in the gigantic equations. I tried an online equation solver, but it kept giving me "error: equation is too large" errors as it was trying to solve it.

5. May 28, 2008

### D H

Staff Emeritus
Since the right-hand side is a scalar, I assume you mean the inner product (rather than cross product) on the right. Expand the left hand side,

$$x_1x_2 + z_1z_2 + y_1y_2Y^2 = \cos A \sqrt{x_1x_1 + z_1z_1 + y_1y_1Y^2} \sqrt{x_2x_2 + z_2z_2 + y_2y_2Y^2}$$

Square both side to eliminate the radicals:

$$(x_1x_2 + z_1z_2 + y_1y_2(Y^2))^2 = \cos^2 A (x_1x_1 + z_1z_1 + y_1y_1(Y^2)) (x_2x_2 + z_2z_2 + y_2y_2(Y^2))$$

Hey! This is just a big ugly quadratic equation in $Y^2$! I assume you know how to solve quadratics.

6. May 28, 2008

### mgeerts

Aye... creating a general equation out of it is a major pain! the equations are HUGE. That's okay though, there are websites that can do that with online calculators and I think I have the answer... I'm actually just hand-calculating the scale factor to see if it all works right now.

Thanks :)