Second MPU-9250 - Printable Version

+- OpenMarine (
+-- Forum: OpenPlotter (
+--- Forum: How do I...? (
+--- Thread: Second MPU-9250 (/showthread.php?tid=2680)

Second MPU-9250 - TomSailor - 2020-06-23

I have a working setup with a Raspberry Pi 4B, a Moitessier Hat (version 1) and a few additional I2C sensors. Now I want to add a second remote MPU-9259 sensor on the I2C bus. The reason is simply to have a possibility to place this second IMU in less EM-noisy place on the boat. The MPU-9250 on the Moitessier Hat uses the I2C address 0x68 and the remote one uses 0x69. If I connect only one IMU at the time, the pypilot output to Signal K is fine meaning it reads the data from the IMU from either one or the other address. But when I connect both IMU, pypilot reads only from the Moitessier IMU (0x68) and it ignores the second remote IMU on address 0x69. Apparently, the pypolite is configured such that it searches first 0x68 and if there is nothing it skips to 0x69. Now my question: is there a way to temporarily disable the IMU on the Moitessier hat respectively force pypilot to read only from 0x69? An onther option could be to change the address on the Moitessier hat, but I do not know how. Any idea or hint is welcome.

RE: Second MPU-9250 - holgerw - 2020-06-24

As an Pyton-Scripter i would look at the Sources from pypilot, it would be easyer to change the priotiy there.

RE: Second MPU-9250 - TomSailor - 2020-06-30


Thanks for the hint. I had the same idea in mind, but then I gave up, as I could not find the right .py file where the address is coded. Do you have any idea what this file is called or where I could find it?

RE: Second MPU-9250 - TomSailor - 2020-07-07

I think I have solved the problem in the meanwhile:
Pypilot is using RTIMULib2 (, where the i2c addresses of the MPU-9250 are defined in the header file RTIMUDefs.h.
So in order to change the priority in which pypilot accesses the two possible i2c addresses (0x68 and 0x69) you need to modify the RTMIDefs.h file before you re-build and reinstall the library:

git clone
- open the file RTIMULib/IMUDrivers/RTIMUDefs.h
- swap the two addresses (0x68 & 0x69) in the sections 'MPU925x I2C Slave Addresses' AND 'MPU9150 I2C Slave Addresses'
- save and close the file

cd RTIMULib2/Linux/python
sudo python3 build
sudo python3 install

Now pypiot accesses first the external IMU and if it does not find it (e.g. because it is disconnected) it uses the internal IMU from the Moitessier HAT.
Works flawlessly…