kriswiner / MPU6050

Basic MPU6050 Arduino sketch of sensor function
724 stars 190 forks source link

Magnetometer raw data issue #18

Open proba238 opened 7 years ago

proba238 commented 7 years ago

Hello, in first place I want to thank you for the amazing work about MPU9250. Even though I’m a student I have very little practical knowledge about sensor fusion (new to the topic), so having a guide like yours means a lot, a ton!

And now about the problem, ill tri to be as simple as possible. So I hooked up my MPU9250, setu up the communication and so on… I can easly access the raw data registers from AK8963. The problem is the measurement. In your article “Simple and Effective Magnetometer Calibration” ,the first picture shows raw data from AKA8963, The blue marks indicates the change in magnetic field along the xy plane.

I rotated the module for 360 degrees in the xy plane and my measurements of the magnetic field along the plane, with the z pointing to ground shows this:

proba

(The transition from nord to east is shown by the red rhomb)

Could you give me an opinion about what the problem might be, and how to fix it?

kriswiner commented 7 years ago

Can you say what the problem is?

On Thu, Aug 24, 2017 at 6:09 AM, proba238 notifications@github.com wrote:

Hello, in first place I want to thank you for the amazing work about MPU9250. Even dough I’m a student I have very little practical knowledge about sensor fusion (new to the topic), so having a guide like yours means a lot, a ton!

And now about the problem, ill tri to be as simple as possible. So I hooked up my MPU9250, setu up the communication and so on… I can easly access the raw data registers from AK8963. The problem is the measurement. In your article “Simple and Effective Magnetometer Calibration” ,the first picture shows raw data from AKA8963, The blue marks indicates the change in magnetic field along the xy plane.

I rotated the module for 360 degrees in the xy plane and my measurements of the magnetic field along the plane, with the z pointing to ground shows this:

[image: proba] https://user-images.githubusercontent.com/31312408/29667509-f7e7f8c4-88dc-11e7-8595-275c6586027d.jpg

(The transition from nord to east is shown by the red rhomb)

Could you give me an opinion about what the problem might be, and how to fix it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU6050/issues/18, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qgno9uzsBlTjmvE8e5fg4D-VY1dmks5sbXX2gaJpZM4PBWur .

proba238 commented 7 years ago

Hello, and thank you for the quick response!

Well the problem is that I cant use the given magnetic field measurement in the xy to get any reasonable data outcome. If the data would be distributed in a say…circle form as it is the case in :

https://cloud.githubusercontent.com/assets/6698410/8768651/04fe05be-2e3d-11e5-9f70-b6897fdca9ca.jpg

Then I could use a function as tan or tan2 to get the approximate heading where the field is pointing. Of course I tried to calibrate the sensor as explained in your work but, still. I mean, calibrating just shift the measurement so that the long term run, mean is always at 0,0. It seems to me that I should use some form of whited function to calibrate the sensor, a PID or something, in order to scale the measurement to the proper level.

kriswiner commented 7 years ago

Not sure what to tell you. Try moving the sensor all around in 3D and then plotting Mx vs My, Mx vs. Mz and My vs Mz, you should get circular clouds of points.

On Thu, Aug 24, 2017 at 10:31 AM, proba238 notifications@github.com wrote:

Hello, and thank you for the quick response!

Well the problem is that I cant use the given magnetic field measurement in the xy to get any reasonable data outcome. If the data would be distributed in a say…circle form as it is the case in :

https://cloud.githubusercontent.com/assets/6698410/8768651/04fe05be-2e3d- 11e5-9f70-b6897fdca9ca.jpg

Then I could use a function as tan or tan2 to get the approximate heading where the field is pointing. Of course I tried to calibrate the sensor as explained in your work but, still. I mean, calibrating just shift the measurement so that the long term run, mean is always at 0,0. It seems to me that I should use some form of whited function to calibrate the sensor, a PID or something, in order to scale the measurement to the proper level.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU6050/issues/18#issuecomment-324703387, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qmXvH98SWjbqUaxGGTTHSlLN-hK2ks5sbbNqgaJpZM4PBWur .

proba238 commented 7 years ago

All right, ill keep trying till I get them right. Thanks for the effort! 👍

arkwad commented 7 years ago

@proba238 Any progress?

dungtam73 commented 6 years ago

I have the same problem. I get data from CC2650 to my android phone using formula at http://processors.wiki.ti.com/index.php/CC2650_SensorTag_User%27s_Guide#Movement_Sensor

My decode function:

Scatter chart:

@kriswiner I waved my sensor in figure 8 motion but result was not expected. Could you help me ? @proba238 did you resolve this problem ?

kriswiner commented 6 years ago

Are you moving the sensor in all 3D directions? Rotating to sample the entire response surface?

On Mon, Mar 19, 2018 at 12:00 AM, dungtam73 notifications@github.com wrote:

I have the same problem. I get data from CC2650 to my android phone using formula at http://processors.wiki.ti.com/index.php/CC2650_SensorTag_ User%27s_Guide#Movement_Sensor http://url

My decode function: [IMG]https://i.imgur.com/6u4jjw8.jpg[/IMG]

Scatter chart: [IMG]https://i.imgur.com/1bpwqMZ.jpg[/IMG]

@proba238 https://github.com/proba238 did you resolve this problem ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU6050/issues/18#issuecomment-374118029, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qs9lwAJEHFuNj3RJaTAFg7W9KUkMks5tf1d-gaJpZM4PBWur .

dungtam73 commented 6 years ago

@kriswiner I tried again in all 3D directions. Here is result

kriswiner commented 6 years ago

Well you have a lot of offset bias that needs to be corrected.

On Mon, Mar 19, 2018 at 9:28 AM, dungtam73 notifications@github.com wrote:

@kriswiner https://github.com/kriswiner I tried again in all 3D directions. Here is result

https://camo.githubusercontent.com/c9788f462a085ba6799c1314eb0198b4e050321f/68747470733a2f2f692e696d6775722e636f6d2f4636564c5579792e6a7067

https://camo.githubusercontent.com/ebb732da2ee26540e5417640585a4fa542d03f3b/68747470733a2f2f692e696d6775722e636f6d2f30464863665a6b2e6a7067

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU6050/issues/18#issuecomment-374274812, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qn_ESF33yJF79Wo9OZmd5l8u5Gcjks5tf9yggaJpZM4PBWur .

dungtam73 commented 6 years ago

Thank you so much! What can I do to get circular clouds of points like you ?

kriswiner commented 6 years ago

Well, you need to correct the offset biases, rescaling the axes would help also.

What I do is move the sensor in all directions. Imagine there is an arrow pointing from the top of the device. During calibration, you want to move the device such that the tip of the arrow points to every point on an imaginary sphere surrounding the sensor, multiple times if possible. Slow and steady. This should give you ellipses. Correcting for offset biases and axis skew should give you more or less spheres.

See: https://github.com/kriswiner/MPU6050/wiki/Simple-and-Effective-Magnetometer-Calibration

On Mon, Mar 19, 2018 at 9:50 AM, dungtam73 notifications@github.com wrote:

Thank you so much! What can I do to get circular clouds of points like you ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU6050/issues/18#issuecomment-374283267, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qiauHPp1__h9rABtVnbQy6ocoQqCks5tf-G6gaJpZM4PBWur .