Table 19. Sensor types (continued)
Sensor type Description
ST Micro LNG2DMTR Motion G-sensorāAccelerometer
ST Micro LPS22HB Pressure sensor
Retrieve the raw data from the sensors by running the following commands. Then, apply the formula in the table to convert the
data collected into measurements such as relative humidity and temperature.
Retrieving raw data from sensors
ā To query sensor devices, run the following command.
$ cat /sys/bus/iio/devices/iio:device*/name
hts221 <-- device0, Humidity and temp.
lng2dm_accel <-- device1, G-sensor
lps22hb <-- device2, Pressure
ā To retrieve data from the humidity and temperature sensor, run the following commands.
$ cat in_humidityrelative_offset
$ cat in_humidityrelative_raw
$ cat in_humidityrelative_scale
$ cat in_temp_offset
$ cat in_temp_raw
$ cat in_temp_scale
ā To retrieve data from the motion G-sensor, run the following commands.
$ cat in_accel_scale_available
$ cat in_accel_*_scale
$ cat in_accel_*_raw
ā To retrieve data from the pressure sensor, run the following commands.
$ cat in_pressure_raw
$ cat in_pressure_scale
Converting raw data for use
Apply the formula in the table to convert the raw data collected into usable measurements.
Table 20. Convert relative humidity and temperature sensor raw data
Relative humidity and temperature sensor ST Micro HTS221
RH (in %) = (in_humidityrelative_raw + in_humidityrelative_offset) * in_humidityrelative_scale
Temperature (degC) = (in_temp_raw + in_temp_offset) * in_temp_scale
Table 21. Convert motion sensor raw data
Motion sensorāAccelerometer ST Micro LNG2DMTR
accel_{x/y/z} (m/s^2) = in_accel_{x/y/z}_raw * in_accel_{x/y/z}_scale
Table 22. Convert pressure sensor raw data
Pressure sensor ST Micro LPS22HB
Pressure (hPa) = in_pressure_raw * in_pressure_scale * 10
Setting up the operating system 71