Attempt to calibrate the accelerometer

I am writing an application that will use an accelerometer to calculate the average value of geforce operating on the phone. Thinking about the problem, I came to the conclusion that when the phone is at rest, adding all the axis values ​​together will give me an answer of +9.8 (acceleration due to gravity).

Now I assumed that if I subtract 9.8 from the sum of all the axes, this will give me the combined force acting on the phone, not taking gravity into account. Therefore, if the phone should be in a fixed position, it will return the value 0.

Now it works correctly, if the phone lies directly on one axis, but if the phone was supposed to lie on something at an angle of 45 degrees, it returns a value of 4-5 (about two times less than that of gravity), the closer the angle to axis, the smaller the registered force (will go forward and assume that it is proportional)

In my opinion, this should not happen, it should return 0, since the entire axis will cancel each other, no? how is the phone stationary, shouldn't there be any effort recorded from the phone?

+4
source share
1 answer

A value of 4-5 m / s2 indicates either a small error in your calculation or a hardware defect. You said you add all the values, but how do you do it? You must calculate the value as sqrt (x * x + y * y + z * z). This is due to the fact that acceleration, such as speed, position, ... are vectors, and their length is calculated in accordance with the Pythagorean theorem .

In general, these sensors are not as accurate as you might expect. On iPhone, I measured g-force values ​​between 9.75 and 9.87. The values ​​depend on the temperature (put it in the refrigerator and you get lower values ​​- I checked it ;-), and there are really differences when changing the orientation. I found a delta value of 0.3 m / s2. To get this correction, you will need heavy mathematics ( Kalman-Filter or similar material) and, of course, a second sensor (a gyroscope, because the magnetometer, i.e. the compass reacts too slowly).

+1
source

All Articles