[Post] 11 types of sensors in the Android operating system

Source: Internet
Author: User

11 sensors in Android operating system

In the Android2.3 gingerbread system, google provides 11 sensors for the application layer.

 

# Define SENSOR_TYPE_ACCELEROMETER 1 // Acceleration

# Define SENSOR_TYPE_MAGNETIC_FIELD 2 // magnetic

# Define SENSOR_TYPE_ORIENTATION 3 // direction

# Define SENSOR_TYPE_GYROSCOPE 4 // Gyroscope

# Define SENSOR_TYPE_LIGHT 5 // light sensing

# Define SENSOR_TYPE_PRESSURE 6 // pressure

# Define SENSOR_TYPE_TEMPERATURE 7 // Temperature

# Define SENSOR_TYPE_PROXIMITY 8 // close

# Define SENSOR_TYPE_GRAVITY 9 // gravity

# Define SENSOR_TYPE_LINEAR_ACCELERATION 10 // linear acceleration

# Define SENSOR_TYPE_ROTATION_VECTOR 11 // rotating vector

 

Let's look at the eleven sensors in turn.

 

1 Acceleration Sensor

The accelerometer is also called G-sensor, and returns the acceleration values of x, y, and z axes.

This value contains the influence of gravity, measured in m/s ^ 2.

Place the mobile phone on the desktop. The default X axis is 0, the default Y axis is 0, and the default Z axis is 9.81.

Place the phone down on the desktop, and the Z axis is-9.81.

Tilt the phone to the left, and the X axis is positive.

Tilt the phone to the right, and the X axis is negative.

Tilt the phone up. the Y axis is negative.

Tilt the phone down, and the Y axis is positive.

 

Acceleration sensors may be the most mature mems product. There are many types of acceleration sensors on the market.

Commonly used acceleration sensors in mobile phones include BOSCH (BOSCH) BMA series, AMK 897X series, and ST LIS3X series.

These sensors generally provide an acceleration measurement range of ± 2g to ± 16g, and are connected to MCU using I2C or SPI interfaces. The data accuracy is less than 16 bit.

 

2 magnetic sensors

The magnetic sensor (M-sensor) returns environmental magnetic field data of x, y, and z axes.

The unit of this value is micro-Tesla, expressed in uT.

The unit can also be Gaussian, 1 Tesla = 10000 Gauss.

Generally, there is no independent magnetic sensor on the hardware, and the magnetic data is provided by the E-compass sensor ).

The Electronic Compass sensor also provides the following direction sensor data.

 

3-direction Sensor

The direction sensor (O-sensor) returns the three-axis angle data. The unit of the direction data is the angle.

To obtain accurate angle data, E-compass needs to obtain G-sensor data,

The O-sensor data is calculated and produced. Otherwise, only the horizontal angle can be obtained.

The direction sensor provides three data types: azimuth, pitch, and roll.

Azimuth: returns the angle between the magnetic pole and the y-axis at the normal time, ranging from 0 ° to 360 °.

0 ° = North, 90 ° = east, 180 ° = South, 270 ° = West.

Pitch: the angle between the X axis and the horizontal plane. The range is-180 ° to 180 °.

When the Z axis rotates towards the Y axis, the angle is positive.

Roll: the angle between the Y axis and the horizontal plane. The range is-90 ° to 90 ° for historical reasons.

When the X axis moves toward the Z axis, the angle is positive.

 

The Electronic Compass requires calibration before obtaining the correct data. Generally, the 8-character calibration method is used.

The 8-character calibration method requires the user to perform 8-character shaking in the air using the equipment to be calibrated,

In principle, try to direct the device's normal direction to all eight quadrants of the space as much as possible.

 

The Electronic Compass chips used in mobile phones include AKM's 897X series, ST's LSM series, and Yamaha.

To read G-sensor data and calculate M-sensor and O-sensor data,

Therefore, manufacturers generally provide a background daemon to complete their work. The electronic compass algorithm is generally the company's private property.

 

4. gyroscope Sensor

The gyroscope sensor is called Gyro-sensor and returns angle acceleration data of x, y, and z axes.

The angle acceleration unit is radians/second.

According to the Nexus S mobile phone test:

Rotate horizontally counterclockwise, And the Z axis is positive.

Rotate horizontally counterclockwise, And the Z axis is negative.

Rotate to the left, and the Y axis is negative.

Rotate to the right, and the Y axis is positive.

Rotate upwards. The X axis is negative.

Rotate downward. the X axis is positive.

 

ST's L3G series of gyroscope sensors are popular, which are used in iPhone 4 and google's nexus s.

 

5 light sensor

The light sensor detects the real-time light intensity. The unit of light intensity is lux, and its physical meaning is the luminous flux that shines on the area.

The light sensor is mainly used for the LCD automatic brightness function of the Android system.

The brightness of the LCD can be adjusted in real time based on the sampled intensity value.

 

6 Pressure Sensors

The pressure sensor returns the current pressure, in the unit of 100pascal hectopascal (hPa ).

 

7. Temperature Sensor

The temperature sensor returns the current temperature.

 

8 proximity sensors

The distance between the sensor and the mobile phone. The unit is centimeter.

Some proximity sensors can only return two statuses: far and near,

Therefore, close to the sensor returns the maximum distance to the far state, less than the maximum distance to return the near state.

The proximity sensor can be used to automatically turn off the LCD screen when answering calls to save power.

Some chips integrate functions of proximity sensors and light sensors.

 

 

The following three sensors are new sensor types proposed by Android2. it is unclear which applications are used.

9 gravity Sensor

Gravity Sensors are referred to as GV-sensor for output gravity data.

On the earth, the gravity value is 9.8, in the unit of m/s ^ 2.

The coordinate system is the same as the acceleration sensor.

When the device is reset, the output of the gravity sensor is the same as that of the acceleration sensor.

 

10 Linear Acceleration Sensor

Linear accelerometer (LA-sensor.

The linear accelerometer is the data obtained by the accelerometer minus the gravity impact.

The Unit is m/s ^ 2, and the coordinate system is the same as the acceleration sensor.

The formula for calculating the accelerometer, gravity sensor, and linear accelerometer is as follows:

Acceleration = gravity + linear acceleration

 

11. rotating vector sensor

The rotating vector sensor is abbreviated as RV-sensor.

The rotating vector represents the direction of the device and is a data obtained by mixing the coordinate axis and angle.

RV-sensor outputs three data records:

X * sin (theta/2)

Y * sin (theta/2)

Z * sin (theta/2)

Sin (theta/2) is the order of magnitude of RV.

The direction of the RV is the same as that of the axis rotation.

The three values of the RV, which are a triplet with cos (theta/2.

The RV data has no unit, and the coordinate system used is the same as the acceleration.

Example:

Sensors_event_t.data [0] = x * sin (theta/2)

Sensors_event_t.data [1] = y * sin (theta/2)

Sensors_event_t.data [2] = z * sin (theta/2)

Sensors_event_t.data [3] = cos (theta/2)

 

The values of GV, LA, and RV can be directly provided without physical sensors,

G-sensor, O-sensor, and Gyro-sensor are obtained after algorithm calculation.

Algorithms are generally proprietary to sensor companies.

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.