Twos compliment in Oshonsoft and Compass calibration

Status
Not open for further replies.
I made a mistake, sorry.
I was looking about taking absolute value of 16bit word in 2's complement

In the conversions there should be:

Xsing = Xsing - 65536 instead of 65536 - Xsing
Ysing = Ysing - 65536
Zsing = Zsing - 65536


Now the first row becomes: - 89, 51, - 238
the last: - 71, 55, - 97
 
Last edited:
Hi J,
New 360 CW + CNTL1
Now got to put the result in the correct format.
C
 

Attachments

  • 360 + CNTL1.txt
    1.9 KB · Views: 228
Hi J and M,
Success!!
Here's a Magviewer view, showing a circle.
Next figure out how to change the BIAS setting to centralise it.
Thanks to all, for your time and patience.
C.
 

Attachments

  • Magviewer.jpg
    48.3 KB · Views: 228
Hi,
Orienting the compass module in Magmaster needs a bit of practice (For me anyway) Here is my first result, does it look ok?
C
 

Attachments

  • Magmaster 1.jpg
    147.3 KB · Views: 241
Hi,
Orienting the compass module in Magmaster needs a bit of practice (For me anyway) Here is my first result, does it look ok?
C
Are these the raw values?
Did you input them manually?
From the d/s and from the previous msg #82, values of Z should be always negative ( if raw values )
I guess that the coefficients, which Magmaster calculates, M11, M22, M33 should be near 1 and the others near 0.
 
Last edited:

Hi J,
I'm using Magmaster and the instructions (See #50 link)
I tried again and the results are similar.
My set-up doesn't allow the box type arrangement as instructed, so I'm orientating the PCB/Battery/compass by hand.
Post #82 shows a 360 Deg horizontal revolution.
C.
 
Are the values in the Magmaster window the raw values from the sensor, after converting from 2's complement ?
Are you sure that the 12 orientations which Magmaster needs, are correct?
 
Are the values in the Magmaster window the raw values from the sensor, after converting from 2's complement ?
Are you sure that the 12 orientations which Magmaster needs, are correct?
Hi J,
Here is an output TXT, as sent to Magmaster from a Terminal instead, while moving in all orientations.
I think the orientations are correct in #84, but more practice and checking should confirm this.
C.
 

Attachments

  • Magmaster while all orientations.txt
    2.5 KB · Views: 231
Hi J,
Here is an output TXT, as sent to Magmaster from a Terminal instead, while moving in all orientations.
I think the orientations are correct in #84, but more practice and checking should confirm this.
C.
Where did you get the output txt in Magmaster window
msg # 84?
The first row, X+ point 0° has value - 299
The second, X+ point 180° has value - 317
In msg #82 ( rotated horisontally) the lowest value of X is - 183. There is 73% difference??
 
Why you then used different format in Magmaster msg #84?
The first X+ is - 299. Did you calculate it manually and how?
The compass program gives xxx. 00 and much smaller absolute values.
 
Where did you get the output txt in Magmaster window
msg # 84?
The first row, X+ point 0° has value - 299
The second, X+ point 180° has value - 317
In msg #82 ( rotated horizontally) the lowest value of X is - 183. There is 73% difference??
Hi J,
Here is a Terminal READout and a Magmaster.
C
 

Attachments

  • Magmaster 121018.jpg
    152.6 KB · Views: 217
  • 360CW 121018.txt
    1.9 KB · Views: 214
I have asked four times how these values are generated, because they are different from sensors floating point values
You say they are readouts from terminal.
- how terminal got them?
- are they somehow made from sensor data?
 
Last edited:
I have asked four times how these values are generated, because they are different from sensors floating point values
You say they are readouts from terminal.
- how terminal got them?
- are they somehow made from sensor data?
Hi J,
Sorry! I thought I'd answered everything.

You will recall, that we've just changed the program, (Big/little endian....getting the READings in the correct order etc)
I'm sure you know, that the PIC READs the compass module, then outputs DATA with a HSEROUT, that SENDS DATA via a USB/serial board and an HC-12 radio module.

The computer also has an HC-12/Serial/USB, as connection input. The input DATA can be READ using either a Terminal (Termite)(TXT) or the Magviewer or the Magmaster, all using LIVE DATA from the PIC output.

Using the attached 'Magmaster matrix': Hold the Compass module in the ORIENTATION as each of the 12x positions. At each position, press the Magmaster 12x POINTX BUTTON. This enters the DATA into the program, as the results in #93 (Latest with this program)
Latest program here:

C.
 

Attachments

  • 18LF4520 8Mhz HC-12 AK8963 101118 1300 Magmaster.bas
    10.2 KB · Views: 218
  • ORIENTATION MATRIX.png
    347.5 KB · Views: 222
Last edited:
Hi,
I'm still stuck!

I've now made a box, as instructions, which helps me carry out tests more consistently.

Here is a Magmaster matrix and the 'how to use the results' box.

How are the calculations done? Is this one calculation or three separate ones?

C.
 

Attachments

  • Magmaster 4 211118.jpg
    151.2 KB · Views: 211
  • matrix.PNG
    29.4 KB · Views: 220
  • Examples.jpg
    81.2 KB · Views: 213
1. Subtract the bias values from uncalibrated values Xnc, Ync, Znc
( floating point values after converting from 2's complement 16bit integer)

X0 = Xnc-Bx
Yo = Ync-By
Z0 = Znc-Bz

2. Multiply these with the matrix M11... M33:

Xc = M11*X0 + M12*Y0 + M13*Z0
Yc = M21*X0 + M22*Y0 + M23*Z0
Zc = M31*X0 + M32*Y0 + M33*Z0

Xc, Yc, Zc are the calibrated values.
 
Hi J,
Thanks, I'll try to WRITE it into the program.
C
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…