5

I'm working with an Adafruit LSM303DLHC Accelerometer Sensor hooked up to an Arduino. I've downloaded the appropriate libraries to make it work and uploaded the example sketch "accelsensor.pde". I then placed my sensor at rest on a flat surface and obtained the following acceleration vector values on average, in units of meters per second:

X: -0.24  Y: -0.71  Z: 10.47

At rest, each of these three values fluctuate approximately +-0.04 on average.

As I see it, the values are off a bit. At rest, the X and Y components should hover closer to 0m/s^2 while the Z component should be closer to 9.8m/s^2.

What is the best way to compensate for this biased measurement? Should I simply add back the average observed bias? Or is there a more robust method to calibrate the sensor values?

1

there are varius calculation.

At the end of the day, if take a point in every position (under no acceleration), you should end up with a sphere, or matematically speacking, wthe lenght of the vector should be equal to gravity, so sqrt(x*x+y*y+z*z) = G or, to do less computing x*x+y*y+z*z = G*G (same apply for magnetometer, but using local magnetic force, or gyroscope, using a know-speed rotation like a LP player)

To create that spere you have to take many point, and find a multiplicator (or function) for each axes. That is particualary important when one axes has differnet precision of others, you are linearizing the axis output, and then normalizig its value relative to others axes.

Once you have corrected the vector lenght to have a spere, you should look at the offset of the sphere; if its center point is not on the origin point 0,0,0 then the differece between center and origin is the correction you talk about. This is offset correction.

Also many (well, all) sensor are affected on their temperature; many claim to be "thermocompensated", that means this difference is less evident due to some some sort of hardware and/or software filtering.

  • What do you mean by "take a point in every position"? – Paul Apr 14 '14 at 20:57
1

To get rid of the fluctuation, you could always try a moving average. It isn't hard to modify the Smoothing example (under File->Examples->1. Analog->Smoothing) to accept accelerometer values.

As for the slight offset in the X & Y values, that is probably because your sensor isn't sitting perfectly flat.

  • Am i correct to assume that the z-axis should (ideally) give an acceleration value of approximately 9.8m/s^2? Or should it really read 0m/s^2 at rest? – Paul Apr 14 '14 at 19:19
  • @Paul - yes you are correct – TheDoctor Apr 14 '14 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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