Moin. Ich habe erst mit Arduino begonnen ... muss meine alten grauen bewegen.
Ich will den Azimut und die Elevation mit dem QMC5883L bekommen. (bin ca bei (27° 45' 15'' N) (18° 2' 0'' W)
Nach Tagen kennen lernen des QMC5883L (mit dem studieren des RICHTIGEN) Datenblattes dann dieses Ergebnis bekommen (siehe Bild).
Die Daten scheinen zu stimmen (es zeigt nach Nord und senkrecht ist es auch) - das Shield.
Doch kippe ich es gegen rechts - müsste ja die Richtung bleiben und der Azimut gegen 0 sein....macht es aber nicht,
komme auf ca Az 300° und Elevation 39°
Ergo - das Board steht und -X zeigt nach Norden dann stimmt es sehr gut. Alles andere gibt unkorrekte Werte. Oder mach ich was mit der Berechnung falsch ? (Trigo war vor 50 Yrs bei mir ..hmm schon was vergessen).
TNX für nen Tip. Erich
Code:
float azimut=atan2(y,x)180/PI - 180;
azimut = abs(azimut);
//.................
elevation= atan2((double)-y,(double)z) + elevation_korrektur ;
elevation= elevation(180/PI);
elevation = elevation -90;
if ( elevation < 0 ) {
elevation = elevation + 360;
}
//....................
Rohdaten:
X: -593 Y: -137 Z: -1137 Azimuth°: 346.99 Elevation°: 83.13
X: -576 Y: -126 Z: -1145 Azimuth°: 347.66 Elevation°: 83.72
X: -588 Y: -113 Z: -1150 Azimuth°: 349.12 Elevation°: 84.39
X: -583 Y: -118 Z: -1118 Azimuth°: 348.56 Elevation°: 83.97
X: -588 Y: -118 Z: -1150 Azimuth°: 348.65 Elevation°: 84.14
X: -576 Y: -108 Z: -1142 Azimuth°: 349.38 Elevation°: 84.60
X: -596 Y: -123 Z: -1150 Azimuth°: 348.34 Elevation°: 83.90
X: -593 Y: -118 Z: -1150 Azimuth°: 348.75 Elevation°: 84.14
X: -593 Y: -118 Z: -1123 Azimuth°: 348.75 Elevation°: 84.00
X: -596 Y: -116 Z: -1152 Azimuth°: 348.99 Elevation°: 84.25
X: -583 Y: -123 Z: -1147 Azimuth°: 348.09 Elevation°: 83.88