# Accelerometer bias removal

I found a good explanation on how to remove accelerometer bias (when on flat table only one axis should show values, the other two should be 0). I've calculated S and B factors (page 3):

Record $B_x^{0g}$, $B_y^{0g}$, $B_z^{0g}$, $S_{xx}$, $S_{yy}$, and $S_{zz}$ in EEPROM or flash memory and use these values in all subsequent calculations of acceleration to get the corrected outputs.

I don't know how to incorporate these into the final calculation of accelerations. I guess the bias should be substracted from my sensor reading. What about sensitivities (S)?

As noted at the top of the second page:

$B_z^{0g} = a_{z1}-S_{zz}*1g$

The "ground truth" z-axis acceleration (of an accelerometer sitting flat on the table) is $1g$, which is affected by the sensitivity of the accelerometer along that axis. You could rewrite it as follows:

$$Bias = a_{measured} - Sensitivity * a_{actual}$$

Since you want to calculate the actual acceleration from the measured acceleration, you'd rewrite it like this:

$$a_{actual}=\frac{a_{measured}-Bias}{Sensitivity}$$

Or in terms of the original variables,

$$a_{z1}^{corrected}=\frac{a_{z1}-B_z^{0g}}{S_{zz}}$$

• Thank you, the results are better but still not that good. I found an enhanced better bias removal technique but don't know how to get some of the sensitivites. If you have the will I would very much be grateful for help. The question: robotics.stackexchange.com/questions/1579/… – Primož Kralj Jul 10 '13 at 20:45

Ian's answer is mathematically correct. However, on most processors division takes longer than multiplication. So if you're at all pressed for processor resources you would want to precalculate a gain and offset for each channel, and apply it:

$k_{zz} = \frac{1}{S_{zz}}$

$b_{zz} = -\frac{B_z^{0g}}{S_{zz}}$

$a_{z1}^{corrected} = k_{zz} a_{z1} + b_{zz}$

• Thanks for the optimization, will definatelly be aware of! – Primož Kralj Jul 10 '13 at 20:36