Assignment 0: Step Counting on an Smartphone

You will build your first smartphone app that uses the built-in sensors for something useful. This app will count the number of steps that you have taken and show that number on the screen. You will be using the raw data from the accelerometer and/or gyroscope to complete this task. The data will require some very simple signal processing. You can use peak detection, zero crossing, or your own technique for counting. You can assume the user only holds the phone in a fixed posture in their hands. You are welcome to assume a different placement or posture of the phone, but please be sure to document how the device needs to be held somewhere on the interface. It is recommended that you use the Android platform for this project. If you wish to do it on an iPhone that is ok as well. If you do not have access to an Android device, contact the instructors promptly.

Checkpoints and recommended steps:
  1. Create a project in Android Studio (or other IDE). Look up the API to poll data from the accelerometer and gyroscope.
  2. Continuously print values from the accelerometer and gyroscope to the logging terminal
  3. Output these values to a persistent file on disk
  4. Have a 'data collector' app that includes a start and stop button. When you press the start button, these IMU (inertial measurement unit) values should start logging to a file, when the stop button is pressed, stop polling from the sensor.
  5. Start collecting data with this app by walking in a line, in a circle, in zig zag motions and at different speeds. For each test record ground truth values, that is, record the number of steps taken in a single session. Conduct this testing systematically and multiple times.
  6. Examine these logged files in Matlab, Python/matploblib/iPython or other data visualization tool of your choice
  7. Identify the peaks and troughs that are characteristic of a single step
  8. In Matlab explore different simple signal processing techniques to use to capture the peaks of a step. Matlab functions to explore are
    • movmean (smoothes/averages curve)
    • findpeaks (explore the different parameter options)
    • butter (for filtering)
    • mean (for subtracting DC bias)
  9. Develop an algorithm that you can run over each data file that reliably and accurately outputs the number of steps taken
  10. Implement this algorithm on a smartphone. After each walk session, run the algorithm on the saved data file and output the number of steps taken to the phone's screen
  11. Extra credit: Have the algorithm run continuously on streaming data so that the step counts are printed to the screen in real time as the steps are taken.

Grading will be based on a 'demo or die' presentation of the system and the submitted code. If the step count is within 1 or 2 steps of the ground truth, we will award full points.