TS-7250-V3 Magnetometer: Difference between revisions
From embeddedTS Manuals
(Created page with "This board includes an ST IIS2MDCTR 3 axis magnetometer. The magnetometer is accessed through Linux's industrial IIO framework as lis2mdl_magn with channels: * magn_x * magn_...") |
No edit summary |
||
Line 25: | Line 25: | ||
* Y: -0.2475 mG | * Y: -0.2475 mG | ||
* Z: 0.0135 mG | * Z: 0.0135 mG | ||
Revision as of 14:51, 14 October 2021
This board includes an ST IIS2MDCTR 3 axis magnetometer.
The magnetometer is accessed through Linux's industrial IIO framework as lis2mdl_magn with channels:
- magn_x
- magn_y
- magn_z
- timestamp
For example:
root@tsimx6ul:~# iio_attr -c lis2mdl_magn -c magn_x dev 'lis2mdl_magn', channel 'magn_x' (input), attr 'raw', value '630' dev 'lis2mdl_magn', channel 'magn_x' (input), attr 'scale', value '0.001500' root@tsimx6ul:~# iio_attr -c lis2mdl_magn -c magn_y dev 'lis2mdl_magn', channel 'magn_y' (input), attr 'raw', value '-165' dev 'lis2mdl_magn', channel 'magn_y' (input), attr 'scale', value '0.001500' root@tsimx6ul:~# iio_attr -c lis2mdl_magn -c magn_z dev 'lis2mdl_magn', channel 'magn_z' (input), attr 'raw', value '9' dev 'lis2mdl_magn', channel 'magn_z' (input), attr 'scale', value '0.001500'
This shows a snapshot of the x, y, z values. To get the real world value, multiply the scale * the raw value. In this case:
- X: 0.945 mG (milligauss)
- Y: -0.2475 mG
- Z: 0.0135 mG