Helpless in getting proper Yaw values from MPU9250

I think I've tried everything: added magnetometer (MPU9250), used quaternions with Kalman filter, sensor fusion using Madgwick and Mahony filters. Calibration with Kris Winer’s code. Nothing helps. After doing Pitch or Roll or any movement, other than Yaw, it becomes a mess. Did anyone ever make it work, in realistic conditions?

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html .
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you post your code you are using please?

Thanks.. Tom.. :slight_smile:

Many, many people have successfully used the MPU9250 to give accurate 3D orientations, however if you are cobbling together your own code, you do have to double check every step of the process, to make sure that sign conventions and order of operations on the orientation angles are correct.

All of the options you have tried work very well, if you are careful. However, here is a fourth option that also works extremely well, and it includes a magnetometer calibration routine. https://github.com/richardstechnotes/RTIMULib-Arduino

RTIMUlib should work "out of the box" if configured properly, and the magnetometer is calibrated.

Incidentally, the magnetometer must be properly calibrated in its final environment to produce useful yaw values.

Carefully study this comprehensive tutorial: Tutorial: How to calibrate a compass (and accelerometer) with Arduino | Underwater Arduino Data Loggers.