How is level as referenced by gravity sensed

I need to be able to determine when the device is perpendicular to the surface of the earth. I may be using the wrong terms to search but surely this is a common requirement. Any suggestions appreciated. Am using MPU-9250.

Yes, or a 6050 can be used. You only need the accelerometers and not the gyros.

When X==0 and Y==0, it's perpendicular (although it may be upside-down. Use the Z value to find out.)

dickillyes: I need to be able to determine when the device is perpendicular to the surface of the earth. I may be using the wrong terms to search but surely this is a common requirement. Any suggestions appreciated. Am using MPU-9250.

Gravity is ALWAYS relating to the CENTER of the earth, not the surface.

Paul