Hello,

Could someone help me with this maths problem please?

I am working on a little project involving a Tri-Axis accelerometer and I need to be able to calculate the g in a particular direction when the devices installed orientation is initially unknown.

Thus when I power the device on I have three force values let us call these the initial values. ix, iy, iz. (From these initial values we have a sense of orientation also a static total g of 1.0 = sqrt( ix2 iy2 iz2 ))

Now I accelerate the device (keeping the orientation) in a straight line so as to get a g of 1.1 (static 1g plus 0.1 acceleration) this gives me a new set of calibration g values that we can call cx, cy, cz.

What I need please is a formula for calculating the g in any direction from the calibration line/direction.

Say if I move the device forward in the same direction as the calibration direction at 0.1g then the formula/function returns 0.1, if I moved it backward the formula/function returns -0.1. and if I acceleration the device at 90 degrees to the calibration direction the formula/function returns zero.

I have tried a few ideas based on dot products but I have become stuck, any help would be much appreciated.

Added the static/initial values and a set of calibration values:

ix = 0.34

iy = -0.74

iz = -0.68

cx = 0.54

cy = -0.58

cz = -0.84

Many thanks in advance IMK