Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bearing angle is not correct, except North=0 #30

Open
gordon4liu opened this issue Apr 1, 2024 · 1 comment
Open

Bearing angle is not correct, except North=0 #30

gordon4liu opened this issue Apr 1, 2024 · 1 comment

Comments

@gordon4liu
Copy link

Hi ,
At first , I run the calibration.ino ont the GY-271(QMC5883L). and get the calibration data.
I copy its to bearing.ino.

And then I run the bearing.ino.
The North is 0 deg, NE=2 deg, E=4, SE=5, S=6, SW=7, W=4, NW=8.
Does it SW or HW issue??

=== bearing.ino ==
#include <QMC5883LCompass.h>
QMC5883LCompass compass;
void setup() {
Serial.begin(9600);
compass.init();
compass.setCalibrationOffsets(41.00, -159.00, -436.00);
compass.setCalibrationScales(1.09, 0.93, 0.99);
}
void loop() {
compass.read();

byte a = compass.getAzimuth();
// Output here will be a value from 0 - 15 based on the direction of the bearing / azimuth.
byte b = compass.getBearing(a);

Serial.print("B: ");
Serial.print(b);
Serial.println();

delay(250);
}

@microstoc
Copy link

I had what seems a similar problem.
Rotating clockwise, the readings went N NE E SE S and then straight back to N. Nothing in the W region.
Long story short, the azimuth readings were going 0 45 90 135 180 and then -180 -135 -90 -45.
I corrected for this using ... if(azimuth<0){azimuth=360+azimuth};

HTH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants