-
-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Describe the bug
The readings from the board are changing dramatically whilst the board is completely still.
Hello :)
I recently aquired the MPU9250 as an upgrade to get the magnetometer to be able to read the heading.
Whilst looking for a library, this one seemed to be by far the most solid in docs and examples.
So unless I am a complete dummy (which is possible) something seems wrong with the readings I am getting.
|.....MPU9250 in 0x68 Address.....|
Accelerometer [-0.19921875, -1.550048828125, -7.0]
Gyroscope [-0.0682830810546875, -0.15316009521484353, 0.21915435791015614]
Magnetometer [-0.2911545341232835, 0.2014987670749353, 1.4122445841195845]
Temperature 28.475963698445504
145.31412714135627
[1 sec later]
|.....MPU9250 in 0x68 Address.....|
Accelerometer [-0.197265625, -1.538330078125, -7.0]
Gyroscope [0.0537872314453125, -0.06160736083984353, -0.11653900146484386]
Magnetometer [-0.2911545341232835, 1.4104913695245713, 1.0356460283543585]
Temperature 28.284272321562284
101.66321840226273
Because it is not moving, the accelerometer seems to be rather stable.
The gyro and the magnetometer though are behaving as if there was movement.
I do not have another MPU9250 to compare this to.
Any good guess on what might be going on / what I am doing wrong ?
Many thanks,
To Reproduce
import time
import math
from mpu9250_jmdev.registers import *
from mpu9250_jmdev.mpu_9250 import MPU9250
mpu = MPU9250(
address_ak=AK8963_ADDRESS,
address_mpu_master=MPU9050_ADDRESS_69,
address_mpu_slave=None,
bus=1,
gfs=GFS_1000,
afs=AFS_8G,
mfs=AK8963_BIT_16,
mode=AK8963_MODE_C100HZ,
)
mpu.configure()
mpu.calibrate()
while True:
print("|.....MPU9250 in 0x68 Address.....|")
print("Accelerometer", mpu.readAccelerometerMaster())
print("Gyroscope", mpu.readGyroscopeMaster())
print("Magnetometer", mpu.readMagnetometerMaster())
print("Temperature", mpu.readTemperatureMaster())
magnet = mpu.readMagnetometerMaster()
print(90 - math.atan2(magnet[0], magnet[1]) * 180 / math.pi)
time.sleep(1)Expected behavior
Expecting the values to be constant when the module is not moving at all
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- RaspberryPI (raspbian)
- Python3.7