Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Re-calibrate Android accelerometer?

My Galaxy S4 when horizontally placed on the flat surface reports a constant acceleration of

X:0.2 Y:-0.1 Z:10.4

Since it is placed on the table steadily and horizontally, it is expected to report

X:0 Y:0 Z:10.4

I have proven my expectation by checking the readings from another phone placed the same way as my S4. I now need the phone to collect data, which means I have to ensure the sensor is not broken and calibrated it of necessary.

Although the reading is weird, it is a constant. So can I say it is still OK, except is suffers from a bias? If so, how may I re-calibrate it?


1 Answers

One of the way is to do in-app "automatic calibration" by letting user put the device on flat surface, press the button, and store the offset to shared preference. You can also let the user to do "manual calibration" by manually inputting the offset value to it. When you need to use the sensor, recalculate by removing the value from sensor with the offset from the shared preference.

like image 149
Andrew T. Avatar answered Dec 07 '25 18:12

Andrew T.