Accelerometer and gyroscope are sensors available in almost all smartphones; the accelerometer is a sensor able to detect the motion of the phone (e.g. along the vertical or horizontal direction), while the gyroscope perceives its rotation. Normally they are used together to detect changes in the position of the phone for example to accommodate the screen orientation (portrait or landscape) or to run some action games.
In some smartphones, also barometers and magnetometers are available. The barometer senses atmospheric pressure and is normally used to compute altitude, and the magnetometer detects the magnetic field and is utilised as a compass in our smartphone.
The whole group of these sensors may be used as an ensemble to supply a detailed description of our motion, but the quality and meaningfulness of this narrative depend on where the smartphone is placed: it needs to be on our body, preferably in a predefined location. So, if we want to get an accurate description of a gesture by the smartphone, we need to be actively participating. This means starting the recording of sensors through a devoted application, performing a predefined movement, and stopping the data acquisition.
This kind of use of the smartphone sensors is called active, because it requires the performance of voluntary action on our side, in this case, to allow the recording of the way we execute an agreed task.
However, the same sensors may be used also in a passive way, that is they are transparently switched on to record the motion of the smartphone, not for recognising and describing a specific action, but only to detect if we are moving or not.
Levels of physical activities or, still better, variations in such levels are strongly correlated to our mental health. When we abruptly change our habits, there may be some issues in our health worthy of further attention.
Our mobility is still better measured by the GPS sensor. All of us exploit GPS data to navigate unknown environments or to manage our route in a new city. GPS is available on the majority of existing smartphones and may be also used, passively, to record our daily movements. Scientific literature associates the data we get from our GPS sensor with several mental health issues, ranging from anxiety to depression to specific pathologies. Just to give an example, variations in the time we spend at home, the shorter or longer duration of visits to different places, or the time we spend travelling are all meaningful indicators of changes in our lifestyle and behaviour, maybe it is only because we are taking few days off, but on the long term, they may also become markers of disease.