LSM6DSO Pedometer
Hi BenG142, I'm trying to develop a pedometer application using the LSM6DSOX sensor, but I haven't been successful. Could you share your project files with me? I'd like to know which registers you used.
Hi BenG142, I'm trying to develop a pedometer application using the LSM6DSOX sensor, but I haven't been successful. Could you share your project files with me? I'd like to know which registers you used.
Hi @MasCreyt21 ,
Without more information on where you've been unsuccessful, I will try to explain all steps.
So, assuming you've had positive communications with the IC (read/write registers, etc):
1. Start by setting up the Performance/ Power Mode you want:
case XL_Power_Mode_ODR::Mode_High_Performance_6_66_kHz:
WriteRegisterBitRange(LSM6DSOX_CTRL1_XL, 7, 4, 0b1010 );
WriteRegisterBit ( LSM6DSOX_CTRL5_C, 7, false ); //XL_ULP_Enable
WriteRegisterBit ( LSM6DSOX_CTRL6_C, 4, false ); //XL_HM_Mode
break;
2. Set up FIFO:
void LSM6DSOX_::setFifo_Steps(){
WriteRegister ( LSM6DSOX_FUNC_CFG_ACCESS, 0x80 ); //Open Embedded Functions
WriteRegisterBit( LSM6DSOX_EMB_FUNC_EN_A, 3, true ); //Enable Pedometer sensor in Adv Func
WriteRegister ( LSM6DSOX_EMB_FUNC_EN_B, 0x10); //Enable false positive rejection
WriteRegisterBit( LSM6DSOX_EMB_FUNC_FIFO_CFG, 6, true ); //Enable Step Counter Batching
WriteRegister ( LSM6DSOX_FUNC_CFG_ACCESS, 0x00); //Close Embedded Functions
WriteRegisterBitRange( LSM6DSOX_FIFO_CTRL4, 2, 0, 0b001 ); //set FIFO Mode
}
3. Read FIFO Registers:
uint8_t reg1 = LSM6DSOX.ReadRegister(LSM6DSOX_FIFO_STATUS1);
Serial.print("FIFO Status 1: ");
Serial.println( reg1 );
uint8_t reg2 = LSM6DSOX.ReadRegister(LSM6DSOX_FIFO_STATUS2);
Serial.print("FIFO Status 2: ");
Serial.println( reg2 );
4. Clear FIFO at the end:
void LSM6DSOX_::setFifo_Clear(){
WriteRegisterBitRange( LSM6DSOX_FIFO_CTRL4, 2, 0, 0b000);
}
Sadly not able to share the project, but hopefully this helps.
Cheers,
Ben
Screenshot from the closed thread mentioned by @Andrew Neil (Credit to @Federica Bossi) :

Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.