Introduction to the Magnetometer¶
A magnetometer is a device that measures magnetic field or magnetic dipole moment. We use a Hall effect magnetometer to measure the direction of the magnetic field. When the sensor tilts, this direction changes and that's how we determine orientation change.
How it works¶
Hall effect sensors consist of a thin piece of semiconductor material where constant current is passing through the material. In the presence of a magnetic field, magnetic flux lines exert a force on the material, which deflects charge carriers to either side of the slab. The change in movement of charge carriers within the semiconductor slab then creates a measurable voltage difference in the output of the sensor. The voltage output is proportional to the magnetic force in the direction of the sensor sensitivity.
The sensor has three axis X, Y, Z and is calibrated to be influenced by the Earth's magnetic field. The magnetometer is basically a compass.
Magnetometer axis orientation¶
The magnetometer has its axis defined from factory, ergo the way the sensor is assembled has an effect on the orientation of the sensors. This is the orientation in our devices:
Magnetometer use cases¶
The major use is simple orientation change. The magnetometer is used where the accelerometer struggles with picking up movement, the most notable example is smooth movement of large office doors.
Magnetometer in the API 6¶
The magnetometer offers substantially less possibilities than the accelerometer in our devices. You can get simple orientation change alerts when the device changes position.
The sensitivity of the sensor is by default the same in all three axis, but can be customized so you can have e.g. Z axis more sensitive than the other two.