This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Second MPU-9250
#1
Hello,
 
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.
Reply
#2
As an Pyton-Scripter i would look at the Sources from pypilot, it would be easyer to change the priotiy there.
Reply
#3
@holgerw

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?
Reply
#4
I think I have solved the problem in the meanwhile:
 
Pypilot is using RTIMULib2 (https://github.com/seandepagnier/RTIMULib2.git), 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:
 

Code:
git clone https://github.com/seandepagnier/RTIMULib2.git
          
- 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

Code:
cd RTIMULib2/Linux/python
sudo python3 setup.py build
sudo python3 setup.py 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…
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)