https://github.com/bradhowes/motioncollector
Simple iOS app to collect data from CoreMotion sensors.
https://github.com/bradhowes/motioncollector
coredata coremotion coremotion-sensors icloud ios swift swift5
Last synced: 5 months ago
JSON representation
Simple iOS app to collect data from CoreMotion sensors.
- Host: GitHub
- URL: https://github.com/bradhowes/motioncollector
- Owner: bradhowes
- License: mit
- Created: 2019-10-15T21:29:24.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-01-01T20:32:38.000Z (almost 2 years ago)
- Last Synced: 2025-04-08T11:43:34.226Z (6 months ago)
- Topics: coredata, coremotion, coremotion-sensors, icloud, ios, swift, swift5
- Language: Swift
- Size: 608 KB
- Stars: 16
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://github.com/bradhowes/MotionCollector/actions/workflows/CI.yml)
[](https://github.com/bradhowes/MotionCollector/blob/main/.github/workflows/CI.yml)

[](https://opensource.org/licenses/MIT)# About MotionCollector

This simple application records values coming from an iOS device's CoreMotion sensors (accelerometer, gyroscope,
and magnetometer) and makes them available in a CSV formatted file in iCloud or iTunes (RIP). My goal in
creating this app was to allow for quick data collection while moving with the device. After collection, the
data would be processed with Apple's CoreML application for learning and (hopefully) future categorization of
activity based on sensor data.The code works with Xcode 11 and Swift 5. Should work without problems with earlier versions, but the current
storyboard layout uses iOS 13 features. There would be minimal adjustments to make it work on older iOS
versions.## Using
There are three views in this app:
1. Main recording view with a _Start/Stop_ button and movement buttons.
2. Recording history list that shows active and past event recordings. Swipe on a row to (re)upload, share, or
delete the recording.
3. Settings view reachable from the main recording view via the _gear_ icon.
Press _Start_ to begin a new recording of sensor data. Move around.

When done, press _Stop_ to quit data collect. If _iCloud_ is enabled for the device, the app will attempt to copy the
file to your _iCloud Drive_, in a folder called _MotionCollector_.
Each recording fie is named with the date/time when the recording started. They all have the suffix _.csv_ so
you should be able to open them in whatever editor or spreadsheet application you wish.Drag right on a recording to see controls for uploading and sharing the recorded values as a CSV file. Drag left to
reveal a trash can to touch to remove the recording.## Configuration
You can control which components are samples for data capture, the rate of data capture, and if the files are stored in
an iCloud folder.
## Data File Format
The file consists of lines of comma-separated values (CSV). The first line contains column labels for the rest
of the rows.* Source -- indicates which sensor emitted the data.
> * A = accelerometer
> * D = device motion
> * G = gyroscope
> * M = magnetometer (compass)* Label -- indicates the current user activity, W = walking, T = turning
* When -- timestamp of the record. These are given as number of seconds since 00:00:00 UTC 1 January, 1970 or
the Unix epoch, though the resolution of the values is much finer than a second.All sensors emit at minimum three values, one for each of the 3 axis that define the orientation of the device
in the real world.* X -- X axis sensor value
* Y -- Y axis sensor value
* Z -- Z axis sensor valueFor the _device motion_ records (Source == 'D'), there are 9 values instead of 3.
* X -- X axis rotation rate
* Y -- Y axis rotation rate
* Z -- Z axis rotation rate
* UA_X -- X axis user acceleration
* UA_Y -- Y axis user acceleration
* UA_Z -- Z axis user acceleration
* Pitch -- device rotation about the X axis
* Roll -- device rotation about the Y axis
* Yaw -- device rotation about the Z axisSee [this
page](https://developer.apple.com/documentation/coremotion/getting_processed_device-motion_data/understanding_reference_frames_and_device_attitude)
for a discussion of the _pitch_, _roll_, and _yaw_ values and how they relate to the device.