No measurements provided by magnetometer

Hello everyone,

I am facing difficulties with using the measurements by the magnetometer. When the Navio2 module boots, for the first time I try to read the magnetometer, everything works but after the first time, usually, it is not possible to get any more measurements. The magnetometer only returns 0 values for al 3 axes. I have read another topic, where it is stated that this is probably caused by a driver issue and it was not supported back then.

Since some time has passed, I am wondering if there is a fix around this issue because everything I tried doesn’t seem to work. I have to reboot Navio2 to get the magnetometer to function properly again, yet this is not a solution to the problem.

Looking forward to receiving any feedback!

Teo,

Do you mean this post?

Reach module and Navio 2 have different components and images so it could be a different issue.

  • Can you provide me with a screenshot of how the issue looks to you? Do you use our scripts for data stream?
  • Do you use the MPU9250 or LSM9DS1?
  • How do you calibrate the magnetometers?

Yes, I mean this post. Regarding the screenshot, I do not have anything to provide since I call the function to read the magnetometer data and a 3x1 vector is returned containing zeros values, i.e., m9m = [0.0, 0.0, 0.0]. This happens when I use your scripts to obtain measurements but also scripts that I have written but entirely based on the your scripts use the magnetometer.

I am using the MPU9250 magnetometer since you do not provide the Python drivers for the LSM9DS1. I hope this changes soon since I can’t really understand why you provide your customers only with the Python drivers for MPU9250 and not for both IMUs as it is the case for C++.

In terms of the magnetometer calibration. I have tried and calculated the two matrices corresponding to the hard- and iron-distortion but the issue continues to exist. I don’t think that this is a calibration issue because zero values are returned when the registers are “read”.

Teo,

  • Does the unit behave the same way outside?
  • What happens with the accelerometer and gyroscope data?
  • Do I understand correctly that the magnetometer returns correct data only once? Or does it stop after some time?
  • I have not tested the unit outside. Will do and provide the results.
  • Accelerometer and gyroscope data are entirely fine. There is not any problem with these sensors.
  • The magnetometer returns correct data only the first time I execute some code and for the entire execution. As soon as the first execution is finished, then the second time I execute the same script, a zero vector is returned as the magnetometer measurement.

Teo,

Have you tried to run Ardupilot? Do you see any errors when connecting to the GCS? Please share a screenshot if you do.

Hello,

I have not tried Ardupilot but I don’t think that this is the problem. The magnetometer should work fine provided that I run the examples by Emlid. I wrote some code to be able and run C++ from Python and the problem related to the magnetometer does not appear in the case of LSM9DS1. It seems to work fine in terms of measurements collection. The problem only exists when I select the MPU9250 IMU for usage.

Teo,

As further steps require sensitive information, I’ve sent you a PM.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.