# ST 9-DoF Combo Breakouts and Wings

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/092/111/medium800/adafruit_products_4565_top.jpg?1591898533)

Add high quality motion, direction and orientation sensing to your project with these all-in-one 9 Degree of Freedom (9-DoF)&nbsp; FeatherWings and breakouts with sensors from ST. This little breakout and FeatherWing contain two chips that sit side-by-side to provide 9 degrees of full-motion data.

![](https://cdn-learn.adafruit.com/assets/assets/000/092/105/medium800/adafruit_products_4517_top_angle_.jpg?1591898086)

The breakout and FeatherWings include an **LSM6DSOX** , **LSM6DS3TR-C** , **ISM330DHC** , **ISM330DHCX** , or **LSM6DS33**. These are 6-DoF IMUs with accelerometer + gyro. The 3-axis accelerometer, can tell you which direction is down towards the Earth (by measuring gravity) or how fast the board is accelerating in 3D space. The 3-axis gyroscope that can measure spin and twist. The three triple-axis sensors add up to 9 degrees of freedom.

The LSM6DS33 and LSM6DS3TR-C are lower cost IMU's. As of July 2022, the LSM6DS33 is end of life.

[This LSM6DSOX is a mid-range cost IMU has very low gyro zero rate and noise](https://learn.adafruit.com/adafruit-sensorlab-gyroscope-calibration/comparing-gyroscopes#lsm6dsox-5-7) compared to the LSM6DS33, so it's excellent for orientation fusion usage: you'll get less drift and faster responses.

The LSM6DSOX, LSM6DS33 and LSM6DS3TR-C all have flexible data rates and ranges. For the accelerometer: **±2/±4/±8/±16 g** at 1.6 Hz to 6.7KHz update rate. For the gyroscope: **±125/±250/±500/±1000/±2000 dps** at 12.5 Hz to 6.7 KHz. There's also some nice extras, such as built-in tap detection, activity detection, and pedometer/step counter. The LSM6DSOX also has a programmable finite state machine / machine learning core that can perform some basic gesture recognition.

The ISM330DHCX also has flexible data rates and ranges. For the accelerometer: **±2/±4/±8/±16 g** &nbsp;at 1.6 Hz to 6.7KHz update rate. For the gyroscope:&nbsp; **±125/±250/±500/±1000/±2000/±4000 dps** at 12.5 Hz to 6.7 KHz. In particular, this is one of the few gyro's we stock with 4000 dps range, usually they top out at 2000. This sensor has extra calibration and compensation circuits to give it excellent performance in a wide environmental range from -40 to +105°C.

Also included is a **LIS3MDL** 3-axis magnetometer that can sense where the strongest magnetic force is coming from, generally used to detect magnetic north. The three triple-axis sensors add up to 9 degrees of freedom, by combining this data you can orient the board.

For the FeatherWings, both sensors are connected over the shared I2C bus, so you can use it with any and all Feathers! We also break out the interrupt pins and address-selection jumpers in case you want multiple Feathers or have I2C address conflicts. We've got both Arduino (C/C++) and CircuitPython libraries available so you can use it with any Feather board and get data readings in under 5 minutes. Four mounting holes make for a secure connection.

![adafruit_products_4565_top_angle.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/110/medium640/adafruit_products_4565_top_angle.jpg?1592418233)

![adafruit_products_4569_top_angle_crop.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/504/medium640/adafruit_products_4569_top_angle_crop.jpg?1593016353)

To make getting started fast and easy for non-Feather use, we placed the sensors on a compact breakout board with voltage regulation and level-shifted inputs. That way you can use them with 3V or 5V power/logic devices without worry. To make usage simple, we expose only the I2C interface and some interrupt pins from each chip. The breakout comes fully assembled and tested, with some extra header so you can use it on a breadboard. Four mounting holes make for a secure connection.

![adafruit_products_4485_top_angle.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/106/medium640/adafruit_products_4485_top_angle.jpg?1592418327)

![adafruit_products_5543-05.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/552/medium640/adafruit_products_5543-05.jpg?1658865337)

For the breakouts, since the sensors are wired together over I2C, you can easily connect it up with two wires (plus power and ground!).&nbsp; We've even included [SparkFun qwiic](https://www.sparkfun.com/qwiic) compatible**&nbsp;[STEMMA QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt)**&nbsp;connectors for the I2C bus so **you don't even need to solder!** [Just wire up to your favorite micro like the STM32F405 Feather](https://www.adafruit.com/product/4382) with a plug-and-play cable to get 9 DoF data ASAP. You can change the I2C addresses on the back using the solder jumpers to have two of these sensor boards on one bus.

![adafruit_products_4485_STEMMA_Side.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/108/medium640/adafruit_products_4485_STEMMA_Side.jpg?1592418386)

# ST 9-DoF Combo Breakouts and Wings

## LSM6DSOX or ISM330DHCX + LIS3MDL Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/091/916/medium800/adafruit_products_4517_pinouts.jpg?1591820774)

## Breakout Power Pins

- **Vin** - this is the power pin. Since the sensor chip uses 3 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V microcontroller like Arduino, use 5V
- **3Vo** - this is the 3.3V output from the voltage regulator, you can grab up to 100mA from this if you like
- **GND** - common ground for power and logic

![](https://cdn-learn.adafruit.com/assets/assets/000/091/917/medium800/adafruit_products_4565_pinouts.jpg?1591820792)

![](https://cdn-learn.adafruit.com/assets/assets/000/092/505/medium800/adafruit_products_4569_pinouts.jpg?1593016998)

## FeatherWing Power Pins

- **3.3V** - this is the 3.3V input to the FeatherWing, we use the Feather's power regulator to generate the clean 3v power needed.
- **GND** - common ground for power and logic

Warning: 

## I2C Logic Pins

- **SCL** - I2C clock pin, connect to your microcontroller's I2C clock line. On the breakouts, this pin is level shifted so you can use 3-5V logic. On the FeatherWing, there is no level shifter. There's a **10K pullup** on this pin.
- **SDA** - I2C data pin, connect to your microcontroller's I2C data line. 
- On the breakouts, this pin is level shifted so you can use 3-5V logic. On the FeatherWing, there is no level shifter. There's a **10K pullup** on this pin.
- **[STEMMA QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt)&nbsp;-** These connectors allow you to make I2C connections to dev boards with **STEMMA QT** connectors or to other things with&nbsp;[various associated accessories](https://www.adafruit.com/?q=JST%20SH%204). 

## I2C Address Pins

- **ADM / Mag Addr** - LIS3MDL Magnetometer I2C address pin. Pulling this pin high or bridging the solder jumper on the back will change the I2C address from **0x1C** to&nbsp; **0x1E.**
- **ADAG / A/G Addr** - LSM6DSOX or ISM330DHCX Accel/Gyro I2C address pin. Pulling this pin high or bridging the solder jumper on the back will change the I2C address from **0x6A** to&nbsp; **0x6B.**

## Other Pins

- **INT1** -This is the primary interrupt pin for the Accel/Gyro. You can setup the LSM6DSOX or ISM330DHCX to pull this low when certain conditions are met such as new measurement data being available. Consult the [datasheet](https://learn.adafruit.com/lsm6dsox-and-ism330dhc-6-dof-imus-with-extra-sauce/downloads) for usage.
- **INT2** -This is the secondary interrupt pin for the Accel/Gyro. You can setup the LSM6DSOX or ISM330DHCX to pull this low when certain conditions are met such as new measurement data being available. Consult the [datasheet](https://learn.adafruit.com/lsm6dsox-and-ism330dhc-6-dof-imus-with-extra-sauce/downloads) for usage.
- **INTM** - This is the primary interrupt pin for the Magnetometer. You can setup the LIS3MDL to pull this low when certain conditions are met such as a value exceeding a threshold. Consult the [datasheet](https://www.st.com/resource/en/datasheet/lis3mdl.pdf) for usage.
- **DRDY -** The data ready pin. When measurement data is available the sensor will pull this pin low.

## FeatherWing Pins

- **SPI Logic pins.** Located toward the center of the FeatherWing, these are the same for both the LIS3MDL and LSM6DSOX or ISM330DHCX. All pins going into the breakout have level shifting circuitry to make them 3-5V logic level safe. Use whatever logic level is on **Vin!**
  - **SCL** - This is _also_&nbsp;the **S** PI **C** loc **k** pin, it's an input to the chip.
  - **SDA** &nbsp;- this is _also&nbsp;_the **S** ensor **D** ata **I** n / **M** icrocontroller **O** ut **S** ensor **I** n pin, for data sent from your processor to the LIS3MDL or LSM6DSOX.
  - **SDO** - this is the **S** ensor **D** ata **O** ut / **M** icrocontroller **I** n **S** ensor **O** ut pin, for data sent from the LIS3MDL, ISM330DHCX, or LSM6DSOX to your processor.&nbsp;
  - **CS** - this is the **C** hip **S** elect pin, drop it low to start an SPI transaction. It's an input to the chip.

- **External I2C/SPI pins** - Control a separate sensor on a separate I2C/SPI bus.
  - **SCL** - I2C clock pin OR&nbsp;the **S** PI **C** lock pin.
  - **SDA** &nbsp;-&nbsp;I2C data pin OR the **S** ensor **D** ata **I** n / **M** icrocontroller **O** ut **S** ensor **I** n pin, for data sent from your processor to the LIS3MDL, ISM330DHCX, or LSM6DSOX.
  - **SDO** - this is the **S** ensor **D** ata **O** ut / **M** icrocontroller **I** n **S** ensor **O** ut pin, for data sent from the LIS3MDL, ISM330DHCX, or LSM6DSOX to your processor.&nbsp;
  - **CS** - this is the **C** hip **S** elect pin, drop it low to start an SPI transaction. Its an input to the chip.

# ST 9-DoF Combo Breakouts and Wings

## LSM6DS33 + LIS3MDL Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/092/104/medium800/adafruit_products_4485_pinouts.jpg?1591898051)

## Power Pins

- **Vin** - this is the power pin. Since the sensor chip uses 3 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V microcontroller like Arduino, use 5V.
- **3Vo** - this is the 3.3V output from the voltage regulator, you can grab up to 100mA from this if you like.
- **GND** - common ground for power and logic.

## I2C Logic Pins

- **SCL** - I2C clock pin, connect to your microcontroller's I2C clock line. This pin is level shifted so you can use 3-5V logic, and there's a **10K pullup** on this pin.
- **SDA** - I2C data pin, connect to your microcontroller's I2C data line. This pin is level shifted so you can use 3-5V logic, and there's a **10K pullup** on this pin.
- **[STEMMA QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt)&nbsp;-** These connectors allow you to make I2C connections to dev boards with **STEMMA QT** connectors or to other things with&nbsp;[various associated accessories](https://www.adafruit.com/?q=JST%20SH%204).

## I2C Address Pins

- **ADM** - LIS3MDL Magnetometer I2C address pin. Pulling this pin high or bridging the solder jumper on the back will change the I2C address from **0x1C** to&nbsp; **0x1E.**
- **AGAD** - LSM6DS33 Accel/Gyro I2C address pin. Pulling this pin high or bridging the solder jumper on the back will change the I2C address from&nbsp; **0x6A** &nbsp;to&nbsp; **0x6B.**

## Other Pins

- **INT1** -This is the primary interrupt pin for the Accel/Gyro. You can setup the LSM6DS33 to pull this low when certain conditions are met such as new measurement data being available. Consult the [datasheet](https://learn.adafruit.com/lsm6dsox-and-ism330dhc-6-dof-imus-with-extra-sauce/downloads) for usage.
- **INTM** - This is the primary interrupt pin for the Magnetometer. You can setup the LIS3MDL to pull this low when certain conditions are met such as a value exceeding a threshold. Consult the [datasheet](https://www.st.com/resource/en/datasheet/lis3mdl.pdf) for usage.
- **DRDY -** The data ready pin. When measurement data is available the sensor will pull this pin low.

# ST 9-DoF Combo Breakouts and Wings

## LSM6DS3TR-C + LIS3MDL Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/113/407/medium800/adafruit_products_double.jpg?1658761035)

The default I2C address for the LSM6DS3 accelerometer is&nbsp; **0x6A**.

The default I2C address for the LIS3MDL magnetometer is **0x1C**.

## Power Pins

- **VIN** &nbsp;- this is the power pin. Since the sensor chip uses 3 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V microcontroller like Arduino, use 5V
- **3Vo** &nbsp;- this is the 3.3V output from the voltage regulator, you can grab up to 100mA from this if you like
- **GND** &nbsp;- common ground for power and logic

## I2C Logic Pins

- **SCL&nbsp;** - I2C clock pin, connect to your microcontroller I2C clock line. This pin is level shifted so you can use 3-5V logic, and there's a&nbsp; **10K pullup** &nbsp;on this pin.
- **SDA&nbsp;** -I2C data pin, connect to your microcontroller I2C data line. This pin is level shifted so you can use 3-5V logic, and there's a&nbsp; **10K pullup** &nbsp;on this pin.
- **[STEMMA QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt)&nbsp;-&nbsp;**These connectors allow you to connectors to dev boards with&nbsp; **STEMMA QT** &nbsp;connectors or to other things with&nbsp;[various associated accessories](https://www.adafruit.com/?q=JST%20SH%204).

## Address Jumpers

On the back of the board are **two**  **address jumpers** , labeled&nbsp; **ADM** and **AGAD**** , **&nbsp;to the right of the&nbsp;** I2C Addr **&nbsp;label on the board silk.** ADM **controls the magnetometer's I2C address and** AGAD**&nbsp;controls the accelerometer's I2C address. These jumpers allow you to chain up to 2 of these boards on the same pair of I2C clock and data pins. To do so, you solder the jumper "closed" by connecting the two pads.

The default I2C address for the accelerometer is **0x6A**. The other address options can be calculated by “adding” the&nbsp; **AGAD&nbsp;** to the base of&nbsp; **0x6A**.

**AGAD** &nbsp;sets the lowest bit with a value of&nbsp; **1**. **&nbsp;** The final address is&nbsp; **0x6A + AGAD** &nbsp;which would be&nbsp; **0x6B**.

 If&nbsp; **AGAD** &nbsp;is soldered closed, the address is&nbsp; **0x6A + 1 = 0x6B**

The table below shows all possible addresses for the accelerometer, and whether the pin should be high (closed) or low (open).

![](https://cdn-learn.adafruit.com/assets/assets/000/113/410/medium800/adafruit_products_accelI2C.jpg?1658761651)

The default I2C address for the magnetometer is **0x1C**. The other address options can be calculated by “adding” the&nbsp; **ADM&nbsp;** to the base of&nbsp; **0x1C**.

**ADM** &nbsp;sets the lowest bit with a value of **2**. **&nbsp;** The final address is&nbsp; **0x1C + ADM** &nbsp;which would be&nbsp; **0x1E**.

 If&nbsp; **ADM** &nbsp;is soldered closed, the address is&nbsp; **0x1C + 2 = 0x1E**

The table below shows all possible addresses for the magnetometer, and whether the pin should be high (closed) or low (open).

![](https://cdn-learn.adafruit.com/assets/assets/000/113/411/medium800/adafruit_products_magI2C.jpg?1658761660)

## I2C Address Pins

- **ADM** &nbsp;- LIS3MDL Magnetometer I2C address pin. Pulling this pin high will change the I2C address from&nbsp; **0x1C** &nbsp;to&nbsp; **0x1E.**
- **AGAD** &nbsp;- LSM6DS3TR-C Accel/Gyro I2C address pin. Pulling this pin high will change the I2C address from **0x6A** &nbsp;to&nbsp; **0x6B.**

## Other Pins

- **INT1&nbsp;** -This is the primary interrupt pin. You can setup the&nbsp;LSM6DS3TR-C&nbsp;to pull this low when certain conditions are met such as new measurement data being available. Consult the&nbsp;[datasheet](https://cdn-shop.adafruit.com/product-files/4503/4503_LSM6DS3TR-C_datasheet.pdf)&nbsp;for usage.
- **INT2&nbsp;** -This is the primary interrupt pin. You can setup the&nbsp;LSM6DS3TR-C&nbsp;to pull this low when certain conditions are met such as new measurement data being available. Consult the&nbsp;[datasheet](https://cdn-shop.adafruit.com/product-files/4503/4503_LSM6DS3TR-C_datasheet.pdf)&nbsp;for usage.
- **INTM&nbsp;** - This is the primary interrupt pin for the Magnetometer. You can setup the LIS3MDL to pull this low when certain conditions are met such as a value exceeding a threshold. Consult the&nbsp;[datasheet](https://www.st.com/resource/en/datasheet/lis3mdl.pdf)&nbsp;for usage.
- **DRDY -** &nbsp;The data ready pin. When measurement data is available the sensor will pull this pin low.

## Power LED

- **Power LED -&nbsp;** In the upper left corner, above the STEMMA connector, on the front of the board, is the power LED, labeled **&nbsp;on**. It is the green LED.

# ST 9-DoF Combo Breakouts and Wings

## Assembly

When putting together your Featherwings, think about how you want it to connect, you can use stacking headers:

![](https://cdn-learn.adafruit.com/assets/assets/000/031/372/medium800/feather_adafruit_products_2830-00.jpg?1458532137)

Or plain female socket headers:

![](https://cdn-learn.adafruit.com/assets/assets/000/031/373/medium800/feather_adafruit_products_2886-00.jpg?1458532154)

The most common method of attachment for the featherwing is putting stacking or female headers on the _Feather mainboard_ and then putting the Wing on top:

![](https://cdn-learn.adafruit.com/assets/assets/000/031/371/medium800/feather_wing.jpg?1458532108)

But don't forget, you can **also put the stacking headers on the wing and stack the Feather on top of it!**

# ST 9-DoF Combo Breakouts and Wings

## Arduino

## Wiring

The following shows connecting to an Arduino using I2C.

- Connect&nbsp;**board VIN (red wire)** to&nbsp; **Arduino**  **5V** &nbsp;if you are running a **5V** board Arduino (Uno, etc.).&nbsp;If your board is **3V,** connect to that instead.
- Connect **board** **GND (black wire)&nbsp;**to&nbsp; **Arduino**  **GND**
- Connect **board** **SCL (yellow wire)&nbsp;**to&nbsp; **Arduino**  **SCL**
- Connect **board** **SDA (blue wire)&nbsp;**to&nbsp; **Arduino**  **SDA**

![adafruit_products_LIS_S33_breakout_Arduino_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/113/medium640/adafruit_products_LIS_S33_breakout_Arduino_breadboard_bb.jpg?1591991563)

![adafruit_products_LIS_SOX_breakout_Arduino_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/114/medium640/adafruit_products_LIS_SOX_breakout_Arduino_breadboard_bb.jpg?1591991598)

![adafruit_products_metroBB_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/547/medium640/adafruit_products_metroBB_bb.jpg?1658864320)

![adafruit_products_LIS_S33_breakout_Arduino_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/548/medium640/adafruit_products_LIS_S33_breakout_Arduino_STEMMA_bb.jpg?1658864414)

![adafruit_products_metroStemma_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/113/549/medium640/adafruit_products_metroStemma_bb.png?1658864534)

![adafruit_products_metroStemma_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/551/medium640/adafruit_products_metroStemma_bb.jpg?1658864610)

The final results should resemble the illustration above, showing an Adafruit Metro development board.

For the FeatherWing:

- **Plug the FeatherWing into a Feather**. This image is the Wing plugged into a Feather M4.

![adafruit_products_LIS_SOX_FeatherWing_Feather_M4_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/120/medium640/adafruit_products_LIS_SOX_FeatherWing_Feather_M4_bb.jpg?1591991958)

Warning: 

# Library Installation

You can install the **Adafruit LIS3MDL Library** and the **Adafruit LSM6DS Library** for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/092/234/medium800/adafruit_products_Arduino_Manage_Libraries.png?1592412010)

Click the&nbsp; **Manage Libraries ...** menu item, search for **Adafruit LIS3MDL** ,&nbsp;and select the&nbsp; **Adafruit LIS3MDL** &nbsp;library:

![](https://cdn-learn.adafruit.com/assets/assets/000/092/235/medium800/adafruit_products_LIS3MDL_arduino_install.png?1592412074)

Follow the same process for the **Adafruit LSM6DS** library.

![](https://cdn-learn.adafruit.com/assets/assets/000/092/236/medium800/adafruit_products_LSM6DS_arduino_install.png?1592412399)

Then follow the same process for the&nbsp; **Adafruit BusIO** &nbsp;library.

![](https://cdn-learn.adafruit.com/assets/assets/000/092/237/medium800/adafruit_products_Arduino_BusIO_Lib_Install.png?1592412435)

Finally follow the same process for the&nbsp; **Adafruit Unified Sensor** library:

![](https://cdn-learn.adafruit.com/assets/assets/000/092/238/medium800/adafruit_products_unified_sensor_arduino_install.png?1592412614)

# Load Example

Download the example below. Open up **File -\> Open** and navigate to the downloaded **lis3mdl\_lsm6ds\_test** and upload to your Arduino wired up to the sensor.

The example is written to work with the LIS3MDL + LSM6DSOX. To use with the LIS3MDL + LSM6DS33, uncomment the following lines.

```cpp
//#include &lt;Adafruit_LSM6DS33.h&gt;
//Adafruit_LSM6DS33 lsm6ds;
```

To use with the LSM6DS3TR-C + LIS3MDL, uncomment the following lines.

```cpp
//#include &lt;Adafruit_LSM6DS3TRC.h&gt;
//Adafruit_LSM6DS3TRC lsm6ds;
```

To use with the LIS3MDL + ISM330DHCX, uncomment the following lines.

```cpp
//#include &lt;Adafruit_ISM330DHCX.h&gt;
//Adafruit_ISM330DHCX lsm6ds;
```

Once you upload the code and open the Serial Monitor ( **Tools-\>Serial Monitor** ) at **115200** baud, you will see the current configuration printed, followed by the accelerometer, gyro, and temperature measurements. You should see something similar to this:

![](https://cdn-learn.adafruit.com/assets/assets/000/092/239/medium800/adafruit_products_ST_combo_c_arduino_example_screenshot.png?1592413907)

# Example Code
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/ST_Combo_Boards/lis3mdl_lsm6ds_test/lis3mdl_lsm6ds_test.ino

# ST 9-DoF Combo Breakouts and Wings

## LIS3MDL Arduino Docs

# ST 9-DoF Combo Breakouts and Wings

## LSM6DS Arduino Docs

# ST 9-DoF Combo Breakouts and Wings

## Python & CircuitPython

It's easy to use the LIS3MDL + LSM6DSOX, LSM6DS33 and LSM6DS3TR-C sensor combos with Python and CircuitPython, and the [Adafruit CircuitPython LIS3MDL](https://github.com/adafruit/Adafruit_CircuitPython_LIS3MDL) and [Adafruit CircuitPython LSM6DS](https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS) libraries. These libraries allow you to easily write Python code that read measurements from the accelerometer, gyro, and magnetometer.

You can use this sensor with any CircuitPython microcontroller board or with a computer that has GPIO and Python [thanks to Adafruit\_Blinka, our CircuitPython-for-Python compatibility library](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

## CircuitPython Microcontroller Wiring

First, wire up the board to a microcontroller using I2C. The following shows wiring each board to a Feather M4 Express.

### Breakout Board
- **Board 3V** &nbsp;to&nbsp;**sensor VIN (red wire)**
- **Board GND** &nbsp;to&nbsp;**sensor GND (black wire)**
- **Board SCL** &nbsp;to&nbsp;**sensor SCL (yellow wire)**
- **Board SDA** &nbsp;to&nbsp;**sensor SDA (blue wire)**

![adafruit_products_LIS_SOX_breakout_Feather_M4_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/122/medium640/adafruit_products_LIS_SOX_breakout_Feather_M4_breadboard_bb.jpg?1591998040)

![adafruit_products_LIS_S33_breakout_Feather_M4_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/123/medium640/adafruit_products_LIS_S33_breakout_Feather_M4_breadboard_bb.jpg?1591998069)

![adafruit_products_featherBB_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/537/medium640/adafruit_products_featherBB_bb.jpg?1658863520)

![adafruit_products_LIS_SOX_breakout_Feather_M4_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/538/medium640/adafruit_products_LIS_SOX_breakout_Feather_M4_STEMMA_bb.jpg?1658863557)

![adafruit_products_LIS_S33_breakout_Feather_M4_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/539/medium640/adafruit_products_LIS_S33_breakout_Feather_M4_STEMMA_bb.jpg?1658863571)

![adafruit_products_featherStemma_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/540/medium640/adafruit_products_featherStemma_bb.jpg?1658863592)

### FeatherWing
- Plug the FeatherWing into the Feather.

![adafruit_products_LIS_SOX_FeatherWing_Feather_M4_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/127/medium640/adafruit_products_LIS_SOX_FeatherWing_Feather_M4_bb.jpg?1591998260)

## Python Computer Wiring

Since there's&nbsp;_dozens_&nbsp;of Linux computers/boards you can use we will show wiring for Raspberry Pi. For other platforms,&nbsp;[please visit the guide for CircuitPython on Linux to see whether your platform is supported](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).&nbsp;

Here's the Raspberry Pi wired with I2C:

- **Pi 3V** &nbsp;to&nbsp;**sensor VCC (red wire)**
- **Pi GND** &nbsp;to&nbsp;**sensor GND (black wire)**
- **Pi SCL** &nbsp;to&nbsp;**sensor SCL (yellow wire)**
- **Pi SDA** &nbsp;to&nbsp;**sensor SDA (blue wire)**

![adafruit_products_LIS_SOX_breakout_RasPi_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/130/medium640/adafruit_products_LIS_SOX_breakout_RasPi_breadboard_bb.jpg?1592007076)

![adafruit_products_LIS_S33_breakout_RasPi_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/092/131/medium640/adafruit_products_LIS_S33_breakout_RasPi_breadboard_bb.jpg?1592007092)

![adafruit_products_piBreadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/541/medium640/adafruit_products_piBreadboard_bb.jpg?1658863720)

![adafruit_products_LIS_S33_breakout_RasPi_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/542/medium640/adafruit_products_LIS_S33_breakout_RasPi_STEMMA_bb.jpg?1658863749)

![adafruit_products_LIS_SOX_breakout_RasPi_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/543/medium640/adafruit_products_LIS_SOX_breakout_RasPi_STEMMA_bb.jpg?1658863765)

![adafruit_products_piStemma_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/113/544/medium640/adafruit_products_piStemma_bb.jpg?1658863785)

## Python Installation of LIS3MDL and LSM6DS Libraries

You'll need to install the&nbsp; **Adafruit\_Blinka** &nbsp;library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3.&nbsp;[Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux)!

Once that's done, from your command line run the following commands:

- `pip3 install adafruit-circuitpython-lsm6ds`
- `pip3 install adafruit-circuitpython-lis3mdl`

If your default Python is version 3, you may need to run&nbsp;`pip`&nbsp;instead. Make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

## CircuitPython Installation of LIS3MDL and LSM6DS Libraries

You'll need to install the&nbsp;[Adafruit CircuitPython LIS3MDL](https://github.com/adafruit/Adafruit_CircuitPython_LIS3MDL) and the [Adafruit CircuitPython LSM6DS](https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS) libraries on your CircuitPython board. **The LSM6DS library works with the LSM6DSOX, LSM6DS33 and LSM6DS3TR-C.**

First make sure you are running the&nbsp;[latest version of Adafruit CircuitPython](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython)&nbsp;for your board.

Next you'll need to install the necessary libraries&nbsp;to use the hardware--carefully follow the steps to find and install these libraries from&nbsp;[Adafruit's CircuitPython library bundle](https://circuitpython.org/libraries).&nbsp; Our CircuitPython starter guide has [a great page on how to install the library bundle](https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries).

Copy the following folders and file from the bundle to the **lib** folder on your **CIRCUITPY** drive:

- **adafruit\_lismdl.mpy**
- **adafruit\_lsm6ds/**
- **adafruit\_bus\_device/**
- **adafruit\_register/**

Before continuing make sure your board's **lib** folder or root filesystem has the **adafruit\_lis3mdl****.mpy, **** adafruit\_lsm6ds ****/,**  **adafruit\_bus\_device/** , and&nbsp; **adafruit\_register/** file and folders **&nbsp;** copied over.

Next&nbsp;[connect to the board's serial REPL&nbsp;](https://learn.adafruit.com/welcome-to-circuitpython/the-repl)so you are at the CircuitPython&nbsp;`>>>`&nbsp;prompt.

## CircuitPython & Python Usage

To demonstrate the usage of the sensor we'll initialize it and read the acceleration, rotation and magnetic measurements from the board's Python REPL.

Run the following code to import the necessary modules and initialize the I2C connection with the sensor:

```python
import time
import board
from adafruit_lsm6ds.lsm6dsox import LSM6DSOX as LSM6DS

# To use LSM6DS33, comment out the LSM6DSOX import line
# and uncomment the next line
# from adafruit_lsm6ds.lsm6ds33 import LSM6DS33 as LSM6DS

# To use ISM330DHCX, comment out the LSM6DSOX import line
# and uncomment the next line
# from adafruit_lsm6ds.lsm330dhcx import ISM330DHCX as LSM6DS

# To use LSM6DS3TR-C, comment out the LSM6DSOX import line
# and uncomment the next line
# from adafruit_lsm6ds.lsm6ds3 import LSM6DS3 as LSM6DS

from adafruit_lis3mdl import LIS3MDL

i2c = board.I2C()  # uses board.SCL and board.SDA
accel_gyro = LSM6DS(i2c)
mag = LIS3MDL(i2c)
```

Now you're ready to read values from the sensor using these properties:

- **acceleration -** The acceleration forces in the X, Y, and Z axes in m/s<sup>2</sup>
- **gyro** - The rotation measurement on the X, Y, and Z axes in degrees/sec
- **magnetic** - The magnetic forces on the X, Y, and Z axes in micro-Teslas (uT)

For example, to print out the acceleration, gyro and magnetic measurements use this code:

```python
acceleration = accel_gyro.acceleration
    gyro = accel_gyro.gyro
    magnetic = mag.magnetic
    print("Acceleration: X:{0:7.2f}, Y:{1:7.2f}, Z:{2:7.2f} m/s^2".format(*acceleration))
    print("Gyro          X:{0:7.2f}, Y:{1:7.2f}, Z:{2:7.2f} rad/s".format(*gyro))
    print("Magnetic      X:{0:7.2f}, Y:{1:7.2f}, Z:{2:7.2f} uT".format(*magnetic))
```

![](https://cdn-learn.adafruit.com/assets/assets/000/092/233/medium800/adafruit_products_ST_combo_repl_printing_screenshot.png?1592410888)

## Full Example Code
https://github.com/adafruit/Adafruit_CircuitPython_LIS3MDL/blob/main/examples/lis3mdl_lsm6ds3trc_test.py

# ST 9-DoF Combo Breakouts and Wings

## LIS3MDL Python docs

# ST 9-DoF Combo Breakouts and Wings

## LSM6DS Python Docs

# ST 9-DoF Combo Breakouts and Wings

## AHRS Fusion of 9 DoF Sensors

# ST 9-DoF Combo Breakouts and Wings

## Downloads

## Files

- [LIS3MDL datasheet](https://www.st.com/resource/en/datasheet/lis3mdl.pdf)
- [LSM6DSOX datasheet](https://www.st.com/resource/en/datasheet/lsm6dsox.pdf)
- [LSM6DS33 datasheet](https://www.st.com/resource/en/datasheet/lsm6dsox.pdf)
- [LSM6DS3TR-C Datasheet](https://cdn-shop.adafruit.com/product-files/4503/4503_LSM6DS3TR-C_datasheet.pdf)
- [ISM330DHCX datasheet](https://cdn-learn.adafruit.com/assets/assets/000/092/508/original/ism330dhcx.pdf?1593019579)
- [LSM6DS33 + LIS3MDL Fritzing object in the Adafruit Fritzing library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20LIS3MDL%20%2B%20LSM6DS33%20-%209%20DoF%20IMU%20with%20Accel%20%2B%20Gyro%20%2B%20Mag.fzpz)
- [LSM6DSOX + LIS3MDL FeatherWing Fritzing object in the Adafruit Fritzing library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20Precision%209-DoF%20LSM6DSOX%20%2B%20LIS3MDL%20FeatherWing.fzpz)
- [LSM6DSOX + LIS3MDL breakout Fritzing object in the Adafruit Fritzing library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20Precision%209-DoF%20LIS3MDL%20%2B%20LSM6DSOX.fzpz)
- [LSM6DS3TR-C + LIS3MDL breakout Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20LSM6DS3TR-C%20%2B%20LIS3MDL%20STEMMA.fzpz)
- [ISM330DHCX + LIS3MDL FeatherWing Fritzing object in the Adafruit Fritzing library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20Precision%209-DoF%20ISM330DHCX%20%2B%20LIS3MDL%20FeatherWing.fzpz)
- [LSM6DSOX + LIS3MDL EagleCAD files on GitHub](https://github.com/adafruit/Adafruit-LSM6DSOX-LIS3MDL-PCB)
- [LSM6DS33 + LIS3MDL EagleCAD files on GitHub](https://github.com/adafruit/Adafruit-LSM6DS33-LIS3MDL-PCB)
- [LSM6DS3TR-C + LIS3MDL EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-LSM6DS3TR-C-LIS3MDL-PCB)
- [ISM330DHCX + LIS3MDL EagleCAD files on GitHub](https://github.com/adafruit/Adafruit-ISM330DHCX-LIS3MDL-FeatherWing-PCB)
- [LSM6DSOX + LIS3MDL models on GitHub](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/4517%20LSM6DSOX-LIS3MDL)
- [FeatherWing LSM6DSOX + LIS3MDL models GitHub](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/4565%20FeatherWing%20LIS3MDL%20LSM6DSOX)

## LSM6DSOX + LIS3MDL breakout Fab Print and Schematic
![](https://cdn-learn.adafruit.com/assets/assets/000/091/910/medium800/adafruit_products_4517_fab_print.png?1591819539)

![](https://cdn-learn.adafruit.com/assets/assets/000/091/911/medium800/adafruit_products_4517_sch.png?1591819564)

## LSM6DSOX + LIS3MDL FeatherWing Fab Print and Schematic
![](https://cdn-learn.adafruit.com/assets/assets/000/091/912/medium800/adafruit_products_4565_fab_print.png?1591819586)

![](https://cdn-learn.adafruit.com/assets/assets/000/091/913/medium800/adafruit_products_4565_sch.png?1591819610)

## LSM6DS33 + LIS3MDL Fab Print and Schematic
![](https://cdn-learn.adafruit.com/assets/assets/000/091/914/medium800/adafruit_products_4485_fab_print.png?1591819622)

![](https://cdn-learn.adafruit.com/assets/assets/000/091/915/medium800/adafruit_products_4485_sch.png?1591819646)

## LSM6DS3TR-C + LIS3MDL Fab Print and Schematic
![](https://cdn-learn.adafruit.com/assets/assets/000/113/545/medium800/adafruit_products_fab.png?1658864233)

![](https://cdn-learn.adafruit.com/assets/assets/000/113/546/medium800/adafruit_products_schem.png?1658864246)

## ISM330DHCX + LIS3MDL Fab Print and Schematic
![](https://cdn-learn.adafruit.com/assets/assets/000/092/506/medium800/adafruit_products_4569_fab_print.png?1593019479)

![](https://cdn-learn.adafruit.com/assets/assets/000/092/507/medium800/adafruit_products_4569_sch.png?1593019503)


## Primary Products

### Adafruit LSM6DSOX + LIS3MDL - Precision 9 DoF IMU

[Adafruit LSM6DSOX + LIS3MDL - Precision 9 DoF IMU](https://www.adafruit.com/product/4517)
Add high-quality motion,&nbsp;direction, and orientation&nbsp;sensing to your Arduino project with this all-in-one 9 Degree of Freedom (9-DoF) sensor with sensors from ST. This little breakout contains two chips that sit side-by-side to provide 9 degrees of full-motion data.

The board...

In Stock
[Buy Now](https://www.adafruit.com/product/4517)
[Related Guides to the Product](https://learn.adafruit.com/products/4517/guides)

## Featured Products

### Adafruit LSM6DSOX + LIS3MDL FeatherWing - Precision 9-DoF IMU

[Adafruit LSM6DSOX + LIS3MDL FeatherWing - Precision 9-DoF IMU](https://www.adafruit.com/product/4565)
Upgrade any Feather board with precision motion sensing with the ST 9-DoF IMU, an all-in-one sensing 'Wing. [It sports two fantastic sensors from ST](https://www.st.com) to provide 9 degrees of full-motion data.

The board includes an **LSM6DSOX** , a 6-DoF IMU...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4565)
[Related Guides to the Product](https://learn.adafruit.com/products/4565/guides)
### Adafruit LSM6DS33 + LIS3MDL - 9 DoF IMU with Accel / Gyro / Mag

[Adafruit LSM6DS33 + LIS3MDL - 9 DoF IMU with Accel / Gyro / Mag](https://www.adafruit.com/product/4485)
_This item is discontinued - **you can grab** [Adafruit LSM6DS3 + LIS3MDL - Precision 9 DoF IMU](https://adafruit.com/products/5543) **instead!&nbsp;** _

Add motion,&nbsp;direction and orientation&nbsp;sensing to your Arduino project with this all-in-one 9 Degree...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/4485)
[Related Guides to the Product](https://learn.adafruit.com/products/4485/guides)
### Adafruit LSM6DS3TR-C + LIS3MDL - Precision 9 DoF IMU

[Adafruit LSM6DS3TR-C + LIS3MDL - Precision 9 DoF IMU](https://www.adafruit.com/product/5543)
Add high-quality motion,&nbsp;direction, and orientation&nbsp;sensing to your Arduino project with this all-in-one 9 Degree of Freedom (9-DoF) sensor with sensors from ST. This little breakout contains two chips that sit side-by-side to provide 9 degrees of full-motion data.

The board...

In Stock
[Buy Now](https://www.adafruit.com/product/5543)
[Related Guides to the Product](https://learn.adafruit.com/products/5543/guides)
### JST PH 2mm 4-Pin to Male Header Cable - I2C STEMMA Cable - 200mm

[JST PH 2mm 4-Pin to Male Header Cable - I2C STEMMA Cable - 200mm](https://www.adafruit.com/product/3955)
This cable will let you turn a JST PH 4-pin cable port into 4 individual wires with high-quality 0.1" male header plugs on the end. We're carrying these to match up with any of our boards with 'STEMMA' connectors on them such as the&nbsp;<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/3955)
[Related Guides to the Product](https://learn.adafruit.com/products/3955/guides)
### JST PH 2mm 4-Pin to Female Socket Cable - I2C STEMMA Cable

[JST PH 2mm 4-Pin to Female Socket Cable - I2C STEMMA Cable](https://www.adafruit.com/product/3950)
This cable will let you turn a JST PH 4-pin cable port into 4 individual wires with high-quality 0.1" female sockets on the end. We're carrying these to match up with any of our boards with 'STEMMA' connectors on them such as the <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/3950)
[Related Guides to the Product](https://learn.adafruit.com/products/3950/guides)
### JST SH 4-pin Cable with Alligator Clips - STEMMA QT / Qwiic

[JST SH 4-pin Cable with Alligator Clips - STEMMA QT / Qwiic](https://www.adafruit.com/product/4398)
This cable will make it super easy to use our plug-and-play STEMMA QT boards with boards like Circuit Playground. On one end you get a Qwiic / STEMMA QT connector (technically known as a JST SH 4-pin plug)&nbsp; into 4 individual wires with grippy alligator clips. We're carrying these to...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4398)
[Related Guides to the Product](https://learn.adafruit.com/products/4398/guides)

## Related Guides

- [Adafruit LSM6DS3TR-C + LIS3MDL - Precision 9 DoF IMU](https://learn.adafruit.com/adafruit-lsm6ds3tr-c-lis3mdl-precision-9-dof-imu.md)
- [QT Py S2 Round Display Compass](https://learn.adafruit.com/qt-py-s2-round-display-compass.md)
- [How to Fuse Motion Sensor Data into AHRS Orientation (Euler/Quaternions)](https://learn.adafruit.com/how-to-fuse-motion-sensor-data-into-ahrs-orientation-euler-quaternions.md)
- [LIS3MDL Triple-axis Magnetometer](https://learn.adafruit.com/lis3mdl-triple-axis-magnetometer.md)
- [Adafruit SensorLab - Gyroscope Calibration](https://learn.adafruit.com/adafruit-sensorlab-gyroscope-calibration.md)
- [Qualia S3 Compass](https://learn.adafruit.com/qualia-s3-compass.md)
- [Controlling Objects in Unity with a 9 DoF Sensor and Arduino](https://learn.adafruit.com/controlling-objects-in-unity-with-arduino.md)
- [Adafruit PCF8574 I2C GPIO Expander](https://learn.adafruit.com/adafruit-pcf8574.md)
- [Adafruit SGP41 Multi-Pixel Gas Sensor Breakout](https://learn.adafruit.com/adafruit-sgp41-multi-pixel-gas-sensor-breakout.md)
- [Adafruit TMC2209 Stepper Motor Driver Breakout Board](https://learn.adafruit.com/adafruit-tmc2209-stepper-motor-driver-breakout-board.md)
- [Adafruit 24LC32 I2C EEPROM Breakout - 32Kbit / 4 KB](https://learn.adafruit.com/adafruit-24lc32-i2c-eeprom-breakout-32kbit-4-kb.md)
- [ESP-NOW in CircuitPython](https://learn.adafruit.com/esp-now-in-circuitpython.md)
- [LED Matrix Hourglass](https://learn.adafruit.com/led-matrix-hourglass.md)
- [Circuit Playground Express USB MIDI Controller and Synthesizer](https://learn.adafruit.com/cpx-midi-controller.md)
- [Adafruit Trinket M0](https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino.md)
