The phone's sensors
Seven sensors (accelerometer, gyroscope, magnetometer, GPS, proximity, light, barometer): what each measures, in which unit and on which axes, how to subscribe to its readings and why to unsubscribe.
- 27 cards
- 7 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- The numbers
- The curves
- Scenarios
- Understand
A few cards from the deck
Accelerometer: what is it?
Show the answer
A sensor that measures the acceleration the phone undergoes along three axes, in m/s², gravity included.
Lying flat and still, it reads about 9.8 m/s² on the z axis: that is gravity. It is used to count steps and to detect a shake or a tilt.
What will
event.valuescontain at each reading received by this listener?
```kotlin
val gyro = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE)
sensorManager.registerListener(this, gyro, SensorManager.SENSOR_DELAY_NORMAL)`- Three rotation speeds in rad/s, one per axis
- Three angles in degrees, the current tilt on each axis
- Three accelerations in m/s², gravity included, one per axis
- Three field strengths in µT, one per phone axis
Show the answer
Three rotation speeds in rad/s, one per axis
A gyroscope only gives the rotation speed around x, y and z, in radians per second. Angles, acceleration and magnetic field come from other sensors.
The … measures rotation speed around each axis, in ….
Show the answer
The gyroscope measures rotation speed around each axis, in radians per second.
It does not give the angle reached, only how fast it changes; for an angle, the readings must be integrated over time.