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.
You should have a working program about 1.2019 or later.
I am not sure if I have it anymore.
The angles are calculated with arctan( y/x) or arctan(x/y )
+ checking the quadrant from the signs of X and Y
Arctan was an approximation with an accuracy of ~ 0.16 degrees.
Don't use Oshonsoft arctan. It had worse accuracy + it needs checking the 8 octants.
 
You should have a working program about 1.2019 or later.
I am not sure if I have it anymore.
The angles are calculated with arctan( y/x) or arctan(x/y )
+ checking the quadrant from the signs of X and Y
Arctan was an approximation with an accuracy of ~ 0.16 degrees.
Don't use Oshonsoft arctan. It had worse accuracy + it needs checking the 8 octants.
Hi J,
In todays programs, there are some errors with the COMP CODE, perhaps a mistake as I copied and pasted.

I have all of the programs! Here is one just after your date:
I think if this is ok, then this CODE will should be in recent programs. Let me know if this is ok, and I'll compare them.

EDIT: I just looked at todays program, and to me the DEGREE CALC (search) looks identical to the earlier one. I'll double chanck tomorrow.

C.
 

Attachments

  • 18F4620 8MHz XTL TX 5110 DEG 040419 1000.txt
    16.5 KB · Views: 250
  • 18LF4620 8MHz XTL BASE PCB_4 040920 1000.bas
    33.6 KB · Views: 242
Last edited:
It seems right, but I remember that in one version the angles rotated anticlockwise. It is easy to correct.
I will look at it.
 
It seems right, but I remember that in one version the angles rotated anticlockwise. It is easy to correct.
I will look at it.
Hi J,
Good memory!
At the moment that latest program is counting CCW, and this is wrong. It should count upwards when the REMOTE moved CW.
I'll also re-check.
C.
 
Hi J,
Good memory!
At the moment that latest program is counting CCW, and this is wrong. It should count upwards when the REMOTE moved CW.
I'll also re-check.
C.
Change
DEG = 360 - atn(x_c, y_c) 'str_deg = #atn
to
DEG = atn(x_c, y_c) 'str_deg = #atn
 
Change
DEG = 360 - atn(x_c, y_c) 'str_deg = #atn
to
DEG = atn(x_c, y_c) 'str_deg = #atn
Hi J,
I'm sure your suggestion worked, but as this COMP has just been BIAS calibrated I think it did a double reverse, so I put it back to how it was and it's now working.

Here the BASE COMP output also with XYand Z READings:

At this point I would like to know more about how the 3xaxis sine waves interact with each other so I'll start another thread, about just that.
Thanks, C.
 

Attachments

  • BIAS and COMP.txt
    715 bytes · Views: 233
Hi J,
I'm sure your suggestion worked, but as this COMP has just been BIAS calibrated I think it did a double reverse, so I put it back to how it was and it's now working.

Here the BASE COMP output also with XYand Z READings:

At this point I would like to know more about how the 3xaxis sine waves interact with each other so I'll start another thread, about just that.
Thanks, C.
Something is wrong with the values.
Z should be always negative and with those X,Y values the angle is around 45 degrees.
Where do you need the sine values?
What is double reverse?
 
The first row gives with a calculator 43.97697 and with the
approximation in the program 43.9932 degrees.
 
Something is wrong with the values.
Z should be always negative and with those X,Y values the angle is around 45 degrees.
Where do you need the sine values?
What is double reverse?
Hi J,
Double reverse? It's always best to do one change at a time, but there were two (Double) With the program as it was with the new BIAS cal but without your DEG= suggestion it reversed, and now gives 'move REMOTE CW' and it give CW READings. With the second change 'yours' it reverses it again.

Where do you need the sine values? As I notice that any sideways tilt, changes the DEG quite a lot, but shouldn't and coupled with you puzzle about Neg Z, I would like to understand better how 3x axis interact with each other. This is first the first time, I've fixed the compass (Flat), before I just picked it up without much regard for tilt.
I just tried moving it to app 45° and with a slight tilt, it READ 0.

I'm not sure why the Z is POS?

C
 
But why do you get with
X55 Y57 Z45
355.51 degrees ??
You can calculate the degrees with the equation
on the first row of atn function in your program and get 43.99 degrees.
or by a function calculator and get 43.97697 degrees.
 
If you want tilt compensation it will get complicated.
 

Attachments

  • AN2272_001-32379_0C_V.pdf
    1.5 MB · Views: 316
But why do you get with
X55 Y57 Z45
355.51 degrees ??
You can calculate the degrees with the equation
on the first row of atn function in your program and get 43.99 degrees.
or by a function calculator and get 43.97697 degrees.
Hi J,
I don't know why this happens, but the program I posted plus the BIASed COMP give this.
In your next post the PDF is indeed complicated, and I'll look at it later. If possible, I would hope to simplify it, for us more general people.
C.
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top