CoderTools

Motion Sensor Test

Test accelerometer, gyroscope, and orientation sensors in real-time

Accelerometer
Gyroscope
Orientation

3D Visualization

Rotate your device to see real-time response

Accelerometer Data m/s²

X 0.00
Y 0.00
Z 0.00

Gyroscope Data °/s

X 0.00
Y 0.00
Z 0.00

Orientation Data

0.0°
Alpha (Z)
Compass direction (0-360°)
0.0°
Beta (X)
Front/back tilt (-180° to 180°)
0.0°
Gamma (Y)
Left/right tilt (-90° to 90°)

Real-time Data Graph

X Y Z
Accelerometer
Gyroscope

Peak Values

Max Acceleration 0.00 m/s²
Max Rotation 0.00 °/s

API Information

Active API -
Sample Rate 0 samples/sec

Understanding Motion Sensors

What Are Motion Sensors?

Modern smartphones and tablets contain multiple motion sensors that detect device movement and orientation. These sensors enable features like automatic screen rotation, fitness tracking, and augmented reality applications.

This tool provides direct access to your device's motion sensors through web browser APIs, allowing you to verify sensor functionality and observe real-time sensor data.

Types of Motion Sensors

Accelerometer

Measures acceleration forces acting on the device, including gravity. The accelerometer detects motion along three axes: X (left-right), Y (forward-backward), and Z (up-down). When stationary, the accelerometer reads approximately 9.8 m/s² in the direction of gravity.

Gyroscope

Measures the rate of rotation around the device's three axes. Unlike the accelerometer, the gyroscope is unaffected by gravity and provides angular velocity data. This sensor is essential for tracking device orientation changes and rotational movements.

Orientation Sensors

Combines data from the accelerometer, gyroscope, and optionally the magnetometer to determine the device's absolute orientation in 3D space. Orientation is expressed using three angles: Alpha (compass heading), Beta (front-back tilt), and Gamma (left-right tilt).

Common Applications

Gaming

Racing games, flight simulators, and AR games use motion sensors for intuitive tilt-based controls.

Fitness Tracking

Step counting, workout detection, and activity monitoring rely heavily on accelerometer data.

Navigation

Augmented reality navigation and compass applications use orientation sensors to overlay directions on camera views.

Photography

Camera apps use motion sensors for optical image stabilization and panorama capture alignment.

Technical Notes

  • Motion sensors require HTTPS for security reasons. Sensor data is processed entirely in your browser.
  • iOS 13 and later require explicit user permission before accessing motion sensors. Tap the Start button to trigger the permission dialog.
  • Sensor accuracy varies between devices. Consumer-grade sensors are suitable for general motion detection but not for precision measurements.

Browser Compatibility

Motion sensor support varies across browsers and platforms:

Chrome on Android: Full support
Safari on iOS: Requires permission prompt
Firefox: Limited support
Edge on Android: Full support
Desktop browsers: Limited (requires physical sensors)

For best results, use this tool on a mobile device with the latest browser version.

Frequently Asked Questions

Why is my device showing no sensor data?

There are several common causes. First, make sure you are using a device with built-in motion sensors (most smartphones and tablets have them; desktop computers and most laptops do not). Second, this tool must be served over HTTPS — browsers block access to device sensors on plain HTTP pages for security reasons. Third, on iOS 13 and later, Safari requires a user gesture to request permission before DeviceMotion events are available; tap the permission button on the page if shown. Fourth, some browsers on Android may require the page to be in the foreground and fully active.

What is the difference between an accelerometer and a gyroscope?

An accelerometer measures linear acceleration — changes in velocity along the X, Y, and Z axes, including the constant acceleration due to gravity. When a device is lying flat and stationary on a table, the accelerometer reads approximately 0, 0, 9.8 m/s² (gravity pulling downward). A gyroscope measures angular velocity — how fast the device is rotating around each axis, expressed in degrees per second (°/s). Gyroscopes are unaffected by gravity and linear movement; they only detect rotation. Together, the two sensors complement each other to provide a full picture of device movement.

What units do motion sensors use for their measurements?

The accelerometer reports values in meters per second squared (m/s²). At rest on Earth, the total magnitude is approximately 9.8 m/s² due to gravitational acceleration. The gyroscope reports angular velocity in degrees per second (°/s); some systems use radians per second instead. The DeviceOrientation API reports orientation angles in degrees: alpha is the compass direction (0–360°), beta measures front-to-back tilt (−90° to +90°), and gamma measures left-to-right tilt (−90° to +90°).

Why does iOS 13+ require explicit permission for motion sensors?

Prior to iOS 13, Safari granted web pages automatic access to DeviceMotion and DeviceOrientation events without asking the user. Researchers demonstrated that these sensors could be exploited to identify walking patterns, infer PIN codes typed on a keyboard, and extract other sensitive behavioral data, raising significant privacy concerns. Apple responded in iOS 13 by requiring websites to explicitly request user permission via the DeviceMotionEvent.requestPermission() API, which must be triggered by a direct user action such as a button tap. This permission is session-scoped and must be requested again on each page load.

What is the difference between the DeviceOrientation and DeviceMotion APIs?

The DeviceOrientation API fires the deviceorientation event and reports the physical orientation of the device in space as three angles: alpha (rotation around the vertical/Z axis), beta (tilt around the X axis), and gamma (tilt around the Y axis). It describes where the device is pointing, not how it is moving. The DeviceMotion API fires the devicemotion event and reports the actual forces acting on the device: acceleration (with and without gravity) from the accelerometer, and rotation rate from the gyroscope. DeviceMotion is better suited for detecting shakes, steps, and directional movement, while DeviceOrientation works well for compass-style heading and tilt-based interfaces.

Related Tools

Quick Menu

No recent tools