How may I **detect dormancy** by using MMA8451Q?

The problem is due to regular *vertical* 1G acceleration, but the body is not always "right" oriented.

So in common case I *always* have certain non zero values on all 3 axes, even when the body does not move.

The strait forward solution is to compare resulting acceleration (i.e. geometrical sum over all of axes) to the

1GLet

,VxandVyare proper values of axes X, Y and Z accordingly.VzThus

R^2 = Vx^2 + Vy^2 + Vz^2is resulting accelerationRNow if

(

1 - eps) <|R| <(1 + eps), whereis a tolerance,epsthen we may conclude our body does not experience additional acceleration.

The problem is heavy calculation:

R = sqrt( Vx*Vx + Vy*Vy + Vz*Vz )- 3 multiplication

- 1 square root