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.

Averaging READings BYTEs etc

Status
Not open for further replies.
As oshonsoft doesn't have signed integers then you need to do something different. Midnight here now but I'll try and work something out tomorrow.

Mike.
Hi P,
Sleep well, but check in the morning, in case J's done it ok.
C
 
This topic seems to linger... With a certain periodicity with camerart
2016

2018

2020
This thread.
 
This topic seems to linger... With a certain periodicity with camerart
2016

2018

2020
This thread.
Hi G,
Like a goldfish in a big bowl. See you in 2023 :)

C
 
Dim Xavg as single
Dim Yavg ...
Dim Xavg ...
......

Xavg=0
Yavg=0
Xavg=0

For j=1 to 10 ' for example average of 10 readings
for I = 0 to 18
....

Next I

Xnc=
Ync=
Znc=

Xavg=Xavg+Xnc
Yavg=....
Xavg=....
Next j

Xavg=Xavg/10
Yavg = ...
Xavg= ....
Hi J,
Something like this?:
C.
 

Attachments

  • 18F4520 INT8MHz HC12, AK8963C PCB3 MAGMASTER 020920 AVE.txt
    4.7 KB · Views: 338
Move the 2's complement conversions.
Xnc=Xraw
Ync ...
Znc...

<--------- conversions here

Xavg=Xavg+Xnc
......
 
Move the 2's complement conversions.
Xnc=Xraw
Ync ...
Znc...

<--------- conversions here

Xavg=Xavg+Xnc
......
Hi J,
Is this correct?:
C
_________________________________________________
Ready!
AT+C002
1082730.12,-110.19,:827302.00
1082510.25,-121.71,:825103.00
1082293.50,-117.87,:822936.00
1082075.00,-125.98,:820750.00
1081853.00,-125.39,:818530.00
1081633.50,-123.93,:816336.00
1081413.25,-116.89,:814133.00
1081195.00,-123.88,:811951.00
1080976.25,-123.18,:809763.00
1080758.62,-116.31,:807587.00
1080539.87,-121.03,:805399.00
1080316.50,-122.30,:803165.00
1080101.87,-121.63,:801019.00
1079883.37,-126.66,:798834.00
1079662.50,-124.66,:796626.00
1079438.75,-119.26,:794388.00
1079219.25,-119.62,:792193.00
1079001.50,-124.56,:790015.00
1078782.00,-123.45,:787821.00
1078561.50,-120.14,:785615.00
1078343.87,-120.81,:783439.00
1078124.00,-123.48,:781241.00
1077904.00,-123.84,:779040.00
1077688.37,-121.58,:776884.00
1077470.25,-125.65,:774703.00
1077251.25,-118.36,:772513.00

_________________________________________________
 

Attachments

  • 18F4520 INT8MHz HC12, AK8963C PCB3 MAGMASTER 020920 AVE 1.txt
    4.7 KB · Views: 327
The values are too big.
Move
Xavg=0
Yavg=0
Zavg=0
Inside Main, before for j=1 to 10
Hi J,
Is this better?:
Search for WRONG in the program, oops.
As there's no time restriction, can we have more averages please? 'say' 30
C
________________________________________________________
___
[00]Ready!
AT+C002
-130.39,-116.79,-218.00
-136.00,-120.79,-222.79
-134.39,-113.19,-215.19
-136.39,-116.79,-220.79
-131.19,-114.39,-215.19
-133.19,-116.00,-214.39
-132.39,-116.00,-220.00
-130.39,-115.59,-213.59
-134.19,-115.00,-219.39
-130.39,-118.00,-217.59
-131.50,-112.50,-221.69
-129.39,-114.59,-219.59
-135.19,-111.59,-220.00
-133.19,-120.19,-224.19
-131.29,-114.29,-215.69
-133.39,-116.00,-214.00
-136.00,-117.39,-215.59
-133.50,-120.09,-212.50
-135.39,-108.39,-222.19
-135.29,-118.29,-215.50
-133.59,-114.79,-216.19
-130.69,-123.29,-220.89
-129.89,-112.09,-217.29
-127.50,-118.69,-221.09
-136.39,-116.59,-221.39
-128.19,-113.39,-220.79
-131.79,-109.59,-219.59

_____________________________________________________
 

Attachments

  • 18F4520 INT8MHz HC12, AK8963C PCB3 MAGMASTER 020920 AVE 2.txt
    4.8 KB · Views: 352
You can take as many averages as you wish.
Remember to divide by the number of loops
 
H
Hi J,
Is this better?:
Search for WRONG in the program, oops.
As there's no time restriction, can we have more averages please? 'say' 30
C
________________________________________________________
___
[00]Ready!
AT+C002
-130.39,-116.79,-218.00
-136.00,-120.79,-222.79
-134.39,-113.19,-215.19
-136.39,-116.79,-220.79
-131.19,-114.39,-215.19
-133.19,-116.00,-214.39
-132.39,-116.00,-220.00
-130.39,-115.59,-213.59
-134.19,-115.00,-219.39
-130.39,-118.00,-217.59
-131.50,-112.50,-221.69
-129.39,-114.59,-219.59
-135.19,-111.59,-220.00
-133.19,-120.19,-224.19
-131.29,-114.29,-215.69
-133.39,-116.00,-214.00
-136.00,-117.39,-215.59
-133.50,-120.09,-212.50
-135.39,-108.39,-222.19
-135.29,-118.29,-215.50
-133.59,-114.79,-216.19
-130.69,-123.29,-220.89
-129.89,-112.09,-217.29
-127.50,-118.69,-221.09
-136.39,-116.59,-221.39
-128.19,-113.39,-220.79
-131.79,-109.59,-219.59

_____________________________________________________
Hi J,
A much better average now, thanks.
C.
_____________________________________________
-135.79,-126.07,-221.50
-136.50,-124.60,-221.96
-136.52,-125.46,-224.34
-135.95,-126.37,-224.50
-137.25,-124.75,-223.12
-136.39,-125.09,-222.01
-136.48,-125.32,-223.04
-135.84,-124.28,-223.08
-136.63,-125.41,-223.33
-135.75,-126.08,-222.06
-135.76,-125.46,-222.00
-137.25,-124.68,-222.36
-136.33,-126.03,-221.61
-135.64,-127.18,-221.82
-137.23,-125.85,-222.75
-135.98,-126.34,-222.06
-137.10,-123.78,-222.56
-137.16,-125.52,-222.98
-136.19,-124.43,-223.11
-138.16,-123.66,-222.02
-136.10,-124.16,-222.82
-137.27,-125.79,-220.91
 
Hi J and P,
Here's the final cut:

I've moved the zeros back out of the LOOP, so it doesn't update, and upped the number of averages.

p, If you would like to try your method, I'll test it for you, or save your energy for the main thread.
Thanks, C.
------------------------------------------------------------------------------
-140.50,-123.02,-216.60
-140.37,-122.64,-216.95
-140.76,-122.94,-217.01
-141.19,-122.30,-217.70
-140.90,-122.61,-217.29
-141.17,-122.36,-217.62
-141.00,-124.02,-216.25
-141.87,-122.64,-217.56
-141.02,-122.17,-217.61
-141.40,-123.19,-217.44
-141.58,-122.78,-217.56
-141.26,-123.31,-217.63
-141.05,-123.46,-217.82
-140.96,-122.88,-218.26
-140.61,-123.18,-216.83
-139.57,-121.56,-217.15
-140.29,-122.75,-216.74
-140.39,-122.49,-216.98
-140.82,-123.55,-217.59
-141.53,-123.83,-216.43
-140.98,-122.96,-217.11
-140.56,-124.69,-218.03
-140.67,-123.51,-217.26
-140.93,-123.35,-217.18
-141.17,-123.50,-217.86
-140.26,-123.48,-216.83
-140.56,-123.75,-216.55
-140.86,-122.88,-215.71
-141.13,-122.68,-216.90
-139.97,-123.48,-217.95
-141.16,-123.75,-217.19
-140.42,-123.77,-216.31
-141.48,-122.99,-216.96
-140.41,-123.47,-217.38
-140.53,-123.63,-217.34
-139.43,-123.52,-216.49
-141.70,-123.44,-217.44
-140.17,-123.54,-216.00
-140.60,-123.24,-217.86
-140.96,-123.53,-216.89
-140.85,-122.42,-217.41
-140.22,-122.23,-217.23
-139.90,-123.80,-217.23
-140.02,-122.30,-217.28
-140.31,-123.46,-217.04
-140.47,-123.21,-217.17
-140.56,-123.70,-216.86
-139.73,-123.95,-217.64
 
Hi,
With both BASE and REMOTE compasses BIAS calibrated, I started to test them.

Up to now I had thought that North on these AK8963C modules was Y as that's the first step of the calibration, but on closer inspection, I now think North may be X. Is this correct?
If so then for normal use, how should the 3x planes on the COMP be orientated?
C.
 
Z up, then point X to North, if X is large and Y much smaller, then X is North.
Hi J,
I tried this, but the results were confusing. Are you sure that is the best method, I know it seem logical.

I almost recall that the sensors, are at angles not quite as it would be imagined?
C
 
Hi J,
I tried this, but the results were confusing. Are you sure that is the best method, I know it seem logical.

I almost recall that the sensors, are at angles not quite as it would be imagined?
C
What the results were?
 
Hi J,
I tried this, but the results were confusing. Are you sure that is the best method, I know it seem logical.

I almost recall that the sensors, are at angles not quite as it would be imagined?
C
The coordinates relative to the chip are on the last page of the D/S.
 
I think that the logical way is that Y is North, but it doesn't matter, when the angles can be calculated even if X is North.
 
I think that the logical way is that Y is North, but it doesn't matter, when the angles can be calculated even if X is North.
Hi J,
I saw the XYZ orientation on the D/S, but I think North is a calculation between the X and Y orientations, in the form of sine waves. My first thougt till I find previous examples, I have is that N is 1/2 way between X and Y.
Still looking.
C
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top