Android accelerometer full range

2020-03-07 09:58发布

I am currently working with Android Sensor API and accelerometer data. Though the internal components should support high acceleration (even +-16g), I tried some recent smartphone and found that the maximum range of exposed data is usually +-2g (e.g. Nexus 5) and sometimes +-4g (e.g. Nexus 4). Is there any way to set the full scale of the sensor? (I didn't manage to find a public API for this) Alternatively, is there any flagship smartphone that support higher range from stock? (e.g. +-8g, +-16g).

3条回答
Luminary・发光体
2楼-- · 2020-03-07 10:16

Sorry that this is an answer and not a comment, but I don't have the rep yet. I've got a Moto X 2nd Gen, and the accelerometer has a 16-g range(+/-).

Here's the datasheet for the sensor. It's an MPU6515 from Invensense.

查看更多
狗以群分
3楼-- · 2020-03-07 10:18

As ignzz stated in his/her initial post, it does not seem to be a problem from the sensor hardware, which in his/her case can also record +/-16g in principle. I believe it has to do with the settings of the operating system.

However, I haven't had time to give a try to what I described above. Has someone tried?

查看更多
该账号已被封号
4楼-- · 2020-03-07 10:21

I'm facing the same problem as yours. DISCLAIMER: I just discovered what I'm writing, so I haven't tested it at all... but I think it's in the right direction.

Checking what range is functional is quite simple: Sensor.getMaximumRange() http://developer.android.com/reference/android/hardware/Sensor.html#getMaximumRange%28%29

Now, as you know, setting the appropriate value is a much more involved thing. I believe it has to do with Android's so-called "Hardware Abstraction Layer" https://source.android.com/devices/reference/files.html

I've found this document by STMicroelectronics, who are the manufacturers of the accelerometers embedded in Samsung Galaxy SIII and S4 http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00063297.pdf

If I'm getting it right, you need to #define ACCEL_MAX_RANGE in configuration.h (page 5 of the document) as 8 or 16*GRAVITY_EARTH. There are plenty of instructions following, which I'm still trying to understand, but I think one would need to root the smartphone and compile Android from its source.

Hope this helps! If you manage to solve it, please let me know so that we can help each other.

Regards

查看更多
登录 后发表回答