Skip to content

Magnetometer in API 6

The magnetometer (eCompass) is a Hall-effect sensor that measures the direction of magnetic force within a magnetic field of the Earth (or any other magnetic field) and in doing so, works like a compass.

Overview

Magnetometer functionality:

  1. There is one magnetometer-based User mode: Door mode.

  2. Data from the magnetometer can be sent as appended payload.

    More about appended payload HERE!

    Attention

    Please note that we implemented this function for testing purposes only and we do NOT recommend using this at all as the data you get from the magnetometer has little to no informative value.

User modes

Door mode

Very simple mode that sends alerts when the magnetometer picks up orientation change (the door opening). The magnetometer can be a working alternative to accelerometer-based modes as the accelerometer can struggle with picking up smooth movement with minimal acceleration.

Info

A more reliable but also a bit more complicated setup for monitoring doors would be reed-switch-based solutions that require a magnet.

Relevant registers

Register hex Register name Value range What it is and what it does Useful for
0x19 Magnetometer sensitivity (mask) 0-255 General sensitivity for all three axis X, Y, Z. Door mode
0x1A Mag. X axis sensitivity 0-255 Same as above, but changes the sensitivity of only one axis. Door mode
0x1B Mag. Y axis sensitivity 0-255 Same as above, but changes the sensitivity of only one axis. Door mode
0x1C Mag. Z axis sensitivity 0-255 Same as above, but changes the sensitivity of only one axis. Door mode
0x3D Magnetometer measurement interval SimpleTime How often the sensor wakes up. Door mode
0x4A Magnetometer detection delay SimpleTime How long the orientation change has to last before an event is sent. Door mode