OpenMarine

Full Version: Zero W2 IMU Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,
     I am trying to setup Pypilot using a Raspberry Pi Zero W2.  I have successfully installed tinypilot13-20240915.img and am able to access the controls via the browser interface.  I have connected a MPU9250 that I purchased from Amazon (https://www.amazon.ca/dp/B0CRZF148H?ref=...asin_title) using a breadboard to the SCL and SDA GPIO pins.  The problem is I cannot get a compass heading or acceleration data. I have confirmed the IMU has 3.3v power.  Is this IMU compatible with the Zero W2?  I have not gotten to the next step of connecting a motor controller yet.

Here is a sample from the Pypilot log at startup:

2024-09-12_12:00:07.85860 autopilot start 16.114824941
2024-09-12_12:00:12.64743 world magnetic model not available
2024-09-12_12:00:12.93182 imu process 2312
2024-09-12_12:00:12.94608 made imu process realtime
2024-09-12_12:00:12.94616 Using settings file RTIMULib.ini
2024-09-12_12:00:12.94620 Settings file RTIMULib.ini loaded
2024-09-12_12:00:12.94629 Failed to open settings file for saveUsing fusion algorithm Kalman STATE4
2024-09-12_12:00:13.05216 nmea process 2315
2024-09-12_12:00:13.05306 listening on port 20220 for nmea connections
2024-09-12_12:00:13.07122 gps process 2318
2024-09-12_12:00:13.08201 loading servo calibration /home/tc/.pypilot/servocalibration
2024-09-12_12:00:13.08231 WARNING: using default servo calibration!!
2024-09-12_12:00:13.09018 Available Pilots: ['absolute', 'basic']
2024-09-12_12:00:13.10139 pypilotServer process 2323
2024-09-12_12:00:13.10993 pypilotinit complete 21.708514522
2024-09-12_12:00:13.16912 servo probe ('/dev/ttyAMA0', 38400) 21.767782647
2024-09-12_12:00:13.20288 server/client is running too _slowly_ 0.09283411399999864
2024-09-12_12:00:13.64375 load file /home/tc/.pypilot/pypilot.conf
2024-09-12_12:00:13.64920 store_file /home/tc/.pypilot/pypilot.conf.bak 22.248 False
2024-09-12_12:00:13.65090 server setup has 6 pipes
2024-09-12_12:00:13.75365 imu rate set to rate 20
2024-09-12_12:00:13.76756 too long write pipe 0.08467674255371094 pypilotServer pipe0[1] 18
2024-09-12_12:00:13.90313 setting initial gyro bias [-0.5, -1.52, 0.42]
2024-09-12_12:00:13.95653 server add socket ('127.0.0.1', 54054)
2024-09-12_12:00:13.95855 imu rate set to rate 20
2024-09-12_12:00:14.58824 server add socket ('127.0.0.1', 54056)
2024-09-12_12:00:15.07492 gpsd failed to connect
2024-09-12_12:00:15.29225 zeroconf addresses ['127.0.0.1'] 1
2024-09-12_12:00:16.96262 Failed to open SPI bus 0, select 0
2024-09-12_12:00:17.03384 failed import calibration fit No module named 'numpy'
2024-09-12_12:00:17.30198 server/client is running too _slowly_ 0.08050005200000143
2024-09-12_12:00:18.66208 servo probe ('/dev/ttyAMA0', 38400) 27.260760249
2024-09-12_12:00:18.66395 server/client is running too _slowly_ 0.5420703640000006
2024-09-12_12:00:19.07145 signalk process 2317
2024-09-12_12:00:19.17373 signalkread token �������������������������������������������������������������������������������������������������������������������������������������������������������������������������
2024-09-12_12:00:22.71405 server/client is running too _slowly_ 0.08789192700000115
2024-09-12_12:00:22.83801 servo probe ('/dev/ttyAMA0', 38400) 31.436715039
2024-09-12_12:00:26.96179 server/client is running too _slowly_ 0.0789689590000009
2024-09-12_12:00:28.07884 servo probe ('/dev/ttyAMA0', 38400) 36.677518058
2024-09-12_12:00:33.18243 servo probe ('/dev/ttyAMA0', 38400) 41.781075139
2024-09-12_12:00:37.41395 servo probe ('/dev/ttyAMA0', 38400) 46.012668054
2024-09-12_12:00:42.58297 servo probe ('/dev/ttyAMA0', 38400) 51.181652115
2024-09-12_12:00:46.68170 server/client is running too _slowly_ 0.07726984399999992
2024-09-12_12:00:47.10094 failed import calibration fit No module named 'numpy'
2024-09-12_12:00:47.10529 gpsd connected
2024-09-12_12:00:47.17287 GPSD devices []
2024-09-12_12:00:47.66146 servo probe ('/dev/ttyAMA0', 38400) 56.260172426
2024-09-12_12:00:51.73170 server/client is running too _slowly_ 0.07537989600000117


Any help would be appreciated.
Thank you.
This 3.3V powered IMU is compatible with the Pi Zero.

There's no explanation other than an IMU malfunction.
The Amazon photo shows that the pin soldering isn't very good. Dry soldering could explain the malfunction. You'll need to resolder the four pins to the Pi.
Thanks Jean-Marc for your reply.
I have verified the connections, and the soldering on my IMU look much better than the picture on Amazon.  Still no results on the Pi Zero W2.
So I have now installed pypilot on a different Pi Zero W (different image 2024_07_17.img) and can connect to the browser interface (192.168.14.1).  I bought a different IMU (MPU-9250/6500) from a different supplier on Amazon.  I am still unable to get any sensor information.  Obviously I am missing something.
Where in the web interface can I verify that pypiloy sees the IMU?  In the 'pypilot client' I see IMU_UPTIME 0s, and IMU_ACCEL and COMPASS, PITCH, ROLL, etc... are all FALSE. The calibration plot does not change and calibration age never resets from power up.
Do I need to be moving a certain speed to get measurements?  I have tried driving around in the car for 5 mins with the pypilot and I still did not get any calibration info.
Thank you for any help or suggestions.
Is your assembly consistent with what is indicated in this linked diagram?

https://navitop.fr/data/files/logo/pypil...implec.pdf
(2025-06-30, 05:28 PM)Jean-Marc Douroux Wrote: [ -> ]Yes. That is the diagram I have been using.
Photo hopefully attached.




Is your assembly consistent with what is indicated in this linked diagram?

https://navitop.fr/data/files/logo/pypil...implec.pdf
I have now connected both IMUs that I bought from Amazon to an Arduino and used a "Who Am I" sketch. They both reported back that they are in fact MPU6500 chips that do NOT have magnometers. The writing on the chip says MP92 which should be a MPU92** but I am unable to get any magnometer data from these chips. I am able (using the Arduino UNO) to get acceleration, gyro, and temp data on 0x68 i2c. So I still don't understand why I am unable to get at least the accel data on the Pypilot.
I guess I will have to buy a different style IMU that is supported by Pypilot and go from there.
Silver lining is I am learning more than I had intended about micro-controllers.
Cheers.
TDK's ICM20948 IMU integrated circuits are of much higher quality than older IMUs. To be compatible with the Pi, you need a module with a 1.8V regulator and components to adapt the levels, such as the ICM20948V2 or GY-ICM20948V2.

In addition, the tinypilot image is now configured for this IMU.
It should automatically detect and work with either type of imu as well as others, but icm20948 is recommended.