Magnetic compasses were first invented during the Han dynasty in China about 200 BC. These compasses were based on observing a permanent magnet align itself to the Earth's magnetic field (seen below), and are still used today, albeit in dramatically evolved forms.
LSM303C eCompass The advent of portable personal electronics has opened a commercial niche for new varieties of compasses that are easily integrated to digital systems. In recent years, the trend has been to measure the Earth's magnetic field using anisotropic magnetoresistance sensors, which are used in STMicroelectronics' new LSM303C eCompass chip. The electrical resistance of such sensors depends on the angle between the current flow and the magnetic field within a permalloy film. The three AMR magnetometers (x, y, and z-axis) in the LSM303C chip can measure magnetic fields of +16 gauss with a resolution of less than a milligauss.
What are accelerometers doing on a compass chip? The magnetometers can determine the magnitude and orientation of the Earth's magnetic field relative to portable devices like smartphones, but navigation requires that you know the orientation of the field relative to the Earth's surface. The three-axis accelerometers are used to measure the angular difference between the xy plane of the magnetometers and the xy plane of the Earth's surface, allowing the smartphone to calculate the orientation of the local magnetic field relative to the Earth's surface so it can point north.
That all this capability can be commercially fabricated in four cubic millimeters requiring less than a milliwatt of power is rather astounding, and indicates the rapid advance in miniaturizing sensor packages. With the addition of a three-axis MEMS gyroscope, this chip would form the heart of an inertial guidance system, a useful tool for avoiding getting lost on a hike through the woods.
The LSM303C module is expected to be available in production quantities by the end of the year.