3.5. Inertial sensors
The Balboa 32U4’s IMU and compass chips.
Balboa 32U4 includes on-board inertial sensors that allow it to determine its own orientation by implementing an inertial measurement unit (IMU); this is key to Balboa’s balancing ability. The first chip, an ST LSM6DS33, combines a 3-axis accelerometer and 3-axis gyro into a single package. The second chip is an ST LIS3MDL 3-axis magnetometer.
Both sensor chips are connected to the board’s I²C bus by default. Level shifters built into the control board allow the ATmega32U4, operating at 5 V, to communicate with the 3.3 V sensors. If a Raspberry Pi is plugged into the control board, its I²C pins are connected to the 3.3 V side of the bus as well. (See Section 3.8 for more information about the Raspberry Pi interface.)
The Balboa32U4 library (see Section 6) includes example programs that demonstrate how to use the sensors, including a balancing demo. In addition, the sensor ICs on Balboa 32U4 are the same as those on our MinIMU-9 v5, so software written for the MinIMU-9 (such as our Arduino AHRS example) can also be adapted to work on Balboa.
Please note that the LIS3MDL magnetometer can be affected by magnetic fields from the Balboa itself. These include magnets in the motors and encoders, electrical currents through the board, and hard iron distortions from metal (probably mostly from the batteries). The magnetometer is positioned as far away from the motors as possible to avoid interference from them, but we have found that hard iron distortions still influence the readings significantly, making it difficult to accurately determine the Balboa’s absolute heading based on the raw magnetometer data. This post on the Pololu forum details a technique for correcting for hard iron distortions, making it possible to use of the magnetometer as a compass for navigation in environments that are not dominated by magnetic interference.