# NXP Precision 9DoF Breakout

## Overview

The NXP Precision 9DoF breakout combines two of the best motion sensors we've tested here at Adafruit: The **FXOS8700** 3-Axis accelerometer and magnetometer, and the **FXAS21002** 3-axis gyroscope.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/752/medium800/sensors_3463_ORIG_030_1500w.jpg?1491855669)

These two sensors combine to make a nice 9-DoF kit, that can be used for motion and orientation sensing. In particular, we think this sensor set is ideal for AHRS-based orientation calculations: the gyro stability performance is superior to the [LSM9DS0](https://www.adafruit.com/product/2021), [LSM9DS1](https://www.adafruit.com/product/3387),&nbsp;[L3GD20H + LSM303,](https://www.adafruit.com/product/1714)MPU-9250, and even the [BNO-055](https://www.adafruit.com/product/2472) (see our [Gyro comparison tutorial for more details](../../../../comparing-gyroscope-datasheets))

Compared to the BNO055, this sensor will get you similar orientation performance but at a lower price because the calculations are done on your microcontroller, not in the sensor itself. The trade off is you will sacrifice about 15KB of Flash space, and computing cycles, to do the math 'in house'

To make it fast and easy for you to get started, we have a version of AHRS that we've adapted to work over USB or Bluetooth LE. Load the code onto your Arduino-compatible board and you will get orientation data in the form of Euler angles or quaternions! It will work on a ATmega328 but faster/larger chips such as M0 or ESP8266 will give you more breathing room.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/763/medium800/sensors_3463_ORIG_030.jpg?1491931049)

Each board comes with the two chips soldered onto a breakout with 4 mounting holes. While the chips support SPI, they don't tri-state the MISO pin, so we decided to go with plain I2C which works well and is supported by every modern microcontroller and computer chip set.&nbsp; There's a 3.3V regulator and level shifting on the I2C and Reset lines, so you can use the breakout safely with 3.3V or 5V power/logic. Each order comes with a fully assembled and tested breakout and a small strip of header. Some light soldering is required to attach the header if you want to use in a breadboard.

![](https://cdn-learn.adafruit.com/assets/assets/000/040/762/medium800/sensors_3463_ORIG_036.jpg?1491931037)

## So what makes this so 'Precision'-y, eh?

Glad you asked! This particular sensor combination jumped out at us writing the [Comparing Gyroscopes](../../../../comparing-gyroscope-datasheets/overview)&nbsp;learning guide since the FXAS21002&nbsp;exhibited the lowest **zero-rate level** &nbsp;off any of the gyroscopes we've tested, with the&nbsp;the following documented levels (converted to degrees per second for convenience sake):

- At +/- 2000 dps **3.125&nbsp;dps**
- At +/- 250 dps **0.3906 dps**

The zero-rate level is important in orientation since it&nbsp;represents the amount of angular velocity a gyroscope will report when the device is immobile. High zero-rate levels can cause all kinds of problems in orientation systems if the data isn't properly compensated out, and distinguishing zero-rate errors from actual angular velocity can be non-trivial. This is particularly important in sensor fusion algorithms where the gyroscope plays an important part in&nbsp;predicting orientation adjustments over time. A high zero-rate level will cause constant rotation even when the device is immobile!

By comparison, most other sensors tested have 10-20 times these zero-rate levels, which is why we consider this particular part very **precise**. There is little work to do out of the box to get useful, actionable data out of it. See the table&nbsp;of similar parts below&nbsp;to compare for yourself:

![](https://cdn-learn.adafruit.com/assets/assets/000/040/669/medium800/sensors_Screen_Shot_2017-04-05_at_21.58.41.png?1491422359)

# Technical Details

The NXP Precision 9DoF board consists of two separate ICs, described in detail below:

## FXOS8700 3-Axis Accelerometer/Magnetometer

- 2-3.6V Supply
- ±2 g/±4 g/±8 g adjustable acceleration range
- ±1200 µT magnetic sensor range
- Output data rates (ODR) from 1.563 Hz to 800 Hz
- 14-bit ADC resolution for acceleration measurements
- 16-bit ADC resolution for magnetic measurements

## FXAS21002 3-Axis Gyroscope

- 2-3.6V Supply
- ±250/500/1000/2000°/s configurable&nbsp;range
- Output Data Rates (ODR) from 12.5 to 800 Hz
- 16-bit digital output resolution
- 192 bytes FIFO buffer (32 X/Y/Z samples)

# NXP Precision 9DoF Breakout

## Assembly

![](https://cdn-learn.adafruit.com/assets/assets/000/040/900/medium800/sensors_3463-00.jpg?1492463766)

## Prepare the header strip:

Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard - **long pins down**

![sensors_DSC_3473.jpg](https://cdn-learn.adafruit.com/assets/assets/000/040/901/medium640/sensors_DSC_3473.jpg?1492463808)

## Add the breakout board:

Place the breakout board over the pins so that the short pins poke through the breakout pads

![sensors_DSC_3474.jpg](https://cdn-learn.adafruit.com/assets/assets/000/040/902/medium640/sensors_DSC_3474.jpg?1492463819)

## And Solder!

Be sure to solder all pins for reliable electrical contact.  
  
Solder&nbsp;one side first  
  
_(For tips on soldering, be sure to check out our_ [_Guide to Excellent Soldering_](http://learn.adafruit.com/adafruit-guide-excellent-soldering)_)._

![sensors_DSC_3477.jpg](https://cdn-learn.adafruit.com/assets/assets/000/040/903/medium640/sensors_DSC_3477.jpg?1492463880)

![sensors_DSC_3480.jpg](https://cdn-learn.adafruit.com/assets/assets/000/040/904/medium640/sensors_DSC_3480.jpg?1492463914)

Twist the board around and solder the other row!

![sensors_DSC_3482.jpg](https://cdn-learn.adafruit.com/assets/assets/000/040/905/medium640/sensors_DSC_3482.jpg?1492463934)

![sensors_DSC_3483.jpg](https://cdn-learn.adafruit.com/assets/assets/000/040/906/medium640/sensors_DSC_3483.jpg?1492463962)

![sensors_DSC_3486.jpg](https://cdn-learn.adafruit.com/assets/assets/000/040/907/medium640/sensors_DSC_3486.jpg?1492463976)

![sensors_DSC_3488.jpg](https://cdn-learn.adafruit.com/assets/assets/000/040/908/medium640/sensors_DSC_3488.jpg?1492463984)

You're done! Check your solder joints visually and continue onto the next steps

![sensors_DSC_3489.jpg](https://cdn-learn.adafruit.com/assets/assets/000/040/909/medium640/sensors_DSC_3489.jpg?1492464034)

# NXP Precision 9DoF Breakout

## Pinout

The NXP Precision 9DoF breakout has the following pinout:

![](https://cdn-learn.adafruit.com/assets/assets/000/040/764/medium800/sensors_pinout.jpg?1491931225)

# Power Pins

- **VIN** - 3.3-5V input, which feeds the on board 3.3V voltage regulator and optionally sets the signal levels for the I2C pins (SCL and SDA) if you are using a 5V system. On a **3.3V system** (any Adafruit Feather, for example), connect 3.3V to VIN for 3.3V logic throughout the system. On a&nbsp; **5.0V system** , connect VIN to 5V, and the signals will be shifted downward to 3.3V before reaching the NXP sensors (which are limited to 3.6V or less for the pins).
- **3Vo** - This is the output of the 3.3V linear regulator on the NXP Precision 9DoF Breakout. On a 5V system, you can use this as an additional 3.3V supply if you need some extra 3.3V power.
- **GND** - This should be connected to GND on your development board.

# Digital Pins

- **SCL** - I2C, Connect this to SCL on your development board. This pin is level-shifted and 3-5V logic safe.
- **SDA** - I2C, Connect this to SDA on your development board. This pin is level-shifted and 3-5V logic safe.
- **RST** - Optionally connect this to RST on your development board (depending on the logic level used), or to a GPIO pin if you wish to manually reset the sensors on the breakout. This pin isn't required in most circumstances, but can be useful to recover from error conditions on long running systems where the sensors might have entered an unknown config state. This pin is level-shifted and 3-5V logic safe.
- **AI1, AI2** - This two pins allow interrupts _from_ the Accelerometer/Magnetometer (see the datasheet for details). These are not level shifted but since they are outputs only, you can use with 3 or 5V logic systems.
- **GI1, G12** - These two pins allow interrupts from the Gyroscope (see the datasheet for details). These are not level shifted but since they are outputs only, you can use with 3 or 5V logic systems.

# Breadboard Connection

Since 9DoF sensors are usually used for orientation and detecting movement, you'll normally want to securely connect the breakout to something before using it.

The pinout below shows how you can connect the NXP Precision 9DoF Breakout to any Adafruit Feather development board. The image below uses the [Bluefruit nRF52 Feather](https://www.adafruit.com/product/3406), which is a great MCU to combine with the NXP Precision 9DoF since the ARM Cortex M4F has a lot of processing power, and Bluetooth Low Energy makes it easy to get the orientation data onto your phone or computer without any cables getting in the way!

![](https://cdn-learn.adafruit.com/assets/assets/000/040/748/medium800/sensors_NXP9DOFBREADBOARD.png?1491841114)

# NXP Precision 9DoF Breakout

## Arduino Code

# Breadboard Connection

Since 9DoF sensors are usually used for orientation and detecting movement, you'll normally want to securely connect the breakout to something before using it.

The pinout below shows how you can connect the NXP Precision 9DoF Breakout to any Adafruit Feather development board. The image below uses the [Bluefruit nRF52 Feather](https://www.adafruit.com/product/3406), which is a great MCU to combine with the NXP Precision 9DoF since the ARM Cortex M4F has a lot of processing power, and Bluetooth Low Energy makes it easy to get the orientation data onto your phone or computer without any cables getting in the way!

![](https://cdn-learn.adafruit.com/assets/assets/000/040/765/medium800/sensors_NXP9DOFBREADBOARD.png?1491931421)

But you can also use with an Arduino-compatible. Just make sure you connect **Vin** to 3-5V, **GND** to ground, and **SCL + SDA** to your microcontroller's I2C pin

![sensors_metrobb.png](https://cdn-learn.adafruit.com/assets/assets/000/040/768/medium640/sensors_metrobb.png?1491932481)

# Required Arduino Libraries

The following libraries can all be installed from the Arduino Library Manager:

- [Adafruit\_FXOS8700](https://github.com/adafruit/Adafruit_FXOS8700)
- [Adafruit\_FXAS21002C](https://github.com/adafruit/Adafruit_FXAS21002C)
- [Adafruit Unified Sensor&nbsp;](https://github.com/adafruit/Adafruit_Sensor)(Adafruit\_Sensor)

# Installing the Libraries

The libraries mentioned above are already available in the Arduino Library Manager, and should be installed there to facilitate version tracking and easy software updates.

Open up the **Library Manager...** through the menu **Sketch-\>Include Library-\>Library Manager..**. Then type in "Adafruit AHRS", "Adafruit Sensor", etc., to locate and install the libraries

![](https://cdn-learn.adafruit.com/assets/assets/000/040/770/medium800/sensors_ahrs.png?1491933041)

Once you are done installing all 4 libraries, quit and re-start the Arduino IDE.

# Testing the Sensors and Library Installation

The **Adafruit\_FXOS8700** and&nbsp; **Adafruit\_FXAS21002C** repositories both contain a single example called&nbsp; **sensorapi** which demonstrates how to get raw sensor using the Unified Sensor Library (Adafruit\_Sensor):

![](https://cdn-learn.adafruit.com/assets/assets/000/040/773/medium800/sensors_ahrs.png?1491933150)

Info: 

Load either of these examples, flash the sketch to your board, and then open the&nbsp; **Serial Monitor** and if everything is connected correctly you should see something resembling the following output (for the Gyroscope in this example):

![](https://cdn-learn.adafruit.com/assets/assets/000/040/675/medium800/sensors_Screen_Shot_2017-04-06_at_12.45.40.png?1491475610)

Try moving around the board, spinning it or tilting it, to see the data change with motion!

If you see the sensor data shown above, everything is properly setup and connected, you can continue onto the next steps

# NXP Precision 9DoF Breakout

## Use AHRS to Calculate Orientation

# NXP Precision 9DoF Breakout

## API (FXOS8700)

# NXP Precision 9DoF Breakout

## API (FXAS21002C)

# NXP Precision 9DoF Breakout

## Python & CircuitPython

It's easy to use the FXOS8700 + FXAS21002C 9DoF&nbsp;sensor with Python and CircuitPython, and the&nbsp;[Adafruit CircuitPython FXOS8700](https://github.com/adafruit/Adafruit_CircuitPython_FXOS8700)&nbsp;and [Adafruit CircuitPython FXAS21002C](https://github.com/adafruit/Adafruit_CircuitPython_FXAS21002C)&nbsp;modules.&nbsp; These module allows you to easily write Python code that reads the accelerometer, magnetometer, and gyroscope values&nbsp;from the sensors. &nbsp; **Note the advanced sensor fusion algorithm to compute absolute orientation is not currently supported--you can only read the raw sensor accelerometer, magnetometer, and gyroscope values!**

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 a 9DoF&nbsp;to your board exactly as shown on the previous pages for Arduino. &nbsp; Here's an example of wiring a Feather M0 to the sensor with an I2C connection:

- **Board 3V** &nbsp;to&nbsp; **sensor VIN**
- **Board GND** &nbsp;to&nbsp; **sensor GND**
- **Board SCL** &nbsp;to&nbsp; **sensor&nbsp;SCL**
- **Board SDA** &nbsp;to&nbsp; **sensor SDA**

![sensors_m0_fx0_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/048/753/medium640/sensors_m0_fx0_bb.png?1534865183)

# Python Computer Wiring

Since there's _dozens_ of Linux computers/boards you can use we will show wiring for Raspberry Pi. For other platforms, [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 3V3** to **sensor VIN**
- **Pi GND** to **sensor GND**
- **Pi SCL** to **sensor SCL**
- **Pi SDA** to **sensor SDA**

![sensors_raspi_fxas_fxos_9dof_i2c_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/489/medium640/sensors_raspi_fxas_fxos_9dof_i2c_bb.jpg?1534865299)

# CircuitPython Installation of FXOS8700 + FXAS21002C Library

Next you'll need to install **both** the [Adafruit CircuitPython FXOS8700](https://github.com/adafruit/Adafruit_CircuitPython_FXOS8700)&nbsp;and [Adafruit CircuitPython FXAS21002C](https://github.com/adafruit/Adafruit_CircuitPython_FXAS21002C)&nbsp;libraries on your CircuitPython board

First make sure you are running the&nbsp;[latest version of Adafruit CircuitPython](https://github.com/adafruit/circuitpython/releases)&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://github.com/adafruit/Adafruit_CircuitPython_Bundle).&nbsp; For example the Circuit Playground Express guide has&nbsp;[a great page on how to install the library bundle](../../../../adafruit-circuit-playground-express/installing-libraries)&nbsp;for both express and non-express boards.

Remember for non-express boards like the Trinket M0, Gemma M0, and Feather/Metro M0 basic you'll need to manually install the necessary libraries from the bundle:

- **adafruit\_fxos8700.mpy**
- **adafruit\_fxas21002c.mpy**
- **adafruit\_bus\_device**

Before continuing make sure your board's lib folder or root filesystem has the&nbsp; **adafruit\_fxos8700.mpy, adafruit\_fxas21002c.mpy&nbsp;** and **&nbsp;adafruit\_bus\_device**** &nbsp; **files and folders** &nbsp;**copied over.

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

# Python Installation of FXOS8700 + FXAS21002C Library

You'll need to install the Adafruit\_Blinka library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3. [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 command:

- `sudo pip3 install adafruit-circuitpython-fxos8700`
- `sudo pip3 install adafruit-circuitpython-fxas21002c`

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

# CircuitPython & Python Usage

To demonstrate the usage of the sensor we'll initialize it and read the accelerometer, magnetometer, and gyroscope values&nbsp;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 board
import adafruit_fxos8700
import adafruit_fxas21002c
i2c = board.I2C()
fxos = adafruit_fxos8700.FXOS8700(i2c)
fxas = adafruit_fxas21002c.FXAS21002C(i2c)
```

Now you're ready to read values from the sensors using any of these properties. &nbsp;For the FXOS8700:

- **accelerometer** &nbsp;-&nbsp;A 3-tuple of X, Y, Z axis accelerometer values in meters per second squared.
- **magnetometer** - A 3-tuple of X, Y, Z axis magnetometer values in gauss.

And for the FXAS21002C:

- **gyroscope** - A 3-tuple of the X, Y, Z axis gyroscope values in radians per second.

```
print('Acceleration (m/s^2): ({0:0.3f},{1:0.3f},{2:0.3f})'.format(*fxos.accelerometer))
print('Magnetometer (uTesla): ({0:0.3f},{1:0.3f},{2:0.3f})'.format(*fxos.magnetometer))
print('Gyroscope (radians/s): ({0:0.3f},{1:0.3f},{2:0.3f})'.format(*fxas.gyroscope))
```

![](https://cdn-learn.adafruit.com/assets/assets/000/048/920/medium800/sensors_Screen_Shot_2017-12-06_at_2.22.08_PM.png?1512598959)

See the [FXOS8700 simpletest.py example](https://github.com/adafruit/Adafruit_CircuitPython_FXOS8700/blob/master/examples/simpletest.py) for a complete demo of printing the accelerometer and magnetometer&nbsp;every second. Also see the [FXAS21002C simpletest.py example](https://github.com/adafruit/Adafruit_CircuitPython_FXAS21002C/blob/master/examples/simpletest.py) for a complete demo of printing the accelerometer and magnetometer&nbsp;every second. &nbsp;Save this as **code.py** on the board and examine the REPL output to see the range printed every second.

That's all there is to using the FXOS8700 and FXAS21002C sensors with CircuitPython!

# Full Example Code

FXOS8700 test example:

https://github.com/adafruit/Adafruit_CircuitPython_FXOS8700/blob/main/examples/fxos8700_simpletest.py

FXAS21002C test example:

https://github.com/adafruit/Adafruit_CircuitPython_FXAS21002C/blob/main/examples/fxas21002c_simpletest.py

# NXP Precision 9DoF Breakout

## Python Docs (FXOS8700)

# NXP Precision 9DoF Breakout

## Python Docs (FXAS21002C)

# NXP Precision 9DoF Breakout

## Downloads

# Files&nbsp;

- [FXAS21002 Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/040/671/original/FXAS21002.pdf?1491475056)
- [FXOS8700CQ Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/043/458/original/FXOS8700CQ.pdf?1499125614)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-FXOS8700-FXAS21002-9-DoF-Breakout-PCB)
- [Fritzing object in Adafruit Fritzing library](https://github.com/adafruit/Fritzing-Library)

# Arduino Libraries (Github)

- [Adafruit\_FSOX8700](https://github.com/adafruit/Adafruit_FXOS8700)
- [Adafruit\_FXAS21002C](https://github.com/adafruit/Adafruit_FXAS21002C)
- [Adafruit\_AHRS](https://github.com/adafruit/Adafruit_AHRS)

# Schematic
![](https://cdn-learn.adafruit.com/assets/assets/000/040/670/medium800/sensors_NXPPrecision9DOF.png?1491474986)

# Board Dimensions
![](https://cdn-learn.adafruit.com/assets/assets/000/040/793/medium800/sensors_fabprint.png?1491938213)


## Featured Products

### Adafruit Precision NXP 9-DOF Breakout Board

[Adafruit Precision NXP 9-DOF Breakout Board](https://www.adafruit.com/product/3463)
The NXP Precision 9DoF breakout combines two of the best motion sensors we've tested here at Adafruit: The **FXOS8700** 3-Axis accelerometer and magnetometer, and the **FXAS21002** 3-axis gyroscope.

These two sensors combine to make a nice 9-DoF kit, that...

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

## Related Guides

- [Adafruit Proximity Trinkey](https://learn.adafruit.com/adafruit-proximity-trinkey.md)
- [Getting Started with the nRF8001 Bluefruit LE Breakout](https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout.md)
- [Adafruit Circuit Playground Bluefruit](https://learn.adafruit.com/adafruit-circuit-playground-bluefruit.md)
- [Adafruit I2C Quad Rotary Encoder Breakout](https://learn.adafruit.com/adafruit-i2c-quad-rotary-encoder-breakout.md)
- [Adafruit BNO055 + BMP280 BFF](https://learn.adafruit.com/adafruit-bno055-bmp280-bff.md)
- [Adafruit SHT31-D Temperature & Humidity Sensor Breakout](https://learn.adafruit.com/adafruit-sht31-d-temperature-and-humidity-sensor-breakout.md)
- [Adafruit MAX17048 LiPoly / LiIon Fuel Gauge and Battery Monitor](https://learn.adafruit.com/adafruit-max17048-lipoly-liion-fuel-gauge-and-battery-monitor.md)
- [Adafruit NAU7802 24-Bit ADC - STEMMA QT / Qwiic](https://learn.adafruit.com/adafruit-nau7802-24-bit-adc-stemma-qt-qwiic.md)
- [Garmin Lidar Lite Range Finder](https://learn.adafruit.com/garmin-lidar-lite-range-finder.md)
- [Tweet-a-watt](https://learn.adafruit.com/tweet-a-watt.md)
- [Adafruit USB Type C Power Delivery Switchable Breakout](https://learn.adafruit.com/adafruit-usb-type-c-power-delivery-switchable-breakout.md)
- [Adafruit RGB Matrix FeatherWings](https://learn.adafruit.com/rgb-matrix-featherwing.md)
- [Adafruit TPS65131 Split Power Supply Boost Converter](https://learn.adafruit.com/adafruit-tps65131-split-power-supply-boost-converter.md)
- [Adafruit HDC1008 Temperature and Humidity Sensor Breakout](https://learn.adafruit.com/adafruit-hdc1008-temperature-and-humidity-sensor-breakout.md)
- [Measuring Parts from Product Photos in FreeCAD](https://learn.adafruit.com/measuring-parts-from-product-photos-in-freecad.md)
