A digital compass, or magnetometer, is a sensor that measures the earth’s magnetic field to determine the direction to the magnetic poles. The implementation of three-axis compasses or magnetometer sensors, combined with accelerometer sensors, is critical for mobile devices in order to provide tilt compensation when they are not held horizontally.