How to caculate roll, pitch, yaw angle of screen from accelerometer data?

How to caculate roll, pitch, yaw angle of screen from accelerometer data?

BY 23 Sep 2015 Native Application Development

I’ve got accelerometer data and I want to identify the rotation angles of the screen.

Assuming when I put the phone at horizontal plane with screen up, the angles for roll, pitch, yaw are all zero degree.

At this time, the accelerometer value should be X=0 m/s^2, Y=0 m/s^2, Z= 9.8 m/s^2.

If I adjust the phone screen to arbitrary angle as below picture shows, how to caculate the roll, pitch and yaw angles from the accelerometer value at that place?

Written by