cancel
Showing results for 
Search instead for 
Did you mean: 

MotionAC doesn't seem to be working.

PMach.1
Senior

Hi,

I am trying to perform a 6-point tumble calibration for my LSM9DS1 accelerometer. The returned output data from the MotionAC_Update is always as follows:

0693W00000APNhrQAH.jpgThe "is_calibrated" parameter is always 0, indicating the accelerometer is not calibrated.

The initialization is done the following way:

void cal_init(MAC_output_t start_accel_bias){

/*** Initialization ***/

char lib_version[VERSION_STR_LENG];

MAC_knobs_t Knobs;

/* Accelerometer calibration API initialization function */

uint8_t enable = 1;

MotionAC_Initialize(enable);

MotionAC_GetKnobs(&Knobs);

Knobs.Run6PointCal = 1;

Knobs.Sample_ms = REPORT_INTERVAL; //REPORT_INTERVAL=20 [ms]

Knobs.MoveThresh_g = 0.15;

(void)MotionAC_SetKnobs(&Knobs);

/* Optional: Get version */

MotionAC_GetLibVersion(lib_version);

}

To perform the calibration, the following is executed at a frequency of 50 Hz (every 20 ms):

MAC_input_t data_in;

MAC_output_t data_out;

float acc_cal_x, acc_cal_y, acc_cal_z;

/* Get acceleration X/Y/Z in g */

//MEMS_Read_AccValue(data_in.Acc[0], data_in.Acc[1], data_in.Acc[2]);

IMU_getData(&imu, &data, 1);

data_in.Acc[0] = data.x_acc;

data_in.Acc[1] = data.y_acc;

data_in.Acc[2] = data.z_acc;

data_in.TimeStamp = timestamp * REPORT_INTERVAL;

/* Accelerometer calibration algorithm update */

uint8_t is_calibrated;

MotionAC_Update(&data_in, &is_calibrated);

/* Get Calibration coeficients */

MotionAC_GetCalParams(&data_out);

Also, I have attached a csv file with several readings of timestamp and each axis. Have in mind it was done for one of the points, with the Z-axis pointing upwards.

What might be the problem? Thanks in advance.

5 REPLIES 5
Petr S
ST Employee

Hi Pedro,

Your attached ACC data and time stamp seems reasonable so what I need from you now is the data recorded from one of your complete 6-position calibration trials to replicate/analyze your issue and find the root cause.

Best regards,

Petr

Petr S
ST Employee

During the calibration make sure you always hold your device on the table in each of the 6 positions for at least 2 seconds without any movement (almost stop breathing 😊). Never hold it in your hand in the air only because the movements are too high even if not visible.

Hi, Petr,

I guess that I misinterpreted the instructions on the MotionAC User Manual. It turns out that each calibration needs the six positions of the IMU.

What I was doing was calibrating each point separately. Now I can get the bias values.

Thank you for your answer.

I'm glad you solved it, Pedro.

Can you make it clear ! I'm also not getting it. Did you get both bias and scale factor?