I know this question is definitely solved somewhere many times already, please enlighten me if you know of their existence, thanks.
Quick rundown: I want to compute
I realize the posting is old but in case others are using it: In your last response you are indicating that you still see some deviation especially under larger angles. I experienced the same but it disappeared when I added a calibration routine to capture the accelerometer's reading on a flat surface and made all subsequent readings relative to the flat surface reading.