AK8963C module XYZ calibration by MAGMASTER

Thread Starter

camerart

Joined Feb 25, 2013
3,736
Hi,
I'm programming a PIC 18L4620 with a compass module AK8963C using Oshonsoft (BASIC)

I have the PIC READing the module and outputting serial DATA. (see txt)

I have programs Magmaster and Magmaster viewer, which both use this DATA to give a calibration calculation and 3D rendering, which are valuable for visualising the DATA.
https://diydrones.com/profiles/blog...oft-iron-magnetometer-calibration-for-dummies

I think Magmaster uses 'twos compliment' DATA and calculates the results.

As Oshonsoft doesn't use negative numbers, I'm not sure how to get it to output the DATA READings correctly.

Can anyone help please?

Camerart.
 

Attachments

ericgibbs

Joined Jan 29, 2010
19,118
hi C,
Post a few sample values of the readings from the compass and what you would expect the converted value to be.
E
 

jjw

Joined Dec 24, 2013
823
Hi,
I'm programming a PIC 18L4620 with a compass module AK8963C using Oshonsoft (BASIC)

I have the PIC READing the module and outputting serial DATA. (see txt)

I have programs Magmaster and Magmaster viewer, which both use this DATA to give a calibration calculation and 3D rendering, which are valuable for visualising the DATA.
https://diydrones.com/profiles/blog...oft-iron-magnetometer-calibration-for-dummies

I think Magmaster uses 'twos compliment' DATA and calculates the results.

As Oshonsoft doesn't use negative numbers, I'm not sure how to get it to output the DATA READings correctly.

Can anyone help please?

Camerart.
Without having the program, I think Magmaster uses signed integer values, so you should first convert the values Xhighbyte, Xlowbyte... Yhigh etc which are 16bit twos complement numbers to signed integers, for example 615, - 421 etc for all 12 positions of the sensor ( see pictures 8 and 9) and feed them manually to Magmaster.
Magmaster then calculates the calibration values
m11, m12, ... m33 and Bx, By, Bz
 

jjw

Joined Dec 24, 2013
823
The Magmaster files contain Arduino serial interface code to interface to Magmaster?
Can you upload it here?
It might help to understand what kind of format is needed or is there a Magmaster manual in the files?
 

Thread Starter

camerart

Joined Feb 25, 2013
3,736
hi C,
Post a few sample values of the readings from the compass and what you would expect the converted value to be.
E
Hi E,
I've set the HSEROUT of the Compass DATA in the format: HERE

Examples shown in #1

Here is a 360 compass rotation (by hand) in the Magviewer directly from HSEROUT

Note no negative values, so DOTs stay in the top right quadrant. If I add negatives (
Hserout #x1, ",", "-", #y1, ",", #z1, CrLf) then the DOTs cross the line.

I haven't got used to the [program yet, but the result will give me 3x bias correction number to add into the compass directory, so that all of the circles are concentric about each axis.

C
 

Attachments

Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,736
Without having the program, I think Magmaster uses signed integer values, so you should first convert the values Xhighbyte, Xlowbyte... Yhigh etc which are 16bit twos complement numbers to signed integers, for example 615, - 421 etc for all 12 positions of the sensor ( see pictures 8 and 9) and feed them manually to Magmaster.
Magmaster then calculates the calibration values
m11, m12, ... m33 and Bx, By, Bz
Hi J,
I presume you mean random numbers to show the result?? If so here's one:
C.
 

Attachments

Thread Starter

camerart

Joined Feb 25, 2013
3,736
The Magmaster files contain Arduino serial interface code to interface to Magmaster?
Can you upload it here?
It might help to understand what kind of format is needed or is there a Magmaster manual in the files?
Hi again J,
Here is what I think you're after:

If not ask again.

C.
 

Attachments

jjw

Joined Dec 24, 2013
823
Hi again J,
Here is what I think you're after:

If not ask again.

C.
This is the code to calculate the calibrated values , but
I am after the Arduino code to send serial data to Magmaster, if such code exists in the downloaded files.
 

jjw

Joined Dec 24, 2013
823
Hi E,
I've set the HSEROUT of the Compass DATA in the format: HERE

Examples shown in #1

Here is a 360 compass rotation (by hand) in the Magviewer directly from HSEROUT

Note no negative values, so DOTs stay in the top right quadrant. If I add negatives (
Hserout #x1, ",", "-", #y1, ",", #z1, CrLf) then the DOTs cross the line.

I haven't got used to the [program yet, but the result will give me 3x bias correction number to add into the compass directory, so that all of the circles are concentric about each axis.

C
Ok, I understand now.
You try to convert the data from Xlowbyte, Xhighbyte ...
( twos complement) to floating point to - > string and send the string via serial port to Magmaster.
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,736
I write here with a tablet and I don't want to open huge zip-files. It is 180MB when opened.
Maybe the Arduino serial code is not needed, because Oshonsoft code should be quite straightforward.
Hi J,
OK, that's good.
180MB, someone's been busy!
C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,736
Hi,
I'm now getting good results from the compass module (AK8963C) and trying to find out how to set the ASAX-Y-Z settings, to centralise it.

While playing with the module while watching the results using a visualiser, so I can see a circle of DOTs while turning the module round.

This gave me an idea!!! This module is part of a project I'm working on, which will need a rotary encoder. I wondered if I cold use a compass module, with a rotating piece of iron, or a magnet to get 360Degrees of DATA to input into the rotation section of the projet?

Camerart.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,736

jpanhalt

Joined Jan 18, 2008
11,087
I made this little gadget about 3 years ago. PCB was Oshpark, connector is real tiny. Was built to mount on my tractor FEL.
That 14-bit resolution is quite neat and positions are reproducible. There is an evaluation module made of plastic with a knob. That wiggles a little. Mine is mounted in a ball bearing and doesn't wiggle. The aluminum cylinder is abut 2" in diameter. The magnet (about 6 mm diameter) is mounted in the center of the top portion and surrounded by the ball bearing.

upload_2018-11-14_15-55-43.png
 

Thread Starter

camerart

Joined Feb 25, 2013
3,736
I made this little gadget about 3 years ago. PCB was Oshpark, connector is real tiny. Was built to mount on my tractor FEL.
That 14-bit resolution is quite neat and positions are reproducible. There is an evaluation module made of plastic with a knob. That wiggles a little. Mine is mounted in a ball bearing and doesn't wiggle. The aluminum cylinder is abut 2" in diameter. The magnet (about 6 mm diameter) is mounted in the center of the top portion and surrounded by the ball bearing.

View attachment 163825
Hi J,
Does your tractor drive itself? Why add a compass? Is it for plowing a straight furrow?
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,736
Not yet. High end tractors pretty much drive themselves and use GPS.

That device used the magnetic rotary encoder, which was going to be mounted to a joint in the front end loader (FEL) to transmit position .
Hi J,
Ok.
As mine will be fitted inside a transmitter, I'd better make it smaller:)
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,736
Hi,
Looking at the ASA sensitivity adjustment value section of the D/S and FUSE, but it isn't easy to follow.

Can someone explain how to calibrate the AK8963C module please? I see that the ASA registers are READ only, so is a figure multiplied by the X and Y and Z RAW READings to correct errors?
C.
 
Top