2013年8月10日星期六

Android commonly used sensor usage list (2)

 

in Android2.3 gingerbread system, google offers 11 kinds of sensors for use by layer uses.

# 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 / / close
# define SENSOR_TYPE_GRAVITY ; 9 / / Gravity
# define SENSOR_TYPE_LINEAR_ACCELERATION 10 / / linear acceleration
# define SENSOR_TYPE_ROTATION_VECTOR 11 / / rotation vector

we look at this in turn eleven kinds of sensors

1
acceleration sensor acceleration sensor called G-sensor, return x, y, z axes acceleration values.
This value includes the effects of gravity, the unit is m / s ^ 2.
the phone flat on the table, x-axis defaults to 0, y-axis default 0, z-axis default 9.81.
the phone down on the table, z-axis is -9.81.
Tilt your phone left, x-axis is positive.
tilt the phone to the right, x-axis is negative.
tilt the phone upwards, y-axis is negative.
the phone downwards, y-axis is positive.

acceleration sensor may be a mems most mature products on the market many types of acceleration sensors.
acceleration sensors commonly used in mobile phones have BOSCH (Bosch) The BMA series, AMK's 897X series, ST's LIS3X series.
These sensors generally provide ± 2G to ± 16G acceleration measurement range, using I2C or SPI interface and connected to the MCU, the data accuracy of less than 16bit.

2
magnetic sensor magnetic sensor referred to as M-sensor, return x, y, z-axis magnetic field data environment.
The values ​​are in micro-Tesla (micro-Tesla), expressed by uT.
units can also be a Gaussian (Gauss), 1Tesla = 10000Gauss.
hardware generally no separate magnetic sensors, magnetic data from the electronic compass sensors (E-compass).
electronic compass sensor while providing direction below the sensor data.

3
orientation sensor direction sensor referred to as O-sensor, three-axis angle data returned, the unit is the angle orientation data.
In order to get an accurate angle data, E-compass need to get G-sensor data,
After calculation of production O-sensor data, or can only get the horizontal angle.
orientation sensor provides three data, namely, azimuth, pitch and roll.
azimuth: azimuth, the magnetic North Pole and return to the level of the Y-axis angle in the range of 0 ° to 360 °.
0 ° = North, 90 ° = East, 180 ° = South, 270 ° = West.
pitch: x-axis and the horizontal angle in the range of -180 ° to 180 °.
When the z-axis y-axis rotation, the angle is positive.
roll: y-axis and the horizontal plane, due to historical reasons, ranging from -90 ° to 90 °.
z axis when the x-axis, the angle is positive.

electronic compass before obtaining the correct data needs to be calibrated, the calibration method is usually used 8 characters.
8 characters calibration method requires the user to use the device needs to be calibrated in the air and doing eight characters shaking,
in principle, allow the device as much space normals pointing in the direction of all eight quadrants.

phone chips used in electronic compass with AKM's 897X series, ST's LSM series and Yamaha Corporation and so on.
Because of the need to read G-sensor data and calculates the M-sensor and O-sensor data,
so manufacturers will generally provide a background daemon to complete the work, the company's electronic compass algorithm is generally private property.

4
gyro sensor gyro sensor called Gyro-sensor, return x, y, z-axis angular acceleration data.
angular units are radians / second.
measured according to Nexus S Phone:
horizontal counterclockwise rotation, Z axis is positive.
horizontal counterclockwise rotation, z-axis is negative.
Rotate left, y-axis is negative.
right rotation, y-axis is positive.
upward rotation, x-axis is negative.
rotated downward, x-axis is positive.

ST series of L3G more popular gyro sensor, iphone4 and use the google nexus s the kind of sensors.

5
sensor light sensor light sensor light sensor detects the real strength of the light intensity in units of lux, its physical meaning is irradiated to the luminous flux per unit area.
sensor light sensor LCD Android system is mainly used for automatic brightness function.
according to the light intensity values ​​sampled real-time to adjust the LCD brightness.

6
pressure sensor pressure sensor returns the current pressure, the unit is hPa hectopascal (hPa).

7
temperature sensor temperature sensor returns the current temperature.

8
proximity sensor proximity sensor detects the distance between the object and the mobile phone, the unit is cm.
Some proximity sensor can return only two states near and far,
Therefore, the maximum distance proximity sensor will return to the state is far less than the maximum distance to return nearly state.
proximity sensors can be used to answer the phone automatically turns off the LCD screen to save power.
Some chip integrates both the proximity sensor, and light sensor function.


The following three sensors are Android2 proposed new sensor type, is less clear what applications.
9 Gravity Sensor Gravity Sensor Short
GV-sensor, output gravity data.
On Earth, gravity value of 9.8, the unit is m / s ^ 2.
same coordinate system and the acceleration sensor.
When the device is reset, gravity sensor output with the same acceleration sensor.

10
linear acceleration sensor linear acceleration sensor referred LA-sensor.
linear acceleration sensor is an acceleration sensor data obtained by subtracting the influence of gravity.
unit is m / s ^ 2, the same coordinate system and the acceleration sensor.
acceleration sensor, gravity sensor and linear acceleration sensor is calculated as follows:
acceleration = gravity + linear acceleration

11
rotation vector sensor short rotation vector sensor RV-sensor.
rotation vector represents the direction of the device, is a mixture of the axis and angle calculated data.
RV-sensor outputs three data:
x * sin (theta / 2)
y * sin (theta / 2)
z * sin (theta / 2)
sin (theta / 2) is the magnitude of the RV.
RV direction of shaft rotation in the same direction.
RV three numbers, and cos (theta / 2) to form a quad.
RV data no units, using the same coordinate system and 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)

GV, LA and RV's Numerical no physical sensors can be given directly,
need G-sensor, O-sensor and Gyro-sensor, obtained through the algorithm.
algorithm is generally the sensor's private property.

没有评论:

发表评论