# Motion Sensors

**URL:** <https://forum.avicennaresearch.com/t/motion-sensors/1256>\
**Category:** Reference\
**Created:** [June 16, 2025, 9:19am UTC](https://forum.avicennaresearch.com/t/motion-sensors/1256 "2025-06-16T09:19:05Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![mojtaba](https://forum.avicennaresearch.com/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@mojtaba](https://forum.avicennaresearch.com/u/mojtaba)\
**Post date:** [June 16, 2025, 9:19am UTC](https://forum.avicennaresearch.com/t/motion-sensors/1256/1 "2025-06-16T09:19:05Z")

</div>

## Accelerometer

> Supported on Android & iOS.

[Download Sample Data](https://forum.avicennaresearch.com/uploads/short-url/gjGb63662r4yZXgUJfbdnDVbTJ6.csv)

Measures the acceleration force applied to a device in m/s2, including the force of gravity. Data from the accelerometer, together with [Gravity](#p-2883-gravity-13), [Gyroscope](#p-2883-gyroscope-7), and [Magnetic Field](#p-2883-magnetic-field-4) can provide a good estimate of the device’s movement and, subsequently, the participant’s physical activity.

### Use Cases

- **Physical activity and sedentary behavior:** Measuring activity levels and sedentary time patterns
- **Sleep research:** Detecting sleep/wake states based on movement
- **Clinical applications:** Gait analysis, mobility tracking, fall detection, and movement monitoring in neurodegenerative disorders

### Data Structure

Besides [the common data fields](https://forum.avicennaresearch.com/t/data-sources/1266#p-2893-common-data-fields-4), each record contains:

- **X-Axis:** Acceleration force along the x-axis (including gravity), in m/s2. Internally stored as `x_axis`.
- **Y-Axis:** Acceleration force along the y-axis (including gravity), in m/s2. Internally stored as `y_axis`.
- **Z-Axis:** Acceleration force along the z-axis (including gravity), in m/s2. Internally stored as `z_axis`.
- **Accuracy:** The accuracy of the reading. It can be either 1 for low accuracy, 2 for medium accuracy, or 3 for high accuracy. Internally stored as `accu`.

## Magnetic Field

> Supported on Android & iOS.

[Download Sample Data](https://forum.avicennaresearch.com/uploads/short-url/fLVczNvpkTGTe99eEQ8JP9yIkDA.csv)

Measures the ambient geomagnetic field in microtesla (μT) along the three device axes. This sensor captures both the Earth’s magnetic field and local magnetic interference from nearby objects or electronics.

### Use Cases

- **Environmental studies:** Monitoring magnetic field variations across different locations
- **Activity recognition:** Combining with other motion sensors to enhance detection of movements and gestures

### Data Structure

Besides [the common data fields](https://forum.avicennaresearch.com/t/data-sources/1266#p-2893-common-data-fields-4), each record contains:

- **X-Axis:** Geomagnetic field strength along the x-axis, in μT. Internally stored as `x_axis`.
- **Y-Axis:** Geomagnetic field strength along the y-axis, in μT. Internally stored as `y_axis`.
- **Z-Axis:** Geomagnetic field strength along the z-axis, in μT. Internally stored as `z_axis`.
- **Accuracy:** Same as Accuracy in [Accelerometer](#p-2883-accelerometer-1).

## Gyroscope

> Supported on Android & iOS.

[Download Sample Data](https://forum.avicennaresearch.com/uploads/short-url/p9r6NOnYFY8KFM39CtXXvofA3vz.csv)

Measures the rate of rotation of the device around its three axes in radians per second (rad/s). Gyroscope data provides precise information about angular velocity and changes in orientation over time, which can be used for rotation detection (e.g., spin, turn, etc.).

### Use Cases

- **Gesture recognition:** Detecting device or hand movements
- **Motion analysis:** Improving activity recognition and movement tracking when fused with other motion sensors

### Data Structure

Besides [the common data fields](https://forum.avicennaresearch.com/t/data-sources/1266#p-2893-common-data-fields-4), each record contains:

- **X-Axis:** The rate of rotation around the x-axis, in rad/s. Internally stored as `x_axis`.
- **Y-Axis:** The rate of rotation around the y-axis, in rad/s. Internally stored as `y_axis`.
- **Z-Axis:** The rate of rotation around the z-axis, in rad/s. Internally stored as `z_axis`.
- **Accuracy:** Same as Accuracy in [Accelerometer](#p-2883-accelerometer-1).

## Linear Acceleration

> Supported on Android & iOS.

[Download Sample Data](https://forum.avicennaresearch.com/uploads/short-url/7bwHoYwkHRWwkbeJHKVc7fkevFR.csv)

Measures the acceleration force that is applied to the device in m/s2, excluding the force of gravity. This data source is usually implemented as a software-based data source and does not have a dedicated hardware chip on the smartphone. The device measures acceleration from the [Accelerometer](#p-2883-accelerometer-1) sensor, and excludes the gravity measured by the [Gravity](#p-2883-gravity-13) sensor, in order to calculate the linear acceleration.

### Use Cases

- **Physical activity monitoring:** Capturing detailed movement patterns
- **Posture and gait analysis:** Detecting subtle changes in body posture or walking mechanics for clinical or rehabilitation studies
- **Fall and sudden movement detection:** Identifying rapid changes in acceleration that indicate falls or abrupt movements

### Data Structure

Besides [the common data fields](https://forum.avicennaresearch.com/t/data-sources/1266#p-2893-common-data-fields-4), each record contains:

- **X-Axis:** Acceleration force along the x-axis (excluding gravity), in m/s2. Internally stored as `x_axis`.
- **Y-Axis:** Acceleration force along the y-axis (excluding gravity), in m/s2. Internally stored as `y_axis`.
- **Z-Axis:** Acceleration force along the z-axis (excluding gravity), in m/s2. Internally stored as `z_axis`.
- **Accuracy:** Same as Accuracy in [Accelerometer](#p-2883-accelerometer-1).

## Gravity

> Supported on Android & iOS.

[Download Sample Data](https://forum.avicennaresearch.com/uploads/short-url/nbE0LHhYvDF0yn65JWS7JF2qxGB.csv)

Measures the force of gravity that is applied to the device in m/s2. Gravity data is used to isolate gravitational acceleration from device movement, enabling accurate motion and orientation detection (e.g., shake, tilt, etc.).

### Use Cases

- **Posture and balance monitoring:** Tracking body orientation for clinical assessments, fall risk evaluation, or rehabilitation
- **Gait and mobility analysis:** Separating gravitational force from movement to analyze walking patterns or sit-to-stand transitions
- **Activity recognition:** Improving accuracy of activity classification when combined with accelerometer and linear acceleration data

### Data Structure

Besides [the common data fields](https://forum.avicennaresearch.com/t/data-sources/1266#p-2893-common-data-fields-4), each record contains:

- **X-Axis:** Force of gravity along the x-axis, in m/s2. Internally stored as `x_axis`.
- **Y-Axis:** Force of gravity along the y-axis, in m/s2. Internally stored as `y_axis`.
- **Z-Axis:** Force of gravity along the z-axis, in m/s2. Internally stored as `z_axis`.
- **Accuracy:** Same as Accuracy in [Accelerometer](#p-2883-accelerometer-1).

## Orientation

> Supported on Android & iOS.

[Download Sample Data](https://forum.avicennaresearch.com/uploads/short-url/lAHeE9bARk2w3r1b3qxjiGQKmPY.csv)

Measures the device orientation around its axes using the three components of its rotation vector. It can be used to determine tilt, heading, and overall orientation in 3D space.

### Use Cases

- **Posture and ergonomics monitoring:** Tracking device orientation to assess sitting, standing, or working postures in occupational health studies
- **Fall risk and balance assessment:** Detecting body tilts and orientation changes to evaluate stability in elderly or clinical populations

### Data Structure

Besides [the common data fields](https://forum.avicennaresearch.com/t/data-sources/1266#p-2893-common-data-fields-4), each record contains:

- **X-Axis:** Rotation vector component along the x-axis (x \* sin(θ/2)). Internally stored as `x_axis`.
- **Y-Axis:** Rotation vector component along the y-axis (y \* sin(θ/2)). Internally stored as `y_axis`.
- **Z-Axis:** Rotation vector component along the z-axis (z \* sin(θ/2)). Internally stored as `z_axis`.
- **Vector Size:** Scalar component of the rotation vector (cos(θ/2)). This value might not be provided. Internally stored as `vector_size`.
- **Accuracy:** Same as Accuracy in [Accelerometer](#p-2883-accelerometer-1).

## Pedometer

> Supported on Android & iOS.

[Download Sample Data](https://forum.avicennaresearch.com/uploads/short-url/f39pUPawj5WsFom5xzqCc4bLj7A.csv)

Counts the number of steps taken by the participant over a certain duration. Avicenna uses Android and iOS standard algorithms to collect the count of steps taken. For implementation details, refer to [Android Step Counter](https://developer.android.com/reference/android/hardware/Sensor.html#TYPE_STEP_COUNTER) and [Apple CMPedometer](https://developer.apple.com/documentation/coremotion/cmpedometerdata) documentation.

### Use Cases

- **Physical activity monitoring:** Tracking daily step count as an indicator of overall activity and adherence to exercise goals
- **Clinical and rehabilitation research:** Evaluating mobility improvements in patients recovering from surgery, injury, or chronic illness
- **Epidemiological studies:** Assessing relationships between step count, physical activity, and long-term health outcomes such as cardiovascular disease or obesity

### Data Structure

Besides [the common data fields](https://forum.avicennaresearch.com/t/data-sources/1266#p-2893-common-data-fields-4), each record contains:

- **Duration:** The duration over which this record has collected data, in seconds. Internally stored as `duration`.
- **Steps:** The number of steps taken by the participant over the specified duration. Internally stored as `steps`.
- **Accuracy:** The accuracy of the record. This field is available on Android only; iOS records will always store -1. Internally stored as `accu`.
- **Average Active Pace:** The average pace of the participant, measured in seconds per meter. This field is available on iOS only; Android records will always store -1. Internally stored as `avg_active_pace`.
- **Current Cadence:** The rate at which steps are taken, measured in steps per second. This field is available on iOS only; Android records will always store -1. Internally stored as `cur_cadence`.
- **Current Pace:** The current pace of the participant, measured in seconds per meter. This field is available on iOS only; Android records will always store -1. Internally stored as `cur_pace`.
- **Distance:** The estimated distance traveled by the participant, in meters. This field is available on iOS only; Android records will always store -1. Internally stored as `distance`.
- **Floor Ascended:** The approximate number of floors ascended by walking. This field is available on iOS only; Android records will always store -1. Internally stored as `floor_ascended`.
- **Floor Descended:** The approximate number of floors descended by waking. This field is available on iOS only; Android records will always store -1. Internally stored as `floor_descended`.

> [!note]  
> To reduce unnecessary load on the app and system, we ignore/exclude records with zero steps.

## Motion-Based Activity Recognition

> Supported on Android & iOS.

[Download Sample Data](https://forum.avicennaresearch.com/uploads/short-url/vAXfqYlJqxBDWC2ULLWzxWeQojF.csv)

Uses a combination of motion sensors to detect the type of activity that the participant is currently engaged in. Avicenna uses Android and iOS standard algorithms to detect the participant’s type of current activity. Please refer to [Google](https://developers.google.com/android/reference/com/google/android/gms/location/ActivityRecognitionResult) and [Apple](https://developer.apple.com/documentation/coremotion/cmmotionactivity) documentation for implementation details in Android and iOS devices.

### Use Cases

- **Physical activity research:** Automatically identifying activity types to measure overall mobility and energy expenditure
- **Sedentary behavior analysis:** Detecting prolonged periods of inactivity associated with chronic health risks

### Data Structure

Besides [the common data fields](https://forum.avicennaresearch.com/t/data-sources/1266#p-2893-common-data-fields-4), each record contains:

- **Activity Type:** The type of recognized activity. Internally stored as `activity_type`. It can be one of the following values:

- **Confidence Level:** Represents the algorithm’s confidence in the recognized activity. For Android devices, the confidence level is a value between 0 to 100, and for iOS devices, the confidence level is either 0 (low), 1 (medium), or 2 (high). Internally stored as `confidence_level`.

## Additional Information for Motion Sensors

The following information applies to all the motion sensor data sources listed above.

### Adding Data Sources

See [Adding Data Sources](https://forum.avicennaresearch.com/t/data-sources/1266#p-2893-adding-data-sources-1).

### Data Collection Behavior

See [Data Collection Behavior of Avicenna](https://forum.avicennaresearch.com/t/data-sources/1266#p-2893-data-collection-behavior-of-avicenna-5).

### Monitoring and Exporting Data

You can monitor and export motion sensors data using either [the Data Export page](https://forum.avicennaresearch.com/t/raw-data/1241/1) or [Kibana](https://forum.avicennaresearch.com/t/kibana-basics/1289/1).

### Motion Sensors in the Participant App

Participants do not need to do anything (e.g., grant permissions) for these data sources, and the data collection will start immediately.

---

_[View the full topic](https://forum.avicennaresearch.com/t/motion-sensors/1256)._
