TS-7250-V3 Magnetometer: Difference between revisions

From embeddedTS Manuals
No edit summary
(Tweak to commonize with TS-7180, TS-7100, et al.)
 
Line 1: Line 1:
This board includes an ST IIS2MDCTR 3 axis magnetometer.
The magnetometer is accessed through Linux's [https://wiki.analog.com/software/linux/docs/iio/iio industrial I/O (IIO) subsystem] as <code>lis2mdl_magn</code> with channels:
 
The magnetometer is accessed through Linux's industrial IIO framework as lis2mdl_magn with channels:
* magn_x
* magn_x
* magn_y
* magn_y
Line 21: Line 19:
</console>
</console>


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:
This shows a snapshot of the x, y, z values.  To get the measured field strength along each axis, multiply the scale by the raw value to get the actual reading in milligauss.  In the above example:
* X:  0.945 mG (milligauss)
* X:  0.945 mG (milligauss)
* Y: -0.2475 mG
* Y: -0.2475 mG
* Z:  0.0135 mG
* Z:  0.0135 mG

Latest revision as of 13:08, 18 July 2023

The magnetometer is accessed through Linux's industrial I/O (IIO) subsystem 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 measured field strength along each axis, multiply the scale by the raw value to get the actual reading in milligauss. In the above example:

  • X: 0.945 mG (milligauss)
  • Y: -0.2475 mG
  • Z: 0.0135 mG