Skip to main content

Accelerometer (lamp.accelerometer)

Records device acceleration in three axes. Units are g (multiples of gravitational acceleration, where 1 g ā‰ˆ 9.81 m/s²). At rest with the screen facing up, the z-axis reads approximately -1.0 g. The coordinate plane is relative to the device.

Configuration​

  • SensorSpec: lamp.accelerometer
  • Sampling: Discrete (default 5 Hz — 5 samples per second)
  • Platform: iOS, Android
  • Permissions: Motion & Fitness required

Configure sampling rate via the API.

API settings fields
SettingAPI FieldTypeDefaultMax
Sampling Ratefrequencynumber (Hz)55

Quality Factors​

  • Motion & Fitness permissions must be granted.
  • Battery optimization can restrict background sensor access.
  • Higher sampling rates produce more granular data but consume more battery.

Usage​

Accelerometer data is collected continuously in the background. No participant action is required.

note

On Android, accelerometer data may be delivered inside a DeviceMotion-style structure with a motion sub-object. Cortex normalizes this automatically. The data format described here is the canonical iOS format.

Data​

Fields​

FieldTypeUnitDescription
xfloatgAcceleration on x-axis (left to right across the screen)
yfloatgAcceleration on y-axis (bottom to top of the screen)
zfloatgAcceleration on z-axis (out from the screen toward the user)

Example​

{
"timestamp": 1649859212042,
"sensor": "lamp.accelerometer",
"data": {
"x": 0.19378,
"y": 1.28474,
"z": -0.19385
}
}

Cortex Features​

accelerometer (raw) → acc_jerk (primary) → inactive_duration (secondary)

View in Portal | Python SDK | API Reference