The Pololu LSM303D 3D Compass and Accelerometer Module provides easy access to an advanced 3D magnetometer and accelerometer.
This tiny module features an LSM303D digital sensor with a 3-axis accelerometer and a 3-axis magnetometer. Each of six independent readings is available via I2C and SPI interfaces. The module supports operating voltages from 2.5-5.5V for use with a wide range of microcontrollers.
The LSM303D is ideal for creating a tilt compensated digital compass to keep your robot heading in the right direction.
Libraries are available to simplify use with Arduino and compatible microcontrollers.