2021-06-09 03:20 AM
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.
Solved! Go to Solution.
2021-06-15 07:03 AM
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.
2021-06-11 08:44 AM
Any suggestions?
2021-06-14 06:38 AM
???
2021-06-15 03:11 AM
Can somebody answer ?
2021-06-15 06:27 AM
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
2021-06-15 06:30 AM
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?
2021-06-15 07:03 AM
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.