Main Content

Accelerometer

Measure linear acceleration along X, Y, and Z axes in m/s2

Add-On Required: This feature requires the Simulink Support Package for Android Devices add-on.

  • Accelerometer block

Libraries:
Simulink Support Package for Android Devices / Sensors

Description

Use the Accelerometer block to measure linear acceleration along the X, Y, and Z axes in m/s2.

The following illustration shows the X, Y, and Z orientation axes relative to a typical Android® mobile phone.

The following illustration shows the X, Y, and Z orientation axes relative to a typical Android tablet.

The X, Y, and Z orientation axes relative to the device remain constant. For example, if you place the device face-up on a table, the Z-axis measures the acceleration of Earth gravity and outputs ≈ 9.81 in m/s2. The X and Y axes, which are perpendicular to the acceleration of Earth gravity, both output ≈ 0.00 in m/s2.

Note

During simulation with no hardware connected, this block does nothing. For more information, see Block Produces Zeros or Does Nothing in Simulation.

Ports

Output

expand all

The block outputs the X-axis accelerometer data of the device.

Data Types: single

The block outputs the Y-axis accelerometer data of the device.

Data Types: single

The block outputs the Z-axis accelerometer data of the device.

Data Types: single

Parameters

expand all

Specify a discrete time interval, in seconds, at which the block reads the accelerometer sensor of the device and outputs the data.

Note

Smaller values for Sample time require the processor to complete the same number of instructions in less time, which can cause task overruns.

Version History

Introduced in R2014a