Create a pedometer with an Android application by implementing a filtering process called a low-pass filter.
You will be able to develop using an acceleration sensor when creating an Android application. Create a pedometer using an accelerometer.
Smartphones have a 3-axis accelerometer.
The number of steps is counted by using the increase / decrease in acceleration obtained from these acceleration sensors. However, since it is not known how the smartphone is held, it may not be possible to measure accurately with only one-axis acceleration. Therefore, we will measure the number of steps by using the increase / decrease of the following values that combine the accelerations of the three axes.
When walking, the value obtained by combining the accelerations of the three axes is taken, and the number of times the maximum value obtained by combining the accelerations of the three axes is taken is counted as the number of steps.
Also, since the raw data obtained from the sensor contains noise that interferes with the step count calculation, remove the extra noise. A filtering process called a low-pass filter is performed so that the correct number of steps can be counted as much as possible. The low-pass filter is a process of removing high-frequency components and extracting only low-frequency components.
See GitHub --See MainActivity.java --See activity_main.xml
This screen is displayed when you start the app.
This screen is displayed when you press the Start button
In addition, when the Restart button is pressed, the number of steps can be initialized to 0 steps. You can stop the measurement once by pressing the Stop button.
I actually walked and measured it. I walked 14 steps, but the measurement shows 16 steps. There was an error of two steps. There is room for improvement
Recommended Posts