# Mobile Sensors
IoTtalk supports following types of sensors that are built into a mobile device:
1. Accelerometer (Acceleration)
2. Gyroscope
3. Inclinometer (Orientation)
4. Magnetometer
## Accelerometer (Acceleration)
The Accelerometer sensor measures G-force values along the X, Y, and Z axes of the device and is great for simple motion-based applications. Note that G-force values include acceleration due to gravity.

The following diagrams illustrate:
* V1 = Vector 1 = Force due to gravity
* V2 = Vector 2 = -Z axis of device chassis (points out of back of screen)
* Θ~i~ = Tilt angle (inclination) = angle between -Z axis of device chassis and gravity vector
Apps that might use the accelerometer sensor include a game where a marble on the screen rolls in the direction you tilt the device (gravitational vector). This type of functionality closely mirrors that of the Inclinometer and could also be done with that sensor by using a combination of pitch and roll. Using the accelerometer’s gravity vector simplifies this somewhat by providing an easily mathematically manipulated vector for device tilt. Another example would be an app that makes a whip’s cracking sound when the user flicks the device through the air (linear acceleration vector).
## Gyroscope
The Gyrometer sensor measures angular velocities along the X, Y, and Z axes. These are very useful in simple motion-based apps that do not concern themselves with device orientation but care about the device rotating at different speeds. Gyrometers can suffer from noise in the data or a constant bias along one or more of the axes. You should query the accelerometer to verify whether the device is moving in order to determine if the gyrometer suffers from a bias, and then compensate accordingly in your app.

An example of an app that could use the gyrometer sensor is a game that spins a roulette wheel based on a quick rotational jerk of the device.
## Inclinometer (Orientation)
The Inclinometer sensor specifies the yaw, pitch, and roll values of a device and work best with apps that care about how the device is situated in space. Pitch and roll are derived by taking the accelerometer’s gravity vector and by integrating the data from the gyrometer. Yaw is established from magnetometer and gyrometer (similar to compass heading) data. Inclinometers offer advanced orientation data in an easily digestible and understandable way. Use inclinometers when you need device orientation but do not need to manipulate the sensor data.

Apps that change their view to match the orientation of the device can use the inclinometer sensor. Also, an app that displays an airplane that matches the yaw, pitch, and roll of the device would also use the inclinometer readings.
## Magnetometer
The Magnetometer sensor lets you monitor changes in the earth's magnetic field. This sensor provides raw field strength data (in μT) for each of the three coordinate axes. The Magnetometer measures the intensity of Earth’s magnetic field (or a local source of magnetism like a bar magnet) along each axis using a Hall Effect sensor. Usually, you do not need to use this sensor directly.
## Reference
[Understanding Sensor Fusion and Tracking, Part 2: Fusing a Mag, Accel, & Gyro Estimate
](https://www.youtube.com/watch?v=0rlvvYgmTvI)
[Sensor Fusion on Android Devices: A Revolution in Motion Processing](https://www.youtube.com/watch?v=C7JQ7Rpwn2k)
[Towards understanding IMU: Basics of Accelerometer and Gyroscope Sensors and How to Compute Pitch, Roll and Yaw Angles](https://atadiat.com/en/e-towards-understanding-imu-basics-of-accelerometer-and-gyroscope-sensors/)
https://learn.microsoft.com/en-us/windows/uwp/devices-sensors/sensors
https://developer.android.com/guide/topics/sensors