SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By paynterf

I'm trying to use Sparkfun's IMU-9250 breakout board to record the azimuth heading on one of my wheeled robots, and I'm having some trouble getting believable yaw data from the device. Using just the unmodified SPARKFUN_IMU sketch, I recorded the Yaw data output while slowly rotating the IMU in a more-or-less horizontal plane. When I plotted the data in Excel, I got the following plot
180411 Yaw Capture.jpg
I can sorta squint and think that there is a linear progression of yaw values, but there is so much noise that I hesitate to call this anything but garbage. Am I doing something wrong here?


You do not have the required permissions to view the files attached to this post.
By jremington
Magnetometers are essential to fix the yaw value, but unfortunately are useless "out of the box".

They must be carefully calibrated. For a good overview, see this tutorial: ... r-arduino/

I strongly recommend the Magneto approach. Magnetometer calibration should be performed in the final place of installation, or make certain that no magnets or magnetic materials are in the vicinity during operation.
By paynterf
OK, I'll bite - why are magnetometers essential for fixing yaw values - especially point-to-point yaw value differentials? I can see using a calibrated magnetometer to correct for gyro initial offset and/or drift, but not for 'fixing' the large point-to-point deviations I'm seeing.

Curious minds and all that ;-)

By jremington
The software or firmware will try to correct the gyro drift using the magnetometer, regardless of whether it is calibrated.

If the magnetometer is not calibrated, the corrections will be complete garbage. The old saying Garbage In = Garbage Out holds for all types of computers.

BTW there is much better software for that IMU. RTIMUlib is open source and state of the art. Google "rtimulib arduino" for several leads.
By paynterf
Thanks for the quick reply. I've been googling around, and see several tutorials discussing correction to gyro values using a 3-axis accelerometer, but nothing about using values from a magnetometer. Could you be confusing the two?


By jremington
Could you be confusing the two?

The accelerometer is used to define pitch and roll (while the craft is not accelerating or rotating), while yaw is defined by the magnetometer. Another way to look at this is that the magnetometer defines the North direction, while the accelerometer defines the Down direction. North and Down are combined to generate East, for a full 3D coordinate system called NED.

Both of these sensors are required to determine absolute orientation.

The gyro measures rotation rates and cannot be used to define any angles. It simply helps to correct for the fact that the acceleration vector is not g (Down) if the craft is rotating or accelerating.

If you want to learn how IMUs and AHRS systems actually work, one place to start reading is here:
By paynterf
Ah, that assumption thing again..

you assumed I wanted absolute heading, but I don't - I only need relative yaw and I'll set the heading manually.

In my application a magnetometer is worthless, as there are too many magnetic interferers, so even if I wanted absolute heading (not yaw), I couldn't get it.

You assumed that somehow the lack of magnetometer calibration caused the data inconsistencies I noted in my original post, but I don't see how that is possible. Even a completely uncalibrated setup should have a consistent error, and the yaw output should be more or less linear. Can you explain how the raw yaw data could vary that much?


By jremington
I'm trying to use Sparkfun's IMU-9250 breakout board to record the azimuth heading on one of my wheeled robots
Are you a troll?

If not, good luck with your project.