cancel
Showing results for 
Search instead for 
Did you mean: 

IIS2MDC is it need to calibrate and how to calculate angle from raw data of the sensor?

MKla.1
Associate III

Hi.

When i power my board and everything else i configure sensor in continous mode and succesfully getting data for each axis. Board is parallalel to the floor then it means that for getting angle i need sensor data from x axis and from y axis.

I tried with https:// blog.digilentinc.com/how-to-convert-magnetometer-data-into-compass-heading/ this approuch only difference is that i multiply data from axis with 1.5 ( i had read in aplication note that this is sensor constant to get mG) and for sensor in given web site is 0.48828125.

I want to ask is it needed to calibrate sensor every time when you power you entire board ( MCU and IIS2MDC) ?

Is that formula from given website good or not? Because i dont get good data when i compare with compass value from my smartphone even if i add declination angle for my geographical location to the calculated angle value which i got from the sensor.

1 ACCEPTED SOLUTION

Accepted Solutions

Please as I said, read this : https://arduino.stackexchange.com/questions/18625/converting-three-axis-magnetometer-to-degrees.

There is not One formulas. There are several. It is depending the accuracy you want / need. Check with google : you can go from the simplest algo of Arduino to the hardest with integration, matrix and so on.

Yes you will have to rotate the sensor like on smartphone, maybe several time to have something. If the values you get are not almost "perfect", the angle will be completly wrong.

You can also read this paper : https://core.ac.uk/download/pdf/289945119.pdf.

View solution in original post

6 REPLIES 6
MKla.1
Associate III

Any suggestions?

MKla.1
Associate III

???

MKla.1
Associate III

Can somebody answer ?

SimonF
Senior

Hello @Community member​ ,

Your questions are not really clear.

Yes you have to multiply data with 1.5. You should always prefer follow the application note of ST instead of following tutorial in which not explained values are used.

You need to read more about hard-iron, soft-iron and offset calibration. For the hard-iron effect you don't need to redo the calibration at every reset if you keep the values you calculated. The soft-iron effect is a bit different. I suggest you to read more to understand every concept.

You can also re-read my post it can give you some hints.

Good luck.

Simon

MKla.1
Associate III

But which formula is ok for getting angle from mG values which you get from the sensor?

Also is it need to rotate sensor like on smartphone to make calibration?

Please as I said, read this : https://arduino.stackexchange.com/questions/18625/converting-three-axis-magnetometer-to-degrees.

There is not One formulas. There are several. It is depending the accuracy you want / need. Check with google : you can go from the simplest algo of Arduino to the hardest with integration, matrix and so on.

Yes you will have to rotate the sensor like on smartphone, maybe several time to have something. If the values you get are not almost "perfect", the angle will be completly wrong.

You can also read this paper : https://core.ac.uk/download/pdf/289945119.pdf.