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, 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!

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

Required Arduino Libraries

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

Optionally, if you wish to generate orientation data from the raw sensor outputs (recommended!), you will also need the following library:

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

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 Adafruit_FXAS21002C repositories both contain a single example called sensorapi which demonstrates how to get raw sensor using the Unified Sensor Library (Adafruit_Sensor):

Both of these examples require Adafruit_Sensor to be installed on your system! If you're getting compilation errors, make sure you have it installed!

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

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

This guide was first published on Apr 14, 2017. It was last updated on Apr 14, 2017. This page (Arduino Code) was last updated on Sep 17, 2019.