I am trying to calibrate a MEMS accelerometer. I was able to calibrate it for the current axis which is parallel to gravity and shows correctly, 1g. But the other two axes which should be 0.00g are showing +-0.02g instead. So, e.g., when the accelerometer's x axis is parallel to gravity, it should show (1g, 0g, 0g) and not (1g, 0.02g, -0.01g) like now.

How could I eliminate those values, e.g. further calibrate accelerometer?

EDIT: The acelerometer's datasheet says nothing about calibrating except that The IC interface is factory calibrated for sensitivity (So) and Zero-g level (Off) (page 20).

  • 2
    $\begingroup$ Have you compared your errors to those on page 18? You are getting max 20 mg at rest. This seems to be within the tolerance specified: $\pm$70 mg $\endgroup$ Commented Dec 11, 2012 at 15:31
  • $\begingroup$ You have a valid point there! But why am I getting errors only on axes perpendicular to gravity (0g) and not on axis parallel to gravity (1g)? Isn't that strange? $\endgroup$
    – c0dehunter
    Commented Dec 11, 2012 at 15:59
  • $\begingroup$ I wouldn't complain if one axis is performing better than the rest. Happy robot-ing. $\endgroup$ Commented Dec 11, 2012 at 17:15
  • $\begingroup$ It doesn't really matter which axis - x, y and z show 1.00g but only and only if parallel to gravity. I hope I didn't express myself wrong by telling that only one axis shows correct value - it depends whether the axis is parallel to gravity or not! Case for only one axis, say x: when parallel to gravity it shows 1.00g (this is good); when perpendicular to gravity is shows 0.02g (not good). This occurs for all three axes. Does this info change any of your answers? $\endgroup$
    – c0dehunter
    Commented Dec 11, 2012 at 17:55
  • $\begingroup$ if (error < tolerance of device), life is good. I can't help you remove the remaining .02g error, unless you want to subtract it, given it seems to always appear. $\endgroup$ Commented Dec 11, 2012 at 18:33

1 Answer 1


It is possibly a bias in the accelerometer. The measured non-zero results (like yours) are the bias. No idea if the magnitude of these biases is right, i.e., you may be experiencing more error than you should expect from a bias. To be clear, you can subtract this bias from your estimate of acceleration. However, you should be sure that the bias doesn't change with time. Then you'll need more sophisticated methods. see: overview of INS or some literature and typical accelerometer specs.

Does your datasheet help? There's probably a section on calibration schemes. For example:

"In a no-turn or single-point calibration scheme, the part is oriented such that one axis, typically the z-axis, is in the 1 g field of gravity and the remaining axes, typically the x- and y-axis, are in a 0 g field. The output is then measured by taking the average of a series of samples. The number of samples averaged is a choice of the system designer, but a recommended starting point is 0.1 sec worth of data for data rates of 100 Hz or greater. This corresponds to 10 samples at the 100 Hz data rate. For data rates less than 100 Hz, it is recommended that at least 10 samples be averaged together. These values are stored as X0g, Y0g, and Z+1g for the 0 g measurements on the x- and y-axis and the 1 g measurement on the z-axis, respectively"

EDIT: Also please compare this error to the specified precision of your sensor. Turns out this small error was not a problem, and not unexpected.

  • $\begingroup$ Shouldn't the bias be eliminated since I was using this matlab script? Basically, I measured (x,y,z) output in nine different positions and then calculated scale factors matrix and bias vector which I incorporated in the code. What if the errors in perpendicular axes are because they are misaligned? Maybe the axes of MEMS are not orthogonal in the first place causing the deviation. I am not sure if the script should take care of that or not. $\endgroup$
    – c0dehunter
    Commented Dec 11, 2012 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.