,

Measuring Force with the Accelerometer

The accelerometer sensor measures the force applied to the device. The sensor detects the force of gravity along with any forces resulting from the movement of the phone. When the device is stationary, this force is equal to that of earth’s gravity. Thus, when stationary, the accelerometer provides the position of the phone relative to the earth. When in the hands of a user, the accelerometer can be used to determine in which direction the user is moving the device, and when the phone is moved suddenly; while playing a game, for example, the force may exceed that of gravity.

The accelerometer is normally used for determining whether the phone is tilted. But it can also be used to allow the device to become the controller, such as steering a car in a game.

The accelerometer measures force in gravitational units (g’s), where 1 g equals (by definition) 9.80665 m/s2 (32.1740 ft/s2).

Ideally, when stationary, accelerator readings range from −1 to 1. Slight variations introduced by differences in the earth’s gravity around the world may take the value outside this range.1

1. Gravity ranges at it is lowest in Mexico City (9.779 m/s2) and highest in Oslo (Norway) and Helsinki (Finland) (9.819 m/s2). Source: http://en.wikipedia.org/wiki/Gravity_of_Earth

Theoretically, if you dropped your phone, in free fall the phone’s accelerometer should read 0.

The accelerometer measures force in three directions. The acceleration value is represented as a three-dimensional vector, representing the dimension components X, Y, and Z axes (see Figure 16.1). The three-dimensional vector represents the direction from the point (0, 0, 0). For example, when the device is placed on a level surface with its screen facing upward, the Z-axis registers a value of −1 g. You can get a feel for the acceleration effects of tilting and flipping the phone using the sample page for this chapter, discussed in a moment.

Image

FIGURE 16.1 Effects on axis values when facing upward.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.148.145.2