<?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[M5Stick IMU Yaw Readings Off]]></title><description><![CDATA[<p dir="auto">I did some calibration with my M5stick to see what the IMU pitch, yaw, and roll readings would be based on the example IMU Arduino app included with the M5stick library.</p>
<p dir="auto">It seems like the Yaw values seem to always be drifting – is this a known issue, or is there a way to account for it?</p>
<p dir="auto"><img src="/assets/uploads/files/1588322720034-b1d8c220-d79d-4e36-9222-b8b9cf16d1b0-image-resized.png" alt="0_1588322717909_b1d8c220-d79d-4e36-9222-b8b9cf16d1b0-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">My code:</p>
<pre><code>#include &lt;M5StickC.h&gt;

float accX = 0.0F;
float accY = 0.0F;
float accZ = 0.0F;

float gyroX = 0.0F;
float gyroY = 0.0F;
float gyroZ = 0.0F;

float pitch = 0.0F;
float roll  = 0.0F;
float yaw   = 0.0F;

void setup() {
  // put your setup code here, to run once:
  M5.begin();
  M5.IMU.Init();
  M5.Lcd.setRotation(1);
  M5.Lcd.fillScreen(BLACK);
  M5.Lcd.setTextSize(1);
  M5.Lcd.setCursor(40, 0);
  M5.Lcd.println("IMU TEST");
  M5.Lcd.setCursor(0, 10);
  M5.Lcd.println("  X       Y       Z");
  M5.Lcd.setCursor(0, 50);
  M5.Lcd.println("  Pitch   Roll    Yaw");

  Serial.begin(9600);
}

float temp = 0;
/*****************************************
M5.IMU.getGyroData(&amp;gyroX,&amp;gyroY,&amp;gyroZ);
M5.IMU.getAccelData(&amp;accX,&amp;accY,&amp;accZ);
M5.IMU.getAhrsData(&amp;pitch,&amp;roll,&amp;yaw);
M5.IMU.getTempData(&amp;temp);
*****************************************/
void loop() {
  // put your main code here, to run repeatedly:
  M5.IMU.getGyroData(&amp;gyroX,&amp;gyroY,&amp;gyroZ);
  M5.IMU.getAccelData(&amp;accX,&amp;accY,&amp;accZ);
  M5.IMU.getAhrsData(&amp;pitch,&amp;roll,&amp;yaw);
  M5.IMU.getTempData(&amp;temp);
  
  M5.Lcd.setCursor(0, 20);
  M5.Lcd.printf("%6.2f  %6.2f  %6.2f      ", gyroX, gyroY, gyroZ);
  M5.Lcd.setCursor(140, 20);
  M5.Lcd.print("o/s");
  M5.Lcd.setCursor(0, 30);
  M5.Lcd.printf(" %5.2f   %5.2f   %5.2f   ", accX, accY, accZ);
  M5.Lcd.setCursor(140, 30);
  M5.Lcd.print("G");
  M5.Lcd.setCursor(0, 60);
  M5.Lcd.printf(" %5.2f   %5.2f   %5.2f   ", pitch, roll, yaw);

  M5.Lcd.setCursor(0, 70);
  M5.Lcd.printf("Temperature : %.2f C", temp);

  // Plotting
  Serial.print("pitch:");
  Serial.print(pitch);
  Serial.print(",");
  Serial.print("roll:");
  Serial.print(roll);
  Serial.print(",");
  Serial.print("yaw:");
  Serial.println(yaw);
  
  delay(100);
}
</code></pre>
<p dir="auto">Full documentation on the various IMU readings when the device is in different orientations here: <a href="https://www.notion.so/scientiffic/M5Stick-IMU-Calibration-dbb5e3fa4d35444da7ca7decb418ed20" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.notion.so/scientiffic/M5Stick-IMU-Calibration-dbb5e3fa4d35444da7ca7decb418ed20</a></p>
]]></description><link>https://community.m5stack.com/topic/1916/m5stick-imu-yaw-readings-off</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 04:48:01 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/1916.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 01 May 2020 08:46:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5Stick IMU Yaw Readings Off on Sun, 03 May 2020 13:00:35 GMT]]></title><description><![CDATA[<p dir="auto">I have achieved quite good results with the Seeed Studio Grove 3-Axis Digital Compass V2.<br />
<a href="https://wiki.seeedstudio.com/Grove-3-Axis_Digitial_Compass_v2.0/" target="_blank" rel="noopener noreferrer nofollow ugc">https://wiki.seeedstudio.com/Grove-3-Axis_Digitial_Compass_v2.0/</a></p>
]]></description><link>https://community.m5stack.com/post/8492</link><guid isPermaLink="true">https://community.m5stack.com/post/8492</guid><dc:creator><![CDATA[hague]]></dc:creator><pubDate>Sun, 03 May 2020 13:00:35 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stick IMU Yaw Readings Off on Sat, 02 May 2020 08:00:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tuupola" aria-label="Profile: tuupola">@<bdi>tuupola</bdi></a> thanks for your response!  is there a particular magnetometer you recommend using with the m5 platform?</p>
]]></description><link>https://community.m5stack.com/post/8479</link><guid isPermaLink="true">https://community.m5stack.com/post/8479</guid><dc:creator><![CDATA[scientiffic]]></dc:creator><pubDate>Sat, 02 May 2020 08:00:34 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stick IMU Yaw Readings Off on Fri, 01 May 2020 18:34:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/scientiffic" aria-label="Profile: scientiffic">@<bdi>scientiffic</bdi></a> Without magnetometer yaw value will always drift.</p>
<p dir="auto">Yaw value cannot be determined from accelerometer readings. Yaw value is integrated gyroscope readings which are rate of change. Integration is never perfect and this will cause yaw to slowly drift.</p>
]]></description><link>https://community.m5stack.com/post/8474</link><guid isPermaLink="true">https://community.m5stack.com/post/8474</guid><dc:creator><![CDATA[tuupola]]></dc:creator><pubDate>Fri, 01 May 2020 18:34:33 GMT</pubDate></item></channel></rss>