Showing results for 
Search instead for 
Did you mean: 

Data fusion to compute the Pitch, Roll and Yaw on the LSM6DS3TR Adafruit breakout board

Associate II


I have a Adafruit LSM6DS3TR-C breakout board connected to a Pic micro-controller via I2C.

I having trouble trying to find an example on the internet or the ST/Adafruit website, of how to calibrate the Accelerometer and Gyroscope and to removes the biases. I would like to use the calibrated values minus the biases to compute the Pitch, Roll and Yaw.

I can get data from the Accelerometer, Gyroscope and the LIS3MDL Magnetometer.

I tried to use Kris Winer example of the LSM9DS1. To use it for my application but the values I get of the Pitch, Roll and Yaw jump around and are not consistent. If I only read the values from the Accelerometer, Gyroscope and Magnetometer, the values are similar and consistent but once I apply the sensitivity and try to remove the biases. For example the values typical jump from -82 to 16, and on the next read and computation. They jump to a different value.

I do not want to use the MotionCal application. I would like the Accelerometer, Gyroscope and Magnetometer to be calibrated by the PIC on start up.

I would appreciate any pointer to reference code or examples of how I can implement the BasicAHRS (Data fusion) for the LSM6DS3TR-C.

Typical challenge I am having is the user offset values for the Accelerometer, I am not sure how I can store a floating point value in a 8 bit register: X_OFS_USR (73h), X_OFS_USR (74h) and Z_OFS_USR (75h) = 0.

Another thing the data from the sensor is 2’s complement, I am not sure if I need to convert this value to normal binary fist before I can use them to calculate the Pitch, Roll and Yaw and do I use it as is?

Any help will be appreciated….