Grove - 6-Axis Accelerometer&Compass V2.0

The Grove –6-Axis Accelerometer&Compass V2.0 is a 3-axis accelerometer combined with a 3-axis magnetic sensor. It is an upgraded version of Grove - 6-Axis Accelerometer&Compass V1.0 and based on the sensor module LSM303D which has a selectable linear acceleration full scale range of ±2g / ±4g / ±8g / ±16g and a selectable magnetic field full scale range of ±2 /±4 / ±8 / ±12 gauss. Both the magnetic parts and the accelerometer parts can be powered down separately to reduce the power consumption. The Arduino can get these data via the I2C interface with the given library for this module.



Interface Function


The LSM303D is a 6D sensor module that contains a 3D accelerometer and a 3D magnetic sensor. It has an I2C digital interface so that the analog to digital converter is avoided.

The MCU can collect 6D sensor data directly through the I2C interface.OK, let's start on using this LSM303D 6D sensor module.

Hardware Installation

  1. Hardware installation is very easy, because there's an I2C Grove in Seeeduino, so what we need to do is connect it to I2C Grove via a Grove cable.
  2. Connect the Seeeduino to PC via a USB cable to power up this system.

Download Code and Upload

  1. Download demo_code which shows how to calculate level and 6-Axis Accelerometer&Compass heading using the LSM303D.
  2. Upload the Code. Please click here if you do not know how to upload.
  3. Open the serial monitor, you will see the output result of Color Sensor as show below:

4. You can see the acceleration values and the clockwise angle between the magnetic north and x-axis.

the X/Y/Z shows the 3 axis acceleration; and then the angle between the magnetic north and x-axis calculated.

And also the the angle between the magnetic north and the projection of positive x-axis calculated。

please refer to here to know more about this parameter.


  1. All ST MEMS accelerometers are factory calibrated, allowing the user to avoid any further calibration for most of the applications. However, to reach a heading accuracy of below 2°, an easy calibration procedure is needed.
  2. When test The clockwise angle between the magnetic north and x-axis, you can align the device Xa axis to any direction, but do not make it face down. Refer to the below picture:


Copyright (c) 2008-2016 Seeed Development Limited ( /
This static html page was created from