# Adafruit 10-DOF IMU Breakout

## Introduction

![](https://cdn-learn.adafruit.com/assets/assets/000/012/539/medium800/sensors_1604_LRG.jpg?1385663032)

Danger: 

Adafruit's 10DOF (10 Degrees of Freedom) breakout board allows you to capture ten (err, eleven!) distinct types of motion or orientation related data.   
  
After testing a lot of combinations of sensors, we settled on the following devices that we think offer the best results and the least amount of hassle:

- **LSM303DLHC** - a **3-axis accelerometer** (up to +/-16g) and a **3-axis magnetometer** (up to +/-8.1 gauss) on a single die
- **L3GD20** - a **3-axis gyroscope** (up to +/-2000 dps)
- **BMP180** - A **barometric pressure sensor** (300..1100 hPa) that can be used to calculate altitude, with an additional on-board **temperature sensor**

# Related Links
The Adafruit 10DOF board and library reuses the existing Adafruit drivers for the **LSM303DLHC** (accelerometer and magnetometer), the **L3GD20** (gyroscope) and the **BMP180** (pressure/altitude sensor).   
  
For information about these particular drivers, consult the following learning guides:  

- [LSM303DLHC Learning Guide](http://learn.adafruit.com/lsm303-accelerometer-slash-compass-breakout/overview)
- [L3GD20 Learning Guide](http://learn.adafruit.com/adafruit-triple-axis-gyro-breakout)
- [BMP180 Learning Guide](http://learn.adafruit.com/bmp085/)

This breakout is basically just a smooshed together version of all three so anything you can do with those libraries/guides will follow here.  

# Adafruit 10-DOF IMU Breakout

## Connecting It Up

All of the sensors on the Adafruit 10DOF breakout communicate via a two-pin I2C bus, making it relatively easy to setup with a minimum number of cables:

![](https://cdn-learn.adafruit.com/assets/assets/000/012/566/medium800/sensors_1604_LRG.jpg?1385723748)

Info: 

# Basic Setup (5V Logic, Arduino Uno, etc.)
We'll be using an Arduino UNO here, but the code will work on a Mega or Leonardo just fine. Most other Arduino compatibles should have no problems either but we only support official Arduinos for code.  

- Connect the **SCL** pin on the breakout to the **SCL** pin on your Arduino. On an UNO & '328 based Arduino, this is also known as **A5** , on a Mega it is also known as **digital 21** and on a Leonardo/Micro, **digital 3**  
- Connect the **SDA** pin on the breakout to the **SDA** pin on your Arduino. On an UNO & '328 based Arduino, this is also known as **A4** , on a Mega it is also known as **digital 20** and on a Leonardo/Micro, **digital 2**
- Connect the **VIN** pin on the breakout to **3.3V or 5V** on your Uno (5V is preferred but if you have a 3V logic Arduino 3V is best)  
- Connect the **GND** pin on the breakout to the **GND** pin on your Uno

That's it! With those four wires, you should be able to talk to any of the I2C chips on the board and run any of the example sketches.![](https://cdn-learn.adafruit.com/assets/assets/000/012/586/medium800/sensors_10dofwire.jpg?1385760583)

# Advanced Setup
While most people probably won't need to use the pins below, we've also broken out a few extra pins for advanced users or for special use cases. If you need to use any of these pins, simply hook them up to a GPIO pin of your choice on the Uno:  

- **GINT** - The interrupt pin on the L3GD20 gyroscope  
- **GRDY** - The 'ready' pin on the L3GD20 gyroscope  
- **LIN1** - Interrupt pin 1 on the LSM303DLHC  
- **LIN2** - Interrupt pin 2 on the LSM303DLHC  
- **LRDY** - The ready pin on the LSM303DLHC

These pins are all outputs from the 10-DOF breakout and are all 3.3V logic, you can use them with 5V or 3V as 3.3V registers 'high' on 5V systems.  

# 3V3 Setup
If you are using an MCU or board with 3V3 logic (instead of the 5V logic used by the Arduino Uno), you can still power the 10-DOF with the VIN pin _or_ you can use the 3Vo pin, which will bypass the on-board 3V3 regulator and level shifting:  

- Connect **Vin or 3Vo** on the breakout to the **3.3V** supply on your target MCU
- Connect **GND** on the breakout to **GND** on the target MCU

Info: 

# Adafruit 10-DOF IMU Breakout

## Software

# Installing LSM303DLHC, L3GD20, and BMP180 Drivers

You will need to install all of the following libraries to make use of the Adafruit 10DOF breakout:

- [Adafruit Unified Sensor Library on Github](https://github.com/adafruit/Adafruit_Sensor "Link: https://github.com/adafruit/Adafruit\_Sensor")
- [LSM303DLHC Library on Github](https://github.com/adafruit/Adafruit_LSM303DLHC "Link: https://github.com/adafruit/Adafruit\_LSM303DLHC")
- [L3GD20 Library on Github](https://github.com/adafruit/Adafruit_L3GD20_U)
- [BMP180 Library on Github](https://github.com/adafruit/Adafruit_BMP085_Unified)
- [Adafruit 10DOF Library on Github](https://github.com/adafruit/Adafruit_10DOF)

For information on the Adafruit Sensor Library and the Unified Sensor Drivers used for all of these sensors, feel free to have a look at our related learning guide: [Using the Adafruit Unified Sensor Driver](http://learn.adafruit.com/using-the-adafruit-unified-sensor-driver "Link: http://learn.adafruit.com/using-the-adafruit-unified-sensor-driver")

# Downloading Libraries

To use these libraries, you should download them from the Arduino Library Manager.

Open up the Arduino Library Manager:

![](https://cdn-learn.adafruit.com/assets/assets/000/085/879/medium800/sensors_1library_manager_menu.png?1576522048)

Search for the&nbsp; **Adafruit Unified Sensor&nbsp;** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/085/880/medium800/sensors_unified.png?1576522167)

Search for the&nbsp; **Adafruit L3GD20&nbsp;** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/085/881/medium800/sensors_l3gd20.png?1576522281)

Search for the&nbsp; **Adafruit BMP085 Unified** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/085/883/medium800/sensors_bmp085.png?1576522504)

Search for the&nbsp; **Adafruit 10DOF&nbsp;** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/087/046/medium800/sensors_10dof.png?1579276553)

[If you're new to installing libraries, check out our super-awesome detailed tutorial on how to install Arduino libraries](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use "Link: http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use")

# Adafruit\_10DOF Library Helper Functions
The **Adafruit\_10DOF.cpp** file (from [Adafruit\_10DOF](https://github.com/adafruit/Adafruit_10DOF)) includes the following helper functions that are useful when working with typicaly 10DOF projects ## bool accelGetOrientation ( sensors\_event\_t \*event, sensors\_vec\_t \*orientation )
This function reads the LSM303DLHC accelerometer data (supplied via the 'event' variable), and converts it into equivalent pitch (x) and roll (y) values, populating the supplied 'orientation' variables .pitch and .roll fields accordingly.  
  
**Arguments**  

**- event: The sensors\_event\_t variable containing the data from the accelerometer
- orientation: The sensors\_vec\_t object that will have its .pitch and .roll fields populated**

**Returns**  

- **true** if the operation was successful, 
- **false** if there was an error

**Example** Danger: 

```auto
sensors_event_t accel_event;
sensors_vec_t   orientation;

/* Calculate pitch and roll from the raw accelerometer data */
accel.getEvent(&amp;accel_event);
if (dof.accelGetOrientation(&amp;accel_event, &amp;orientation))
{
  /* 'orientation' should have valid .roll and .pitch fields */
  Serial.print(F("Roll: "));
  Serial.print(orientation.roll);
  Serial.print(F("; "));
  Serial.print(F("Pitch: "));
  Serial.print(orientation.pitch);
  Serial.print(F("; "));
}
```

## bool magGetOrientation ( sensors\_axis\_t axis, sensors\_event\_t \*event, sensors\_vec\_t \*mag\_orientation )
This function populates the .heading field in mag\_orientation with the correct angular data (0-359°). Heading increases when rotating clockwise around the specified axis.  

  
**Arguments**

- **axis:** The given axis (SENSOR\_AXIS\_X, SENSOR\_AXIS\_Y, or SENSOR\_AXIS\_Z)
- **event:** The raw magnetometer sensor data to use when calculating out heading
- **orientation:** The sensors\_vec\_t object where we will assign an 'orientation.heading' value

**Returns**

- **true** if the operation was successful,
- **false** if there was an error

**Example**  
Danger: 

```auto
sensors_event_t mag_event;
sensors_vec_t   orientation;
  
/* Calculate the heading using the magnetometer */
mag.getEvent(&amp;mag_event);
if (dof.magGetOrientation(SENSOR_AXIS_Z, &amp;mag_event, &amp;orientation))
{
  /* 'orientation' should have valid .heading data now */
  Serial.print(F("Heading: "));
  Serial.print(orientation.heading);
  Serial.print(F("; "));
}
```

## bool magTiltCompensation ( sensors\_axis\_t axis, sensors\_event\_t \*mag\_event, sensors\_event\_t \*accel\_event )
This function uses the accelerometer data provided in accel\_event to compensate the magnetic sensor measurements in mag\_event to compensate for situations where the sensor is tilted (the pitch and roll angles are not equal to 0°).  
  

**Arguments**

- **axis:** The given axis (SENSOR\_AXIS\_X, SENSOR\_AXIS\_Y, or SENSOR\_AXIS\_Z) that is parallel to the gravity of the Earth
- **mag\_event:** The raw magnetometer data to adjust for tilt
- **accel\_event:** The accelerometer event data to use to determine the tilt when compensating the mag\_event values

**Returns**

- **true** if the operation was successful,
- **false** if there was an error

**Example**  
```auto
sensors_event_t accel_event;
sensors_event_t mag_event;

...

// Get a sensor event from the accelerometer and magnetometer
accel.getEvent(&amp;accel_event);
mag.getEvent(&amp;mag_event);

if (dof.magTiltCompensation(SENSOR_AXIS_Z, &amp;mag_event, &amp;accel_event))
{
  // Do something with the compensated data in mag_event!
}
else
{
  // Oops ... something went wrong (probably bad data)
}
```

# Example Sketch
If you run the **pitchrollheading** sketch in the examples folder, you can see a practical example using these helper functions above, which should result in output similar to the image below: ![](https://cdn-learn.adafruit.com/assets/assets/000/014/032/medium800/sensors_Screen_Shot_2014-02-07_at_20.52.47.png?1391802986)

# Adafruit 10-DOF IMU Breakout

## Design Files

# Datasheets

- [LSM303 Datasheet](http://www.adafruit.com/datasheets/LSM303DLHC.PDF "Link: http://www.adafruit.com/datasheets/LSM303DLHC.PDF")
- [L3GD20 Datasheet](http://www.adafruit.com/datasheets/L3GD20.pdf "Link: http://www.adafruit.com/datasheets/L3GD20.pdf")
- [BMP180 Datasheet](http://www.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-9-DOF-and-10-DOF-PCBs)
- [Fritzing object in Adafruit Fritzing library](https://github.com/adafruit/Fritzing-Library/)

# Dimensions (Inches)
![](https://cdn-learn.adafruit.com/assets/assets/000/012/587/medium800/sensors_10dofdims.gif?1448052724)

# Schematic
![](https://cdn-learn.adafruit.com/assets/assets/000/012/538/medium800/sensors_10DOF.png?1385649061)

# Adafruit 10-DOF IMU Breakout

## F.A.Q.


## Featured Products

### Adafruit 10-DOF IMU Breakout - L3GD20H + LSM303 + BMP180

[Adafruit 10-DOF IMU Breakout - L3GD20H + LSM303 + BMP180](https://www.adafruit.com/product/1604)
This inertial-measurement-unit combines 3 of the best quality sensors available on the market to give you 11 axes of data: 3 axes of accelerometer data, 3 axes gyroscopic, 3 axes magnetic (compass), barometric pressure/altitude and temperature. We tested many different 'combination'...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1604)
[Related Guides to the Product](https://learn.adafruit.com/products/1604/guides)
### BMP180 Barometric Pressure/Temperature/Altitude Sensor- 5V ready

[BMP180 Barometric Pressure/Temperature/Altitude Sensor- 5V ready](https://www.adafruit.com/product/1603)
This precision sensor from Bosch is the best low-cost sensing solution for measuring barometric pressure and temperature. Because pressure changes with altitude you can also use it as an altimeter! The sensor is soldered onto a PCB with a 3.3V regulator, I2C level shifter and pull-up resistors...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1603)
[Related Guides to the Product](https://learn.adafruit.com/products/1603/guides)
### Triple-axis Accelerometer+Magnetometer (Compass) Board - LSM303

[Triple-axis Accelerometer+Magnetometer (Compass) Board - LSM303](https://www.adafruit.com/product/1120)
Discontinued - **you can grab** [Adafruit LSM303AGR Accelerometer Magnetometer - STEMMA QT Qwiic](https://www.adafruit.com/product/4413) instead!

&nbsp;

He told you "Go West, young maker!" - but you don't know which way is West! Ah, if only you had this...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1120)
[Related Guides to the Product](https://learn.adafruit.com/products/1120/guides)
### L3GD20H Triple-Axis Gyro Breakout Board - L3GD20/L3G4200 Upgrade

[L3GD20H Triple-Axis Gyro Breakout Board - L3GD20/L3G4200 Upgrade](https://www.adafruit.com/product/1032)
A gyroscope is a type of sensor that can sense twisting and turning motions. Often paired with an accelerometer, you can use these to do 3D motion capture and inertial measurement (that is - you can tell how an object is moving!) As these sensors become more popular and easier to manufacture,...

In Stock
[Buy Now](https://www.adafruit.com/product/1032)
[Related Guides to the Product](https://learn.adafruit.com/products/1032/guides)
### Adafruit 9-DOF IMU Breakout - L3GD20H + LSM303

[Adafruit 9-DOF IMU Breakout - L3GD20H + LSM303](https://www.adafruit.com/product/1714)
This inertial-measurement-unit combines 2 of the best quality sensors available on the market to give you 9 axes of data: 3 axes of accelerometer data, 3 axes gyroscopic, and 3 axes magnetic (compass). We tested many different 'combination' sensors and found these were the best value,...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1714)
[Related Guides to the Product](https://learn.adafruit.com/products/1714/guides)

## Related Guides

- [Adafruit 9-DOF IMU Breakout](https://learn.adafruit.com/adafruit-9-dof-imu-breakout.md)
- [I2C Addresses and Troublesome Chips](https://learn.adafruit.com/i2c-addresses.md)
- [Comparing Gyroscope Datasheets](https://learn.adafruit.com/comparing-gyroscope-datasheets.md)
- [Adafruit Triple Axis Gyro Breakout](https://learn.adafruit.com/adafruit-triple-axis-gyro-breakout.md)
- [Adafruit ESP32-S3 Feather](https://learn.adafruit.com/adafruit-esp32-s3-feather.md)
- [Adafruit Metro ESP32-S3](https://learn.adafruit.com/adafruit-metro-esp32-s3.md)
- [Professor Bubbleton’s Breathing Head in a Jar](https://learn.adafruit.com/professor-bubbleton-s-breathing-head-in-a-jar.md)
- [Digital Nose Milk Freshness Checker](https://learn.adafruit.com/digital-nose-gas-sensor-milk-freshness-checker.md)
- [Adafruit STEMMA Audio Amp](https://learn.adafruit.com/stemma-audio-amp.md)
- [Current Limiting Stepper Driver with DRV8871](https://learn.adafruit.com/current-limiting-stepper-driver-with-drv8871.md)
- [Adafruit STEMMA Non-Latching Mini Relay](https://learn.adafruit.com/adafruit-stemma-non-latching-mini-relay.md)
- [Adafruit WebIDE](https://learn.adafruit.com/webide.md)
- [Adafruit MPR121 12-Key Capacitive Touch Sensor Gator Breakout](https://learn.adafruit.com/adafruit-mpr121-gator.md)
- [MPU6050 6-DoF Accelerometer and Gyro](https://learn.adafruit.com/mpu6050-6-dof-accelerometer-and-gyro.md)
- [Introducing the Adafruit Bluefruit LE Friend](https://learn.adafruit.com/introducing-adafruit-ble-bluetooth-low-energy-friend.md)
