Due date: Sept 15
Part 1: Working with smartphone sensor data
In this assignment you will learn:
-
How to process smartphone accelerometer data to compute step counts using basic signal processing.
-
Basics of the system development life cycle:
data collection → offline algorithm development → real-time smartphone implementation
We are providing you with sample code to record and plot accelerometer data from Android and iOS devices here:
Accelerometer data collection tool [Android , iOS]
-
Turn on developer mode on your phone [Android, iOS]
-
Accessing recorded data files
-
Android: On Mac download OpenMTP to access the file system on your Android phone.
Files are saved with the timestamp displayed on the screen.
Plug the phone into your computer and download it from a file path like this: Android\data\com.example.imu\files1717676093456-acc.txt
-
iOS: There are multiple ways to access files
(1) iTunes > iPhone > Sync Settings > Files
(2) https://support.apple.com/en-us/119585 (phone needs to be USB-connected)
(3) Use Files app on iPhone and share via AirDrop. To enable this, you need to add Supports opening documents in place to be Yes in the Info.plist.
-
Code files to edit (for implementation on smartphone)
- Android: MainActivity.java
- iOS: ViewController.swift
-
Additional tips:
- iOS: Open the .xcworkspace project not the *.xcodeproj file
- iOS: May need to add your account as a trusted developer in iPhone settings
- iOS: Change the team setting on Xcode to your Apple account
Go to https://developer.apple.com/account in Safari to make sure you accepted all agreements
Bundle identifier needs to be globally unique (random string is ok)

Checkpoints and recommended steps:
- Download the starter code to your computer and open it up with Android Studio or XCode. Push the code to your phone.
- 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. The phone can be in the pocket or the hand.
- Examine these logged files in MATLAB, Jupyter Notebook or other data visualization tool of your choice. MATLAB is free for CMU students and is typically used when developing signal processing algorithms due to its rich library of built-in functions.
- In MATLAB explore different simple signal processing techniques to use to capture the peaks of a step:
- dlmread (used to read text files)
- movmean (smoothes/averages curve)
- findpeaks (explore the different parameter options)
- butter (for filtering)
- mean (for subtracting DC bias)
- Zero crossings
- Develop an algorithm that you can run over each data file that reliably and accurately outputs the number of steps taken. To combine the 3 axes accelerometer data, compute its magnitude: sqrt(x^2 + y^2 + z^2)
Here is an example step count trace where the magnitude of the data is plotted