Android Operating System introduction of 11 kinds of sensors _android

Source: Internet
Author: User
Tags cos sin

Android is a Linux based free and open source operating system, mainly used in mobile devices such as smartphones and tablets, led and developed by Google and the Open Cell Alliance. Next, we will introduce the 11 kinds of sensors introduced by Android operating system.

In the Android2.3 gingerbread system, Google provides 11 types of sensors for use in the supply 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 sensor
#define SENSOR_TYPE_PRESSURE 6//pressure
#define Sensor_type_temperature 7//temperature
#define Sensor_type_proximity 8//near
#define Sensor_type_gravity 9//Gravity
#define Sensor_type_linear_acceleration 10//Linear acceleration
#define Sensor_type_rotation_vector 11//Rotation vector

Let's look at these 11 sensors in turn.

1 Acceleration Sensor

The accelerometer, also called g-sensor, returns the acceleration values of the X, Y, and z triaxial axes.

The value contains the effect of gravity, the unit is m/s^2.

Put the phone flat on the desktop, the X axis defaults to the 0,y axis default 0,z axis default 9.81.

Turn the phone down on the desktop, and the z-axis is-9.81.

Tilt the phone to the left and the x-axis to positive.

Tilt the phone to the right with a negative x-axis.

Tilt the phone up and the Y axis is negative.

Tilt the phone down and the y-axis is positive.

The accelerometer may be the most mature MEMS product, and there are many kinds of accelerometer in the market.

The commonly used accelerometer in mobile phone is Bosch (Bosch) BMA series, AMK 897X series, St LIS3X series, etc.

These sensors generally provide ±2g to ±16g acceleration measurement range, using I2C or SPI interface and MCU connected, data accuracy less than 16bit.

2 Magnetic Sensors

The magnetic sensor is referred to as m-sensor and returns the environmental magnetic field data of x, Y and Z axes.

The unit of this value is the micro-Tesla (Micro-tesla), which is expressed in UT.

Units can also be Gauss (Gauss), 1tesla=10000gauss.

There is generally no independent magnetic sensor on the hardware, and the magnetic data is provided by the electronic Compass Sensor (E-COMPASS).

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

3 Direction Sensor

The direction sensor is referred to as o-sensor, returns the angle data of the three axes, the unit of direction data is the angle.

In order to obtain the accurate angle data, the e-compass need to obtain the g-sensor data,

After the calculation of production o-sensor data, you can only get the horizontal direction of the angle.

The directional sensor provides three data, namely azimuth, pitch and roll.

Azimuth: Azimuth, returns the angle between the magnetic north and the Y axis at a horizontal time, ranging from 0° to 360°.

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

The angle between the pitch:x axis and the horizontal plane, ranging from -180° to 180°.

When the z axis rotates to the y-axis, the angle is positive.

The angle between the roll:y axis and the horizontal plane, for historical reasons, ranges from -90° to 90°.

The angle is positive when the x axis moves to the z-axis.

The electronic compass needs to be calibrated before acquiring the correct data, usually with a 8-word calibration method.

The 8-word calibration requires the user to use a device that needs to be calibrated to do 8-word shaking in the air,

In principle, as much as possible to let the device normal direction to point to all 8 quadrants of space.

The electronic compass chip used in the mobile phone has the 897X series of AKM Company, the LSM series of St Company and Yamaha company and so on.

Because of the need to read g-sensor data and compute m-sensor and o-sensor data,

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

4 Gyroscope Sensors

The gyroscope sensor, called gyro-sensor, returns the angular acceleration data for the X, y, and Z axes.

The unit of angular acceleration is radians/second.

According to Nexus S mobile measurement:

Horizontal counterclockwise rotation, Z axis is positive.

Rotate horizontally counterclockwise with a negative Z axis.

Rotate left, minus y axis.

Rotate to the right and the Y axis is positive.

Rotate up, minus x axis.

Rotate downward and the x-axis is positive.

ST's L3G series gyroscope sensors are more popular, iphone4 and Google's Nexus S are used in the sensor.

5 Light Sensing Sensor

Light sensor detects real-time light intensity, the light intensity unit is lux, its physical meaning is to illuminate the luminous flux on the unit area.

The light sensing 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 according to the intensity value of the sample.

6 Pressure Transducer

The pressure transducer returns the current pressure in units of the hectopascal (HPa).

7 Temperature Sensor

The temperature sensor returns the current temperature.

8 Proximity Sensor

The proximity sensor detects the distance between the object and the cell phone, in centimeters.

Some proximity sensors can only return far and nearly two states,

As a result, the proximity sensor returns the maximum distance to a far state and is less than the maximum distance to return to the nearest state.

Proximity sensors can be used to automatically turn off the LCD screen to save power when answering the phone.

Some chips integrate proximity sensors and light sensors in both functions.

The following three sensors are the new sensor types proposed by ANDROID2, and it is not clear what applications are being used.

9 Gravity Sensor

Gravity sensors are referred to as gv-sensor and output gravity data.

On Earth, the value of gravity is 9.8, the unit is 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 is referred to as la-sensor.

Linear accelerometer is the acceleration sensor minus the gravitational impact of the data obtained.

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

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

Acceleration = gravity + linear acceleration

11 Rotating Vector Sensor

The rotational vector sensor is referred to as rv-sensor.

The rotation vector represents the direction of the device and is a mixture of axes and angles to calculate the data.

Rv-sensor output Three data:

X*sin (THETA/2)
Y*sin (THETA/2)
Z*sin (THETA/2)

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

The direction of the RV rotates the same direction as the axis.

The three values of the RV, and the cos (THETA/2) Form a four-tuple group.

The RV's data has no units and uses the same coordinate system 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 number of GV, LA, and RV can be directly given without physical sensors, which requires g-sensor, O-sensor and gyro-sensor to be calculated after calculation.

The algorithm is usually the private property right of the sensor company.

The above is a small set to introduce the Android operating system introduced 11 kinds of sensors, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.