In its electronic version, a magnetometerA sensor that detects magnetic fields -- from the earth or from anywhere else. that has its reading compensated by a tilt meter (done by an accelerometerA sensor that measures acceleration and deceleration.).
Inside the Internet of Things - Bryon Moyer Blog