Search This Blog

Sunday 22 July 2012

Basics of Sensors on Android Platform



Basics about the sensors in Android



The sensors add a value to the Android device just like our sense organs add a value to our life. Android platform provide a rich set of sensors which could be use by applications in many ways. This post will describe about the various sensors and its use for applications on android platform.


Most of the sensors will measure the device motion , orientation and environmental changes. Android divide the sensors in two categories.


Hardware Sensors - The hardware sensors are the physical components embedded on the device and measure the environmental changes like acceleration, geomagnetic field strength, and device rotations.


Software Sensors - The software sensors are not embedded as physical components, they are basic derive the sensor values for hardware devices. The software sensors are also known as virtual sensors.
The gravity sensors are the example of software sensors.


According to the  usage the android provides the following types of sensors

  • Motion Sensors
  • Environmental Sensors
  • Position Sensors
Its not necessary that all devices have all type of sensors, most of the android devices have accelerometer and magnetometer. The device could also have multiple sensors of same type.

see the list of sensors for android platform with there usage.

Sensor
Type
Description
Common Uses
TYPE_ACCELEROMETER
Hardware
Measures the acceleration force in m/s2that is applied to a device on all three physical axes (x, y, and z), including the force of gravity.
Motion detection (shake, tilt, etc.).
TYPE_AMBIENT_TEMPERATURE
Hardware
Measures the ambient room temperature in degrees Celsius (°C). See note below.
Monitoring air temperatures.
TYPE_GRAVITY
Software or Hardware
Measures the force of gravity in m/s2that is applied to a device on all three physical axes (x, y, z).
Motion detection (shake, tilt, etc.).
TYPE_GYROSCOPE
Hardware
Measures a device's rate of rotation in rad/s around each of the three physical axes (x, y, and z).
Rotation detection (spin, turn, etc.).
TYPE_LIGHT
Hardware
Measures the ambient light level (illumination) in lx.
Controlling screen brightness.
TYPE_LINEAR_ACCELERATION
Software or Hardware
Measures the acceleration force in m/s2that is applied to a device on all three physical axes (x, y, and z), excluding the force of gravity.
Monitoring acceleration along a single axis.
TYPE_MAGNETIC_FIELD
Hardware
Measures the ambient geomagnetic field for all three physical axes (x, y, z) in μT.
Creating a compass.
TYPE_ORIENTATION
Software
Measures degrees of rotation that a device makes around all three physical axes (x, y, z).
Determining device position.
TYPE_PRESSURE
Hardware
Measures the ambient air pressure in hpa or mbar.
Monitoring air pressure changes.
TYPE_PROXIMITY
Hardware
Measures the proximity of an object in cm relative to the view screen of a device. This sensor is typically used to determine whether a handset is being held up to a person's ear.
Phone position during a call.
TYPE_RELATIVE_HUMIDITY
Hardware
Measures the relative ambient humidity in percent (%).
Monitoring dewpoint, absolute, and relative humidity.
TYPE_ROTATION_VECTOR
Software or Hardware
Measures the orientation of a device by providing the three elements of the device's rotation vector.
Motion detection and rotation detection.
TYPE_TEMPERATURE
Hardware
Measures the temperature of the device in degrees Celsius (°C).
Monitoring temperatures.

You can develop very interesting applications around sensors like motion sensor based games, weather applications, motion detection applications, checking your position and much more.

Android provides a complete development framework is android SDK to manage the sensors. Please read the following post to get more details on the android framework.

If you like the post please provide your feedback as comments.

Thanks
Creative Android Apps

No comments:

Post a Comment