Uzuki Introduction to the scale factor and offset correction method of the ADXL345 acceleration sensor
I will talk about how to correct the output error of the ADXL345 acceleration sensor used in Uzuki.
There will always be some error in the sensor output, even if there are some differences.
The main errors in acceleration sensors are scale factor error, offset error, and cross coupling. This time, we will explain how to correct the scale factor error and offset error.
Near the surface of the Earth, the standard gravitational acceleration is set at 9.80665 m/s2, although this varies slightly depending on the location. This gravitational acceleration is also used as a unit of acceleration, written as G in capital letters, and the same acceleration as gravitational acceleration is expressed as 1.0 G.
In other words, when the sensor is stationary, 1G is applied vertically downward. (Since the coordinate system has the upward direction as +,
The acceleration due to gravity is -1G.)
When -1G is applied, a sensor with ideal output will naturally output -1G, but an actual sensor will output a value that includes error.
This can be corrected in the following way:
This correction method is not specific to the acceleration sensor ADXL345, but is a general method of data correction where the input and output are linear functions.
Acceleration sensor correction methods (scale factor and offset)
An ideal sensor output is expressed as "y = x" because the input acceleration and the sensor output are the same. (x: input acceleration, y: sensor output)
This is the ideal state, y = ax + b, where a: slope = 1, b: offset: = 0.
However, the actual sensor output contains errors.
The actual sensor output (before compensation) is y, and the acceleration after compensation is y'. The output is compensated according to the following formula.
y' = a'y + b' (y: sensor output before correction, a': scale factor correction coefficient, b': offset correction coefficient) Formula ①
The correction coefficients a' and b' in the formula are:
The uncorrected sensor output measurement value when +1G is applied is y+, and the uncorrected sensor output measurement value when -1G is applied is y-.
Substitute the following into formulas ② and ③ to perform the calculation.
b' = { (y+) + (y-) }/2 ② Formula
a' = 2 / { (y+) - (y-) } Formula ③
Substituting these a' and b' into the following formula ④,
Corrected output: y' = a' * (y - b') ④Eq.
You will get:
The above operations will correct the scale factor error and offset error.
(Please refer to the figure above for the output before and after correction. Red is the output before correction, and yellow-green is the output after correction.)
This operation is called calibration. Since the error of the sensor varies from one individual to another,
Calibration is a process that must be performed for each and every sensor.