New to Pico… be gentle.
Purchased Rasberry Pi Pico 2020 with stackable headers and a Waveshare Pico-10DOF-IMU Rev2.1 (ICM20948 version).
Downloaded the MicroPython UF2 (rp2-pico-20230426-v1.20.0.uf2) to the board.
Ran a basic Blink test on the board – was OK.
Followed the Waveshare Wiki
Connected the Pico-10DOF-IMU.
Downloaded the Demo code.
Saved the icm20948.py to the Rasberry Pi Pico board as main.py.
Pointed the board North in a stationary position.
Ran the Pico
Received a “ZeroDivisionError: divide by zero” in line 309.
This line does a 1 / (axax + ayay +az*az)
Where ax,ay and az are read accelerometer values.
I place the following over the impacted code:
if not (ax == 0 and ay == 0 and az == 0):
At this point I’m surprised the basic test code fails, even though the board is stationary. I expected accelerometer values ~0 with -1 g in the z axis.
The code runs with the following:
Roll= 40.37, Pitch= 15.94, Yaw= -131.82 (floating with variation of about 20-30 each)
Acceleration XYZ: all zero
Gyroscope XYZ: all zero
Magnetic XYZ: 26372, -14580, -21567 (These appear to float between +/- 32000)
At this point I’m thinking the Pico-10DOF-IMU is stuffed.
The ICM20948 data sheet discusses Power Modes (pg 26)
I want 9-Axis Mode: Mode = 8
I would assume the test software is configured for this.
Code lines 132 & 134 (ICM20948.py) set PWR_MGMT_1 – Data Sheet (pg 32 & pg 37)
Line 132 seems to do a reset 0x80.
Line 134 seems to set 0x01
At this point I am out of my depth because the config looks wrong to me but am too much of a noob to get it going without working code to adapt.
Time to try a new approach so I load the Ips22hbtr.py to check the barometer and temp thinking this may be easier to validate.
Takes a few seconds for the barometer to stabilise but then provides solid output:
Pressure = 948.11 hPa , Temperature = 21.99 °C
When I check onlne, the local pressure is reportedly 1021.8 hPa. Room temp is about 16 degrees.