Zero compass values in I2C-LSM303DLHC example

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

gav-gav
Posts: 10
Joined: Fri Sep 01, 2023 7:29 am

Re: Zero compass values in I2C-LSM303DLHC example

Postby gav-gav » Thu Sep 14, 2023 12:25 pm

Hello Marco
Magnetometer LSM303AGR is working fine now or at least looks like it.
But we have other problem with E-compass.
We can't receive true direction of North.
We are thinking that the main problem in cooked accelerometer values which were not calibrated correctly.
How can we normalize values correctly to calculate pitch and roll of the local level frame without errors?

We made text example for LSM303AGR on the basis of LSM303DLH example.

So LSM303AGRcfg structure is defined by next instruction:
static const LSM303AGRConfig LSM303AGRcfg = { .i2cp = &I2CD1, .i2ccfg =
&i2ccfg, .accsensitivity = NULL, .accbias = NULL, .accfullscale =
LSM303AGR_ACC_FS_4G, .accodr = LSM303AGR_ACC_ODR_100Hz,
.compsensitivity = NULL, .compbias = NULL, .compodr = LSM303AGR_COMP_ODR_50HZ,
};
Then raw accelerometer values (x,y,z) = (-448 ,-64 ,7744) are transformed to cooked accelerometer values (-61.4399986 -15.3599997 929.279968) by
multiplication ob the value of sensibility =0.120.
We realize that it is wrong.

We read an article "AN3192 application note Using "LSM303DLH for a tilt compensated electronic compass"
Can we use calibration algorithm from this article for calibration of LSM303AGR accelerometer?

Best Regards
Alexey Gavrilov
Maxim Vasin


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 8 guests