BLE Sense AHRS

What is the best starting point in February 2020 to get a solid AHRS visualization from a BLE Sense LSM9DS1 IMU? From what I have found there are easy to implement solutions for similar setups but not quite for the BLE Sense. I am getting some unusable results from the examples I found and I am pretty sure its a problem with the orientation due to the fact that the movements along certain axis are reversed. Could be that it was designed using a different ref frame. Also there is a calibration that needs to be done but... Ok wait, I'm going to come back after I calibrate because now that I think about it that could fix the issue causing the reversals.

You must make absolutely certain that all sensor measurements are made with respect to the same, right handed body coordinate frame, or no AHRS code will work properly.

The raw values from the three individual types of sensors in the LSM9DS1 are NOT associated with the same frames of reference. See the sensor data sheet for the dirty details.

In addition, proper calibration of the sensors is required.

jremington:
You must make absolutely certain that all sensor measurements are made with respect to the same, right handed body coordinate system, or no AHRS code will work properly.

The raw values from the three individual sensors are NOT associated with the same frames of reference. See the sensor data sheet for the dirty details.

In addition, proper calibration of the sensors is required.

You are the man in these forums when it comes to AHRS... Thanks for the reply!

So is this a matter of changing the sign for the appropriate a, g and m values in the MadgwickAHRS source code?

It may take quite a bit more than that. The axial diagrams aren't very clear (below), but some of the defined coordinate systems do not appear to be right handed. You may also have to determine the signs of positive rotation independently for the gyro.

I would first dump the raw values of all the sensors and make sure I understand all the axial and sign conventions. Then, keep in mind the coordinate system assumed by the AHRS code. (NED, with Z pointing down, is common).

Hey ,
its been a while that im trying to run Madgwick filter on my Arduino Nano 33 ble with LSM9DS1 embedded , and I didn’t make it yet.
I did some digging and the most active person on arduino forum was you.
but unfortunately there was no straight answer so started to figure it out by myself but the order that i come with was not working neither.
for god sake just tell me how to put my data in Madgwick filter .
i will attach some pictures and i will be grateful for any help of yours.
LSM9DS1-axes
this is from data sheet
nano33-ble-axes


and these are from other websites.

by the way i tried any order that crossed my mind but …
MadgwickQuaternionUpdate(ay, ax, az, gyPI/180.0f, gxPI/180.0f, gz*PI/180.0f, my, -mx, mz);
please tell me the order of data like above.
thanks again

Please try the code I posted for the Sparkfun LSM9DS1 module. I don’t have the Nano 33 BLE to test but I might be able to help.

Note that the axial orientation diagram in the LSM9DS1 data sheet is either wrong or misleading, and that the Madgwick and Mahony filters assume the NWU (North, West, Up) convention for X, Y, Z, yaw=pitch=roll = 0.

You can check the axial orientations by looking at the RAW values from the sensors, as you tilt and turn it in various ways. To check the magnetometer you will need to know the orientation of the Earth’s magnetic field at your location on the planet.

Oh my lord I totally forgot , you wrote that incredible code, huge thanks for that , you did such a great job.
I tried this one MahonyUW_AHRS.ino and its working, I did tried your code before you mention actually. if you remember I posted an issue on GitHub project, but here is the problem when I’m passing the calibrated 9DOF raw data to python to use other filters like EKF its not working,
I tried lots of data orders but non of them is working.
the only way that I can get correct orientation is using your code but its a beat noisy so I’m trying to filter and convert to quaternion in python.
I will be grateful if you guide me through this, even you want i can send you a video of sensor while its plotting the raw data in one frame so that you can figure it out how this mystery sensor is working.
thanks again and I’m waiting for your reply.

I did tried your code before and its working.
if you can tell me witch order you used for that i will be grateful.
thanks again