Android accelerometer full range

雨燕双飞 提交于 2019-11-30 20:33:51

问题


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).


回答1:


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




回答2:


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:


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?



来源:https://stackoverflow.com/questions/25280924/android-accelerometer-full-range

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!