Install magnetometer onto romi control board

Hi,
How do I install a magnetometer into the IMU of the romi 32U4 control board of the romi robot? The built-in IMU doesn’t have a magnetometer. Can I remove the built-in IMU and replace it with this? How exactly would I go about doing that (where even is the IMU on the control board in the first place)? Also, how would I code this using the romi 32u4 arduino library? Any help would be appreciated!

Hello.

While you could probably add the MinIMU-9 v6 Gyro, Accelerometer, and Compass to the Romi, you might consider just adding the LIS3MDL magnetometer since the Romi 32U4 Control Board already has a gyro and accelerometer.

You can just connect it to the same I2C bus; you can refer to the pinout diagrams in the “Expansion areas” section of the Romi 32U4 Control Board user’s guide to see the locations of the I2C pins. Aside from that, you would have to mount the magnetometer carefully to make sure the axes line up with the on-board IMU (shown below) as accurately as possible.

We do not have any example programs for our robots that would make use of the magnetometer data for orientation by combining it with the gyro and accelerometer data, but the MinIMU AHRS example program could be a possible starting point for doing that. Alternatively, you could use something like our TurnWithCompass example for the 3pi+ 32U4 Robot as a reference for using a magnetometer (though the 3pi+ uses a different library interface for the inertial sensors).

Brandon