Skip to main content
Version: 2.3.0

Magnetic sensor

The cube can use magnetic sensors to detect the type (predefined layout patterns) or magnetic force with the magnet located at the top of a cube. For the hardware specifications of these, see Hardware specifications - Magnetic sensor.

note

This feature is disabled by default. It can only be used after it is enabled under Configuration - Magnetic sensor settings.

Magnetic sensor information can be obtained using the following characteristics. The characteristics are the same for Motion detection and Posture Angle detection.

PropertyValue
Characteristic UUID10B20106-5B3B-4571-9508-CF3EFCD7BBAE
PropertiesWrite, Read, Notify
DescriptorSensor information

Write operations

Requests for magnetic sensor information

Magnetic sensor information can be requested by writing the following data. When the cube receives a request, it sends one notification with the magnetic sensor information.

Data locationTypeContentExample
0UInt8Information type0x82 (Magnetic sensor information request)

Read operations / Notifications

When the cube's magnetic sensor information changes, this property notifies the BLE central of this information. The notified information can also be obtained with a read operation.

note

The characteristics are the same for Motion detection and Posture Angle detection. As this information is also obtained, please also see Motion detection - Read operations / Notifications and Posture Angle detection - Read operations / Notifications when using.

Obtaining magnetic sensor information

Data locationTypeContentExample
0UInt8Information type0x02 (Magnetic sensor information)
1UInt8Magnet state0x00 (Not installed or function disabled)
2UInt8Magnetic force strength0x00 (Not detected or function disabled)
3Int8Magnetic force direction (X axis)0x00 (Not detected or function disabled)
4Int8Magnetic force direction (Y axis)0x00 (Not detected or function disabled)
5Int8Magnetic force direction (Z axis)0x00 (Not detected or function disabled)

Magnet state

This is the ID of the state of the magnet located at the top of the cube (uninstalled or predefined layouts). The ID is 0x00 when no magnets are installed, and when there are magnets installed, the ID ranges between 0x01 and 0x06 for each of the 6 layout patterns. For the specifications of the layout patterns, see Hardware specifications - Magnetic sensor.

The information is not be updated if the sensor detects a state other than these 7 different layout patterns (no magnets installed or one of the 6 layout patterns) defined in Hardware specifications - Magnetic sensor.

Magnetic force detection

When magnet is placed near the cube, the cube detects the magnetic force and makes a response.

Magnetic force strength

The magnetic force strength is the strength of the magnetic force detected by the cube. This magnetic force strength is expressed in values ranging between 0 and 255. The higher the value, the stronger the magnetic force.

Magnetic force direction

The magnetic force direction indicates the direction of the magnetic force lines relative to the cube. The values for each axis range between -10 and 10. When there is no magnetic force detected, the value is 0. The length of the magnetic force direction 3D vector is not proportional to the magnetic force strength. When magnetic force is detected, the length of the vector is almost constant (about 10).

Vector composition

For how the direction of the cube corresponds to the direction of the magnetic force lines, see Hardware specifications - Magnetic sensor.