# Adding an External IMU to your Hub

{% hint style="info" %}
All Control Hubs feature an internal IMU. If your Expansion Hub was purchased *BEFORE* December 2021, it has an internal IMU installed.
{% endhint %}

## **Configuring the 9-Axis IMU (**&#x52;EV-31-3332)

{% hint style="info" %}
To use the 9-Axis IMU the Control Hub must be running Robot Controller App v10.0 or newer.
{% endhint %}

{% hint style="success" %}
[A full configuration walkthrough is available here.](https://docs.revrobotics.com/duo-control/hello-robot-blocks/configuration)
{% endhint %}

The 9-Axis IMU is configured similar to other I2C devices. First, navigate to the Control Hub Portal or Expansion Hub where it is connected in the configuration menu.

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2F3LMoT2SrjbCobCRXvZb6%2FScreenshot_20240521-155407%5B2%5D.png?alt=media&#x26;token=a6e44a18-6c6a-4304-b3bb-dd0643990b98" alt=""><figcaption><p>Configuration menu on the Driver Hub</p></figcaption></figure>

Next, scroll to find the option to add something to the I2C Bus. **Note:** The internal IMU appears in I2C Bus 0. For this example, we are adding the 9-Axis IMU to I2C Bus 1.

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2F6LDYIOb8NPpVXtmLqFb7%2Fimage.png?alt=media&#x26;token=5530237a-ad83-4635-a034-bc491847677c" alt=""><figcaption><p>I2C Bus options in the configuration menu</p></figcaption></figure>

Once in the menu, click "Add". This will show the option to add a new sensor to this I2C Bus.&#x20;

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2FHwFFg7qWh42Tjvz5eR3i%2Fimage.png?alt=media&#x26;token=ba016b8c-cbf1-48eb-abc5-f026bed17aae" alt=""><figcaption><p>Option to add a new I2C device to the bus</p></figcaption></figure>

Scroll to select the REV 9-Axis IMU from the dropdown menu.

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2FWePsklXteYPgfMQv0lqT%2Fimage.png?alt=media&#x26;token=c8b9dc6b-ea38-40b1-993f-68746a520c2b" alt=""><figcaption><p>9-Axis IMU within the available dropdown menu</p></figcaption></figure>

Name the IMU something relevant that will be easy to identify later. Remember the built-in IMU, if applicable, may also appear as an option while programming.

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2Fc054nhhsmwO6rUjCHuKl%2Fimage.png?alt=media&#x26;token=c315d4c3-fa8e-451b-b65a-9f92da3f72e5" alt=""><figcaption><p>Naming the IMU to identify it while programming</p></figcaption></figure>

Finally, select "Done" and complete the remainder of your configuration process.

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2FwmtSufJRTAYeHb4k3Zuu%2Fimage.png?alt=media&#x26;token=052fab43-fa72-461e-8efb-f1014bbc29e9" alt=""><figcaption><p>The "Done" option will save the added sensor</p></figcaption></figure>

### **9-Axis IMU in Blocks**

Once configured, the 9-Axis IMU will appear as an option under "Sensors" in the Blocks menu.

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2FOl7SlMAUL9APo70xbEea%2Fimage.png?alt=media&#x26;token=0ef1fcb4-e606-46d4-a954-0c036e7ed2b6" alt=""><figcaption><p>The IMU listing in the Blocks side menu</p></figcaption></figure>

When calling the IMU, the configured 9-Axis IMU will appear as the assigned name in the dropdown option on the individual block.

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2FKmU0FhdtVvn1t5FDM1vN%2Fimage.png?alt=media&#x26;token=b926d173-0c08-40c9-83a9-741134132c13" alt=""><figcaption><p>IMU selection dropdown</p></figcaption></figure>

### 9-Axis IMU in OnBot Java

When "Setup Code for Configured Hardware" is checked while creating a new OpMode in OnBot Java, the IMU will automatically be added to the hardwareMap using the assigned name from configuration.

An internal IMU, if applicable, will retain its default name based on the version of IMU (BNO055 or BHI260AP).

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2FKhZR3ZQ4i4DrzRbF6yjw%2Fimage.png?alt=media&#x26;token=f14229cc-c3f7-4284-bcd7-fe9e0940ddef" alt=""><figcaption><p>The configured IMU appearing in OnBot's hardwareMap</p></figcaption></figure>

## **Other Compatible External IMUs**

There are a few options that will work for giving your Hub Gyro/IMU function.

1. [navX2 Sensor Bundle](https://www.andymark.com/products/navx2-micro-navigation-sensor-bundle) - Also supported in the FTC programming environment. Code examples are listed on AndyMark's page, and this product includes the correct cables to use within FTC. &#x20;
2. [Adafruit 9-DOF Absolute Orientation IMU](https://www.adafruit.com/product/4646) - This is the same IMU as in Control Hubs from before 2022, but will require you to either create an adapter cable or solder a cut [sensor cable](https://www.revrobotics.com/jst-ph-4-pin-sensor-cable-4-pack/) to the board. Plugging this in and configuring the IMU on I2C port zero will allow you to use and program the same as an internal IMU.
3. [Integrating Gyro](https://modernroboticsinc.com/product/integrating-gyro/) with our [Logic Level Converter](https://www.revrobotics.com/rev-31-1389/) and [Sensor Cable Adapter](https://www.revrobotics.com/rev-31-1384/) - This is supported in the FTC Programing environment but is just a single-axis gyro, not a full IMU.
