# LSM303 Accelerometer + Compass Breakout

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/083/254/medium800/sensors_compass.jpg?1572391355)

The [LSM303](http://www.adafruit.com/products/4413 "Link: http://www.adafruit.com/products/4413") breakout board combines a magnetometer/compass module with a triple-axis accelerometer to make a compact navigation subsystem. The I2C interface is compatible with both 3.3v and 5v processors and the two pins can be shared by other I2C devices. Combined with a 3-axis gyro such as the [L3GD20](http://www.adafruit.com/products/1032 "Link: http://www.adafruit.com/products/1032"), you have all the sensors you need for a complete IMU (Inertial Measurement Unit) for use in aerial, terrestrial or marine navigation.  
  
In this tutorial we will show you how to connect the LSM303 to an Arduino, CircuitPython board, or Blinka supported device, and how to use it to measure orientation relative to the earth's magnetic field, and acceleration in three axis.

![](https://cdn-learn.adafruit.com/assets/assets/000/083/729/medium800/sensors_iso_shot_crop.jpg?1573071913)

One great feature of the newer LSM303AGR is that it includes a **[STEMMA QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt)&nbsp;**connectors that allow you to use it&nbsp;_without soldering._ Just plug in a [STEMMA QT to male header cable](https://www.adafruit.com/product/4209) to connect it to a breadboard or development board with female headers and you're off to the races! You can even chain it with other STEMMA QT breakouts using a [STEMMA QT cable](https://www.adafruit.com/product/4210)

![](https://cdn-learn.adafruit.com/assets/assets/000/083/732/medium800/sensors_top_stemma.jpg?1573072339)

## How it Works:

## MEMS - Micro Electro-Mechanical Systems

The sensor consists of micro-machined structures on a silicon wafer. There are structures designed to measure acceleration and magnetic fields in the X, Y and Z axis

## Acceleration Measurement

These structures are suspended by polysilicon springs which allow them to deflect when subject to acceleration in the X, Y and/or Z axis. Deflection causes a change in capacitance between fixed plates and plates attached to the suspended structure. This change in capacitance on each axis is converted to an output voltage proportional to the acceleration on that axis.

## Magnetic Field Measurement

These structures are similar to the accelerometer structures, but are etched with microscopic coils. An excitation current is passed through the coils, and the [Lorentz Force](http://en.wikipedia.org/wiki/Lorentz_force "Link: http://en.wikipedia.org/wiki/Lorentz\_force") due to the magnetic field causes the structure to deflect. Once again the deflection is converted to an output voltage proportional to the strength of the magnetic field in that axis.

- [Next Page](https://learn.adafruit.com/lsm303-accelerometer-slash-compass-breakout/which-lsm303-do-i-have.md)

## Primary Products

### Adafruit LSM303AGR Accelerometer Magnetometer - STEMMA QT Qwiic

[Adafruit LSM303AGR Accelerometer Magnetometer - STEMMA QT Qwiic](https://www.adafruit.com/product/4413)
Do you know which way the wind blows? You will now, with this triple-axis accelerometer/magnetometer compass module. Inside are two sensors, one is a classic 3-axis accelerometer, which can tell you which direction is down towards the Earth (by measuring gravity). The other is a magnetometer...

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

## Featured Products

### 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)
### Adafruit METRO 328 Fully Assembled - Arduino IDE compatible

[Adafruit METRO 328 Fully Assembled - Arduino IDE compatible](https://www.adafruit.com/product/50)
We sure love the ATmega328 here at Adafruit, and we use them&nbsp;_a lot_&nbsp;for our own projects. The processor has plenty of GPIO, Analog inputs, hardware UART SPI and I2C, timers and PWM galore - just enough for most simple projects. When we need to go small, we use a <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/50)
[Related Guides to the Product](https://learn.adafruit.com/products/50/guides)
### White Enclosure for Arduino - Electronics enclosure

[White Enclosure for Arduino - Electronics enclosure](https://www.adafruit.com/product/271)
Discontinued - **you can check these [Arduino accessories](https://www.adafruit.com/category/346)&nbsp;instead!&nbsp;**

&nbsp;

We are very excited to have one of the first (and we think the best) Enclosure for Arduino & project box! Here are all the...

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

[Continuous Rotation Servo](https://www.adafruit.com/product/154)
This servo rotates fully forward or backward instead of moving to a position. You can use any servo code, hardware, or library to control these servos. Good for making simple moving robots. Comes with four different horns, as shown.

To control with an Arduino, we suggest connecting...

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

## Related Guides

- [IR Sensor](https://learn.adafruit.com/ir-sensor.md)
- [Arduino Lesson 12. LCD Displays - Part 2](https://learn.adafruit.com/adafruit-arduino-lesson-12-lcd-displays-part-2.md)
- [RePaper eInk Development Board](https://learn.adafruit.com/repaper-eink-development-board.md)
- [Multi-tasking the Arduino - Part 2](https://learn.adafruit.com/multi-tasking-the-arduino-part-2.md)
- [Sending an SMS with Temboo](https://learn.adafruit.com/sending-an-sms-with-temboo.md)
- [FTDI Friend](https://learn.adafruit.com/ftdi-friend.md)
- [Adalight Project Pack](https://learn.adafruit.com/adalight-diy-ambient-tv-lighting.md)
- [Circuit Playground: D is for Diode](https://learn.adafruit.com/circuit-playground-d-is-for-diode.md)
- [Arduino Lesson 1. Blink](https://learn.adafruit.com/adafruit-arduino-lesson-1-blink.md)
- [Adafruit IO Basics: NeoPixel Controller](https://learn.adafruit.com/adafruit-io-basics-neopixel-controller.md)
- [RGB LED Matrix Basics](https://learn.adafruit.com/32x16-32x32-rgb-led-matrix.md)
- [Trainable Robotic Arm](https://learn.adafruit.com/trainable-robotic-arm.md)
- [2.8" TFT Touchscreen](https://learn.adafruit.com/2-8-tft-touchscreen.md)
- [Bluefruit LE Connect for iOS and Android](https://learn.adafruit.com/bluefruit-le-connect.md)
- [Ladyada's Learn Arduino - Lesson #1](https://learn.adafruit.com/ladyadas-learn-arduino-lesson-number-1.md)
