1. Introduction
Cell phone sensors introduce mobile sensors to detect all available sensors on your Android phone, and graphically show how they work with images. Cell phone sensors can also identify which sensors are supported by the phone's hardware and provide a sensing tool that plays an important role in our daily lives. The phone sensor can only detect changes. If the property does not change, it displays values for temperature, distance, light, and pressure that may be inaccurate.
2. sensors commonly used in mobile phones
in the Android2.3 Gingerbread System, Google provides a One use of the sensor 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 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_ACCELERATION10// Linear Acceleration
#define Sensor_type_rotation_vector 11// rotation Vector
Let's look at these 11 sensors in turn.
2.1 Acceleration Sensor
acceleration Sensors are also called G-sensor , return x , y , Z the three-axis acceleration value.
This value contains the effect of gravity, in which the unit is m/s^2 .
put your phone flat on the desktop, x the axis defaults to 0 , y axis Default 0 , Z axis Default 9.81 .
put your phone face down on the desktop, Z axis is -9.81 .
tilt the phone to the left, x the axis is positive.
tilt the phone to the right, x the axis is negative.
tilt the phone upward, y the axis is negative.
tilt the phone down, y the axis is positive.
The accelerometer is probably the most mature MEMS products, there are many kinds of accelerometer sensors on the market.
The accelerometer commonly used in mobile phones has bosch (Bosch) BMA series, amk 897x series, st lis3x series.
These sensors generally provide ±2G to ±16G the acceleration measurement range, using I²c or SPI Interfaces and MCU data accuracy is less than 16bit .
An accelerometer is a sensor that detects the acceleration of an object. The acceleration of motion is also changed, and if the acceleration is taken, what force the object is subjected to or what kind of motion the object carries out, we can know. Using acceleration, we can do the simulation of pedometer, object motion application.
the 3 elements of the values variable of the accelerometer are represented by X,Y , respectively. , Z the acceleration value of the axis. the gravity sensor uses the same set of coordinate systems as the accelerometer sensor. The three elements in the values array represent X,Y,Z , respectively. the gravity size of the axis.
2.2 Magnetic Sensors
magnetic sensors are referred to as M-sensor , return x , y , Z three-axis environmental magnetic field data.
The unit of the value is micro-Tesla ( Micro-tesla ), with UT representation.
The unit 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 direction sensor data for the following.
2.3 Direction Sensor
the direction sensor is referred to as O-sensor , the angle data of the three axes is returned, and the unit of the direction data is the angle.
in order to obtain accurate angular data, E-compass need to get G-sensor of data,
after the calculation of production O-sensor data, otherwise only the horizontal angle can be obtained.
The direction sensor provides three data, respectively Azimuth , Pitch and the Roll .
Azimuth : Azimuth, return horizontal when magnetic north Pole and Y the angle of the shaft, the range of 0° to 360° .
0°= North, 90°= East, 180°= South, 270°= West.
Pitch : x the angle of the shaft and the horizontal plane, the range of -180° to 180° .
when Z Axial Direction y when the axis rotates, the angle is positive.
Roll : y the angle of the shaft and the horizontal plane, for historical reasons, the range is -90° to 90° .
when x Axial Direction Z when the axis moves, the angle is positive.
The electronic compass needs to be calibrated before it can get the correct data, usually 8 Word calibration method.
8 The Word calibration method requires the user to use a device that needs to be calibrated in the air 8 Word shaking,
in principle, as much as possible to point the device normal direction to all the space 8 a quadrant.
the electronic compass chip used in the mobile phone has AKM Company's 897X Series, ST Company's LSM series as well as Yamaha Inc. and so on.
because of the need to read G-sensor data and calculate the M-sensor and the O-sensor data,
As a result, vendors typically provide a background Daemon to complete the work, the electronic compass algorithm is generally the company's private property rights.
2.4 Gyro Sensor
gyroscope sensors are called Gyro-sensor , return x , y , Z three-axis angular acceleration data.
the unit of angular acceleration is Radians/second .
according to Nexus S mobile phone measurement:
rotate horizontally counterclockwise, Z the axis is positive.
rotate horizontally counterclockwise, Z the axis is negative.
Rotate Left, y the axis is negative.
Rotate Right, y the axis is positive.
rotate Upward, x the axis is negative.
rotate Down, x the axis is positive.
ST of the l3g the series of gyroscope sensors are more popular, iphone4 and the Google of the Nexus S used in this type of sensor.
2.5 Light Sensing sensor
The light sensor detects real-time light intensity, and the unit of intensity is Lux , the physical meaning is the luminous flux that is irradiated to the unit area.
Light sensing sensors are mainly used for Android System of LCD Auto Brightness function.
can be adjusted in real time according to the sampled light intensity values LCD the brightness.
2.6 Pressure sensor
The pressure sensor returns the current pressure in the unit of KPA hectopascal ( HPa ).
2.7 Temperature Sensor
The temperature sensor returns the current temperature.
2.8 Proximity Sensor
The proximity sensor detects the distance between the object and the phone, in centimeters.
Some proximity sensors can only return far and near two states,
Therefore, the proximity sensor returns the maximum distance to the far state, which is less than the maximum distance to return to the near state.
Proximity sensor can be used to automatically turn off when answering a phone LCD screen to conserve power.
Some chips have integrated proximity sensors and light sensors for both functions.
The following three sensors are Android2 the newly proposed sensor type is not yet clear as to which applications are used.
2.9 Gravity sensor
Gravity sensor abbreviation 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 accelerometer sensor.
When the device is reset, the output of the gravity sensor is the same as the accelerometer sensor.
2.10 Linear acceleration Sensor
linear acceleration Sensor abbreviation La-sensor .
The linear accelerometer is the data obtained by the acceleration sensor minus the gravity effect.
units are m/s^2 , the coordinate system is the same as the accelerometer sensor.
The formula for acceleration sensors, gravity sensors and linear accelerometer is as follows:
Acceleration = Gravity + Linear Acceleration
2.11 rotational vector Sensors
rotary vector sensor abbreviation Rv-sensor .
The rotation vector represents the direction of the device, which is a mix of axes and angles to calculate the data.
Rv-sensor output of three data:
X*sin (THETA/2)
Y*sin (THETA/2)
Z*sin (THETA/2)
sin (THETA/2) is a RV order of magnitude.
RV is in the same direction as the Axis rotation.
RV of three values, with cos (THETA/2) make up a four-tuple.
RV The data has no units, and the coordinate system used is the same as 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 the RV no physical sensor can be given directly,
need to G-sensor , O-sensor and the Gyro-sensor after the calculation of the algorithm is obtained.
The algorithm is usually the private property of the sensor company.
Built-in sensor---smartphone (data)