2020-08-30 11:20 PM
Hello ST community,
I would like to know if there are examples available for configuring LIS2DS12 for pedometer applications. I see that the Github examples (https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/lis2ds12_STdC/example) does not have one for pedometer use.
Regards,
Anusha
2020-09-01 05:38 AM
Hi Anusha @AB.4 ,
I'm sorry, but there are no examples for this particular sensor regarding the pedometer, as ready to compile code.
Nevertheless, if you search section 5.5.1 of the datasheet, there are all the info that you need to program the pedometer of the LIS2DS12.
I would suggest to start from the lis2ds12_read_data_polling.c example on the page you linked (that should be the easiest example on the list) and add the register programming that is needed for the pedometer.
Do you think this help?
2020-09-01 09:31 AM
Hi Niccolo,
Thanks for your response. Yes, this helps a little. I will check it out.
Regards,
Anusha
2020-09-02 12:46 AM
Hi @AB.4 , besides @niccolo.ruffini indications, you can find some more details in AN4748 application note, p. 29. You can use a brief pseudo-code for the embedded pedometer initialization that summarize the datasheet indications:
1. Write 20h in CTRL1 // Turn on the accelerometer with ODR = 25 Hz, FS = ±2 g
2. Write 01h in FUNC_CTRL // Enable pedometer algorithm
3. Write 04h in CTRL5 // Step detector interrupt driven to INT2 pin
The interrupt signal is generated when a step is recognized and the step count is available by reading the STEP_COUNTER_H / STEP_COUNTER_L registers.
For sake of completeness, you could implement the pedometer without using the embedded feature, but only the X, Y and Z accelerometer output data. It is of course more complicated, and you can refer to a platform- and device- independent C implementation here on Github.
Regards
2020-09-02 03:20 AM
Hi Eleon,
Thanks for your helpful suggestions. I will check them out.
Regards,
Anusha