1
\$\begingroup\$

I have to find a solution to uniform values on 3-axis accelerometers on different android devices. I mean, a device with a specific accelerometer, subjected to the same acceleration, return values, for each of 3 axis, that are different from the values returned from another android device with different accelerometer.

\$\endgroup\$
1
\$\begingroup\$

You can use a few measurements to get that answer. To get +1 and -1, have the user set the phone on its back and face for a few seconds. To get 0, have the user drop it a foot or two (hold it in one hand and catch it with the other) or toss it in the air briefly. As long as there isn't much rotation, the accelerometers should zero out while it's in free-fall.

In general, if A is the measurement at 1G, B is the measurement at 0G, and X is the new measurement, the scaling factor would be:

$$\left(\frac{X-B}{A-B}\right) * 1G = G_{output}$$

Edit, adding rationale for formula:

We need to take one range of values, and stretch it onto another. We can do that with a scaling function. Additionally, we are not assuming that the value of 0 is necessarily going to be measured as a numerical 0. The readable values might be between 0 and 255, covering both positive and negative sensor values, for example. We deal with that using a translation function.

It might make more sense if you imagine it on a number line.

If B is your zero value, if you subtract that from your measured value, your new value (say Y) is now centered around the 'zero' value B.

$$X-B=Y$$

Now, you need to scale that into a range that you want. We measure the range of values that represents one unit in our new scale, "1 G". This is simply the measurement at 1G (sitting on the table) and 0G (freefall). You might call the units of this new number "counts per G".

$$A-B=\frac{counts}{G}$$

If you now take your translated value Y and scale it (units included as subscripts this time)

$$\frac{Y_{counts}}{(A-B)_{\frac{counts}{G}}}=\frac{Y_{counts} \times G}{(A-B)_{counts}}=\frac{Y}{(A-B)}G=\frac{(X-B)}{(A-B)}G$$

If the units help you analyze it then great, but like I said, I was just thinking about it like moving and stretching a number line.

\$\endgroup\$
  • \$\begingroup\$ Thanks a lot for your reply @Daniel. My problem is that with different devices with incorporate different accelerometers (different sensibility, different range, ecc) the reading values are really differents. I'm using now two devices and one of these has more sensitivity and bigger range than the other. For example, the two devices, subjected to the same acceleration, return me values close to -0,5g (from the device with minor sensitivity) and close to -6g (from the device with more range and sensitivity). I need that both devices return me similar values. How can I do that? \$\endgroup\$ – Bob Oct 17 '15 at 17:28
  • \$\begingroup\$ G_out is given as a real number. So, if you did the calibration right, the numbers are comparable in their valid ranges. \$\endgroup\$ – Daniel Oct 21 '15 at 4:05
  • \$\begingroup\$ I don't know what you're doing specifically, but if you're reading values and getting .5g and 6g from the same movement with to models, something is wrong. You've configured them wrong, or some math is wrong somewhere. You would need to provide more info, and possibly this is an Android-specific programming question, which I could not answer. \$\endgroup\$ – Daniel Oct 21 '15 at 4:08
  • \$\begingroup\$ I think it works now. But I have another problem. Can I reduce the maximum range with some logical formula? I would like to transform the occasional -6 values, because the other device range is +-2 and I would like to consider this last range as standard range. The easier thing would be delete these too big values but I think is a rough solution. What can I do? Thanks a lot again. \$\endgroup\$ – Bob Oct 21 '15 at 15:29
  • \$\begingroup\$ Is it actually -6G that you're reading, or does that correspond to an actual reading of -2G? If you are truly reading -6G and want to limit the output to -2G, you should just set -2G to be the minimum value. \$\endgroup\$ – Daniel Oct 21 '15 at 22:22

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.