<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[M5 GNSS module magnetometer false reading]]></title><description><![CDATA[<p dir="auto">Hi all,</p>
<p dir="auto">I'm using the M5core2 combined with a M5 GNSS module for a position-attitude tracking project.<br />
I have issues with the values read by the bmm150 (magnetometer).</p>
<p dir="auto">Here is the typical values I get when running the getSensorData exemple :<br />
mag:  -991  -32768  -431<br />
First, these values should be micro Tesla and this is just way too high.<br />
Second, the Y-value is -32768 which is the lowest possible value for int16_t, the data type returned by bmi270.readMagneticField(mx, my, mz); I guess this indicates a kind of unwanted behavior.</p>
<p dir="auto">If anyone has a lead on this problem let me know !<br />
Thanks,</p>
<p dir="auto">PS: other sensors seem to work fine</p>
<p dir="auto">Here is the code from the exemple:</p>
<pre><code>/**
 * @file getSensorData.ino
 * @author SeanKwok (shaoxiang@m5stack.com)
 * @brief M5Module GNSS Get Sensor Data Demo.
 * @version 0.2
 * @date 2023-09-15
 *
 *
 * @Hardwares:M5Module GNSS
 * @Platform Version: Arduino M5Stack Board Manager v2.0.7
 * @Dependent Library:
 * M5Module_GNSS: https://github.com/m5stack/M5Module-GNSS
 * Adafruit BMP280 Library: https://github.com/adafruit/Adafruit_BMP280_Library
 */

#include "M5Module_GNSS.h"
#include &lt;Adafruit_BMP280.h&gt;

#define BIM270_SENSOR_ADDR 0x69
#define BMP280_SENSOR_ADDR 0x76

BMI270::BMI270 bmi270;
Adafruit_BMP280 bmp(&amp;Wire);

void setup() {
    // put your setup code here, to run once:

    Serial.begin(115200);
    Wire.begin(21, 22, 100000);
    while (!Serial)
        ;

    unsigned status = bmp.begin(BMP280_SENSOR_ADDR);
    if (!status) {
        Serial.println(
            F("Could not find a valid BMP280 sensor, check wiring or "
              "try a different address!"));
        Serial.print("SensorID was: 0x");
        Serial.println(bmp.sensorID(), 16);
        while (1) delay(10);
    }

    bmi270.init(I2C_NUM_0, BIM270_SENSOR_ADDR);
}

void loop() {
    // put your main code here, to run repeatedly:
    float x, y, z;

    if (bmi270.accelerationAvailable()) {
        bmi270.readAcceleration(x, y, z);

        Serial.print("accel: \t");
        Serial.print(x);
        Serial.print('\t');
        Serial.print(y);
        Serial.print('\t');
        Serial.print(z);
        Serial.println();
    }

    if (bmi270.gyroscopeAvailable()) {
        bmi270.readGyroscope(x, y, z);

        Serial.print("gyro: \t");
        Serial.print(x);
        Serial.print('\t');
        Serial.print(y);
        Serial.print('\t');
        Serial.print(z);
        Serial.println();
    }

    if (bmi270.magneticFieldAvailable()) {
        int16_t mx, my, mz = 0;
        bmi270.readMagneticField(mx, my, mz);

        Serial.print("mag: \t");
        Serial.print(mx);
        Serial.print('\t');
        Serial.print(my);
        Serial.print('\t');
        Serial.print(mz);
        Serial.println();
    }

    Serial.print(F("Temperature = "));
    Serial.print(bmp.readTemperature());
    Serial.println(" *C");

    Serial.print(F("Pressure = "));
    Serial.print(bmp.readPressure());
    Serial.println(" Pa");

    Serial.print(F("Approx altitude = "));
    Serial.print(bmp.readAltitude(1013.25)); /* Adjusted to local forecast! */
    Serial.println(" m");

    Serial.println();
    delay(500);
}

</code></pre>
]]></description><link>https://community.m5stack.com/topic/7348/m5-gnss-module-magnetometer-false-reading</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 08:41:52 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7348.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 02 Mar 2025 22:22:01 GMT</pubDate><ttl>60</ttl></channel></rss>