cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSO pedometer setting

JXiao.1
Associate II

Now I am using LSM6DSO sensor pedometer function. I found it is too sensitive and want to change it. I found four pedometer settings. They are ****_CMD_REG, ****_DEB_STEPS_C, ****_SC_DELTAT_L, ****_SC_DELTAT_H. I can just understand the function of the second one. Can you explain the other three meaning? I have changed them and will cause the pedometer stop.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Pedro,

>> as far I understood it's impossible to port this project to other micro controller, am I right?

It is not easy to do it with the executable version of the library only, since it has been designed to run on STM32.

Since a lower-level use of these libraries is subjected to a License Agreement signature, you can ask to the OLS support or contact a local representatives and they will evaluate case by case.

>> If it is, i'll be impossible to tune sensibility parameters of the embedded pedometer digital feature?

Well, the two pedometer libraries, MotionPM and MotionPW, are effectively limited in setting the parameters. So my suggestion would be trying the way I suggested above.

As side note, you might try to setup a custom "high-level" algorithm with the Algobuilder tool, maybe filtering the accelerometer/gyroscope data before entering in the pedometer' functions or calculating the FFT, setting thresholds etc...

Let me know if these steps can help you to make some progress.

-Eleon

View solution in original post

12 REPLIES 12
Eleon BORLINI
ST Employee

Hi @JXiao.1​ ,

  • The ****_CMD_REG is the Pedometer configuration register and is described below [description in datasheet, p. 134].0693W000006GSRVQA4.png
  • The ****_SC_DELTAT_L and the ****_SC_DELTAT_H are two parts of a unique parameter, 16-bit unsigned value with a resolution of 6.4 ms. It can be used in conjunction with the STEP_COUNT_DELTA_IA bit of EMB_FUNC_SRC registers: enabling this bit, instead of generating an interrupt signal every time a step is recognized, it is possible to generate it if at least one step is detected within a certain time period, defined by setting a value different from 00h in those registers. Note that, in addition, it is necessary to set the TIMESTAMP_EN bit of the CTRL10_C register to 1 (to enable the timer). you might act on this register to modify the pedometer sensitivity [description in AN5192, p. 57].

Let me please know if these indications can help you.

-Eleon

I also found when the data rate setting is high such as 417Hz, the sensor will become more sensitive. Is this my illusion? Or the sample data rate will affect the sensitivity of the sensor.

It is plausible, since the higher the ODR, the broader the bandwidth of the analyzed signal, and the more probable a threshold overcome due to a high-frequency component is. For the step counter application, 104Hz should be enough, but also 26Hz might work.

-Eleon

I have tried this method and use ​function lsm6dso_****_steps_period_set. It seems to have some effects. The following code shows mw how to use it. I set the delay time is 0x32. That is 50 * 6.4 = 320ms. I think this means the sensor will send an interrupt every 320ms. Then I set the delay time is 0xA0 about 1000ms. I found the step counter will still count every step. Is the function I use wrongly?

I have set the timestamp to 1 using lsm6dso_timestamp_set(&imu_dev_ctx, 1).

//Set the sensitivity of the sensor
uint8_t delay_time = 0x032U;
lsm6dso_****_steps_period_set(&imu_dev_ctx, &delay_time);
 
 
//Time period register for step detection on delta time
int32_t lsm6dso_****_steps_period_set(stmdev_ctx_t *ctx, uint8_t *buff)
{
  int32_t ret;
  uint8_t index;
 
  index = 0x00U;
  ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_****_SC_DELTAT_L, &buff[index]);
  if (ret == 0) {
    index++;
    ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_****_SC_DELTAT_H,
                                   &buff[index]);
  }
  return ret;
}

Hi @JXiao.1​ ,

you may need to also enable the TIMESTAMP_EN bit of the CTRL10_C register to 1, to make the change effective.

-Eleon

I have set the timestamp to 1 using lsm6dso_timestamp_set(&imu_dev_ctx, 1) in the sensor initial part. I think it is already set

PLuze.1
Associate II

Hello, i'm working with the same sensor and i'm using pedometer functionality as well, and having the same trouble. the step counter is very sensible and outputs 2/3 times more steps than it should.

i've tried to change some configuration as JXiao did, but had no luck. Isn't there any hidden configuration such as filters, bandwidth configurations that can be access through the UNICO-GUI?

best regards

Hi, i was looking to your code and i'm not sure if the buff that you send to the _steps_period_set function, should be a buffer[2] = {lower limit, upper limit}.

Hi,

You are right. In that function it should give a pointer of array. But the performance is not very good​. I will do more long-distance tests.