Nano33BLE to measure roll, pitch and yaw

Using Arduino IDE I was able to get very precise measurements of roll, pitch and yaw for the ESP32 Dev Module + MPU6050 breakout board based on the github MPU6050 library with quaternions. Now, in order to optimize the HDW form factor and size , I bought a new Nano33BLE card and started the eval to get the same results for the embedded LSM9DS1. I found a plenty of libraries and calibrations on github, but none seems to guarantee accuracy and measurements are strongly affected by drifting. Fusion or not, it seems that usable results are very far from what I expected. Did anybody the same experience ? Any suggestions from experts ? Thanks a lot

Comparing Gyroscopes | Adafruit SensorLab - Gyroscope Calibration | Adafruit Learning System

Various reviews seem to agree with your findings. According to Adafruit t;he MPU6050 is

The MPU-6050 is what we call "an oldie but goodie" - this popular triple-axis accelerometer plus gyro combo

With the MPU-6050, that is a given, because yaw is not determined. There is no North reference.

With the LSM9DS1, if sensor is stable on the bench, there be no drift with a properly calibrated sensor, and properly configured AHRS.

Assuming that the code is correct, my guess is that you failed to properly calibrate (and verify the calibration) of the magnetometer and the gyro. Tell us more about the steps you took.

The code I wrote works as expected, and when the sensor is calibrated, does not show any drift: GitHub - jremington/LSM9DS1-AHRS: Mahony 3D fusion filter and tilt compensated compass, with sensor calibration code

Many tks, Mr jremington. You faced an important point: in my application for the MPU6050 ( 6 axes ) I do the selfcalibration before starting the app. The experimental box is in rest on my desk, perfectly horizontal, with the orientation "front" aligned along the +X axis. Z axis is assumed to be vertical. Infact I need just relative roll/pitch/yaw sets during my sampling. The LSM9DS1 is a 9 axes, but it is not easy to understand the calibration process of magnetometer. I just use your library as it is, the example just to understand the behaviour of the sensor. But it is not so important an absolute roll/pitch/yaw because the aim is to record the style of moving during human training. So probably my mag calibration is not ok. I would prefer autocalibration to avoid hardcoding new numbers at any new board. Thanks for your answer confirming a doubt.

Magnetometer calibration is absolutely essential, and your application won't work without it. You don't have to understand the math, as the calibration program takes care of that.

Give it a try. Here is a comprehensive tutorial, and a very detailed hands on example, with a closely related sensor.

On the other hand, if ONLY relative yaw, pitch and roll angles are required, then the gyro will suffice for a few minutes. You need to accurately integrate the gyro rates to get the 3D angles.

The "gyro_only" code for the MPU-6050 on this site will do that, but you do have to accurately calibrate the gyro (calculate and remove the offsets), every time you use it.

hey please. do you have reference magnetic field of any sort? or is it only math?

For navigation, the direction of the Earth's magnetic field is commonly used, but not the magnitude. So magnetometer calibration can be entirely internal (zero offsets and relative scale factors).

The math is described here, among other places.

ok. thanks for the reply.

really not what I have in mind but it was difficult to believe any arduino hobbiyst (but me) has a calibrated magnetic field on the work bench.

The methods is... surprising and really duplicated from accelerometer calibration, but I have difficulties to see the earth magnetic field value as a reference as strong as the gravity field..
To do list updated, thanks again.

Neither is a very good reference, which is why consumer grade IMUs cannot be used for estimating velocity and distance traveled, just approximate 3D orientation.

Even small accelerations introduce significant errors into the direction assumed to be "down", as defined by the gravity vector.

Electrical currents, magnets and iron containing objects all introduce significant (if not overwhelming) errors into measuring the direction of North, as defined by the Earth's magnetic field.

that makes sense.

for my indoor toy car (based on a 33BLE), I had great results with a simple smoothing of gyro, and next step is to derivate instant velocity from accelerometer.

I had the project to link the magnetometer and my gyro to get the north reference, but just the card, wires (and I imagine DC motors just near by) make an evil noise. I think I only achieved to get a coherent value of the magnetic field with bare card hand held.
But as you say, should be ok for "consumer grade".

EDIT: one more thing I have in mind. Not actually told, but we all seems to live in north hemisphere, were a compass could be used...

Magnetic needle compasses work fine in the southern hemisphere, if they are designed for use in that region.

What most people don't know or think about is that the compass needle has to be weighted at one end, in order to balance horizontally, so compasses are hemisphere- or latitude-specific.

For example, at mid latitudes in the U.S. the Earth's magnetic field points rather steeply into the ground (66 degrees from horizontal, in my area). So the South end of the compass needle has to be pretty heavily weighted for it to balance horizontally.

More on that here: Global Compasses

Dear jremington, I carefully reconsidered the application after your considerations of magnetic effects. So now I need to go deeply into the matter as you suggested. I think that you are 100% right and decided to spend moreand more time with calibration to get better results. Thanks for opening my mind.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.