Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Using MAGMASTER to get compass calibration settings.

Status
Not open for further replies.

camerart

Well-Known Member
Hi,
I use AK8963C Compass chips, for projects. These each need calibration values, that are used in programs.

I asked a similar question quite a while back, and didn't realise that the answers I followed led me in a the wrong direction. The previous results gave me a way of calculating a result, but not byusing the BOX as seen in this link: https://www.instructables.com/id/Easy-hard-and-soft-iron-magnetometer-calibration/

I got this working previously, and here is 1/ result for 1/ chip:
b_x = 158.968 '(1)
b_y = 90.098
b_z = -312.183
m11 = 1.719
m12 = -0.016
m13 = -0.008
m21 = -0.047
m22 = 1.771
m23 = 0.012
m31 = -0.043
m32 = 0.038
m33 = 1.727
________________________________________________________
Here is a program, that I use that I'm sure worked before, but it's possible that something happened in between?

In this program, there are some parts commented out (') I don't think they are necessary, only left from other programs.

Here is an image from the MAGVIEWER that shows dots top right quadrant, and on the top left 3x sets of BYTES are shown. The second byte always shows '0' I've tried changing to HB befor LB, but the '0' is still ot there.
Does any one have any ideas, for me to test the MAGMASTER and VIEWER, please
Cheers, Camerart.
 

Attachments

  • 18LF4520 32Mhz HC12 AK8963 AVE 280419 1300.bas.txt
    7.5 KB · Views: 266
  • Magviewer.jpg
    Magviewer.jpg
    37.8 KB · Views: 262
This program is some crippled version.
I found a later version 13.11.2019 and it is totally different.

xyz values:
x_raw.HB = b(0)
x_raw.LB = b(1)
y_raw.HB = b(2)
y_raw.LB = b(3)
z_raw.HB = b(4)
z_raw.LB = b(5)
are in wrong order.

Should be:
x_raw.LB = b(0)
x_raw.HB = b(1)
etc.
The program should calculate 2's complement values from x,y,z converted to floating point and you put the values into magmaster calculated from different compass orientations.
 
This program is some crippled version.
I found a later version 13.11.2019 and it is totally different.

xyz values:
x_raw.HB = b(0)
x_raw.LB = b(1)
y_raw.HB = b(2)
y_raw.LB = b(3)
z_raw.HB = b(4)
z_raw.LB = b(5)
are in wrong order.

Should be:
x_raw.LB = b(0)
x_raw.HB = b(1)
etc.
The program should calculate 2's complement values from x,y,z converted to floating point and you put the values into magmaster calculated from different compass orientations.
Hi J,
I noticed that the values are in the wrong, order, but I generally don't correct thinkgs without care.
I also noticed that there are some HOFL lines, that could be blocking it, as the HOFL line is not connected.

You got the original POST programs to work, but I was mixed up, by the results, as I tried to re-calibrate the modules, and think I now can see where I'm going wrong, thanks.
C.
 
Hi J,
I also found the 13.11.19 program, plus one a week later.

Looking at the instructions, here is an image: 'EXAMPLES'

To me it looks like there isn't a calculation apart from 2's compliment, (although there is no suggestion). It appears that, following the link in #1 the PIC1 shows the results of the magmaster after it has done the calc. Do you agree?

I tried joining each of the RAW DATA LB HB into WORDs, then 2's compliment them, here's the result in MAGVIEWER.

MAGMASTER starts then errors.
C.

Edited:
C
 

Attachments

  • Examples.jpg
    Examples.jpg
    81.2 KB · Views: 273
  • Magviewer.jpg
    Magviewer.jpg
    83.2 KB · Views: 271
Last edited:
I only know about the Magmaster, that you put manually the xyz values which you get from the compass at six different positions and then get a matrix (3×3) to correct the measured xyz values.
 
I only know about the Magmaster, that you put manually the xyz values which you get from the compass at six different positions and then get a matrix (3×3) to correct the measured xyz values.
Hi J,
I've got it working, and going through the program removing all that isn't needed, then I'll post it with explanation.
Thanks, C.
 
Hi J,
Magviewer is to give an idea whether the AK8963C Compass READings are central in 3D. It can be rotated to see all dinensions.

Magmasteris to calibrate BIAS DATA for each module , when using them within a program.
Here:
b_x = 158.968 '(1)
b_y = 90.098
b_z = -312.183
m11 = 1.719
m12 = -0.016
m13 = -0.008
m21 = -0.047
m22 = 1.771
m23 = 0.012
m31 = -0.043
m32 = 0.038
m33 = 1.727

In order to get these READings, the registers are READ in sequence.
Here is a program showing the output to suit Magmaster, with no other test Serial messages sent at the same time:
When Magmaster is working, set the compass module as the link in #1. there are 12x positions, and once settled at each position, press the relevant button on Magmaster, and the READings will be entered. Once all REAdings are entered, then press calculate and it will return the BIAS READings as above.
C
 

Attachments

  • 18F4520 INT8MHz HC12, AK8963C PCB3 MAGMASTER 290820.txt
    4.2 KB · Views: 255
  • MAGMASTER.jpg
    MAGMASTER.jpg
    124.8 KB · Views: 273
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top