2020-07-14 02:33 AM
2020-07-14 04:12 AM
Hi Dan, as reported in the conversion table of the datasheet p.10, please note that the conversion factor for the FS=16g case is not the double of the FS=8g one.
Please consider also the ST official C drivers for the LIS2DH12 on Github, in particular the lis2dh12_reg.c file. Assuming you are running the device in Normal mode, these are the functions to be used to convert raw-data into engineering units:
float lis2dh12_from_fs2_nm_to_mg(int16_t lsb)
{
return ( (float)lsb / 64.0f ) * 4.0f;
}
float lis2dh12_from_fs4_nm_to_mg(int16_t lsb)
{
return ( (float)lsb / 64.0f ) * 8.0f;
}
float lis2dh12_from_fs8_nm_to_mg(int16_t lsb)
{
return ( (float)lsb / 64.0f ) * 16.0f;
}
float lis2dh12_from_fs16_nm_to_mg(int16_t lsb)
{
return ( (float)lsb / 64.0f ) * 48.0f;
}
You can see that if you insert your raw data inside these expressions, you will always get 25mg.
Regards