cancel
Showing results for 
Search instead for 
Did you mean: 

IIS2DLPCTR: Why are Out_X,Y,Z values are constantly changing?

VJaha.1
Associate II

I got my PCB from the fab today. I am running a test program based on the code in https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/iis2dlpc_STdC/example/iis2dlpc_read_data_polling.c

Since the Sensor-PCB is on my desk with no movement, I expected the X_Y_Z values to be constant.

However I am observing them changing every second, The data_raw_acceleration value read on line 179 Changes by a few 100's every second.

Am I missing something here?

How do I ensure that the value changes only when there is motion, and gives a fairly accurate estimate of the acceleration?

2 REPLIES 2
Eleon BORLINI
ST Employee

Hi @VJaha.1​ ,

Please consider first that the iis2dlpc_read_data_polling.c configures the low power mode instead of the high performance mode. I suggest you first to uncomment the second line and comment the third line of the below code and check if the data variability decreases (since high performance is on 12 bits and low performance is on 14 bits).

/*Configure power mode */
  //iis2dlpc_power_mode_set(&dev_ctx, IIS2DLPC_HIGH_PERFORMANCE);
  iis2dlpc_power_mode_set(&dev_ctx, IIS2DLPC_CONT_LOW_PWR_LOW_NOISE_12bit);

Consider also that the acquired data in line 179 of the above code are in LSB, and you have to check the Line 186 output to have the data in physical units (mg). Since the default code sets a FS of +-8g (line code 157), your conversion factor (sensitivity) is 0.976 mg/digit, and if the LSB is 100, it is a lot... Did you considered that you have to convert data on 12 bits instead of 16 bits (it would be a 3 bits varying instead of 7...)?

Since you have set an ODR=25Hz, you'll also have an intrinsic (small) variability of the data output according to this frequency (ODR/2).

As a further suggestion, in order to reduce any issue due to synchronization, you could try enabling the BDU bit of the CTRL2 (21h) register and check if the output variability is still high.

-Eleon

Eleon BORLINI
ST Employee

Hi @VJaha.1​ ,

where you able to solve the problem thanks to the answer above?

If so, please mark it as Best Answer, to help future users with the same issue.

-Eleon