API Reference
adafruit_tmag5273
CircuitPython driver for the Adafruit TMAG5273 (A1 and A2) 3D Hall Effect Magnetometer Breakout
Author(s): Liz Clark
Implementation Notes
Hardware:
Adafruit TMAG5273 (A1) 3D Hall Effect Magnetometer Breakout - ±40mT, ±80mT
Adafruit TMAG5273 (A2) 3D Hall Effect Magnetometer Breakout - ±133mT / 266mT
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
- adafruit_tmag5273.ANGLE_OFF = 0
No angle calculation.
- adafruit_tmag5273.ANGLE_XY = 1
Angle from X (1st) and Y (2nd) axes.
- adafruit_tmag5273.ANGLE_XZ = 3
Angle from X (1st) and Z (2nd) axes.
- adafruit_tmag5273.ANGLE_YZ = 2
Angle from Y (1st) and Z (2nd) axes.
- adafruit_tmag5273.CONV_AVG_16X = 4
16x conversion averaging.
- adafruit_tmag5273.CONV_AVG_1X = 0
1x conversion averaging.
- adafruit_tmag5273.CONV_AVG_2X = 1
2x conversion averaging.
- adafruit_tmag5273.CONV_AVG_32X = 5
32x conversion averaging.
- adafruit_tmag5273.CONV_AVG_4X = 2
4x conversion averaging.
- adafruit_tmag5273.CONV_AVG_8X = 3
8x conversion averaging.
- adafruit_tmag5273.INT_EXCEPT_I2C = 2
Interrupt through INT except during I2C.
- adafruit_tmag5273.INT_NONE = 0
No interrupt.
- adafruit_tmag5273.INT_SCL_EXCEPT_I2C = 4
Interrupt through SCL except during I2C.
- adafruit_tmag5273.INT_THROUGH_INT = 1
Interrupt through INT pin.
- adafruit_tmag5273.INT_THROUGH_SCL = 3
Interrupt through SCL pin.
- adafruit_tmag5273.MAG_CH_OFF = 0
All magnetic channels off.
- adafruit_tmag5273.MAG_CH_X = 1
X channel only.
- adafruit_tmag5273.MAG_CH_XY = 3
X and Y channels.
- adafruit_tmag5273.MAG_CH_XYX = 8
X, Y, X pseudo-simultaneous.
- adafruit_tmag5273.MAG_CH_XYZ = 7
X, Y, and Z channels.
- adafruit_tmag5273.MAG_CH_XZX = 11
X, Z, X pseudo-simultaneous.
- adafruit_tmag5273.MAG_CH_Y = 2
Y channel only.
- adafruit_tmag5273.MAG_CH_YXY = 9
Y, X, Y pseudo-simultaneous.
- adafruit_tmag5273.MAG_CH_YZ = 6
Y and Z channels.
- adafruit_tmag5273.MAG_CH_YZY = 10
Y, Z, Y pseudo-simultaneous.
- adafruit_tmag5273.MAG_CH_Z = 4
Z channel only.
- adafruit_tmag5273.MAG_CH_ZX = 5
Z and X channels.
- adafruit_tmag5273.MODE_CONTINUOUS = 2
Continuous measurement mode.
- adafruit_tmag5273.MODE_SLEEP = 1
Sleep mode (ultra-low power).
- adafruit_tmag5273.MODE_STANDBY = 0
Standby (trigger) mode.
- adafruit_tmag5273.MODE_WAKEUP_SLEEP = 3
Wake-up and sleep mode.
- adafruit_tmag5273.SLEEP_1000MS = 9
1000ms sleep time.
- adafruit_tmag5273.SLEEP_100MS = 7
100ms sleep time.
- adafruit_tmag5273.SLEEP_10MS = 2
10ms sleep time.
- adafruit_tmag5273.SLEEP_15MS = 3
15ms sleep time.
- adafruit_tmag5273.SLEEP_1MS = 0
1ms sleep time.
- adafruit_tmag5273.SLEEP_20000MS = 12
20000ms sleep time.
- adafruit_tmag5273.SLEEP_2000MS = 10
2000ms sleep time.
- adafruit_tmag5273.SLEEP_20MS = 4
20ms sleep time.
- adafruit_tmag5273.SLEEP_30MS = 5
30ms sleep time.
- adafruit_tmag5273.SLEEP_5000MS = 11
5000ms sleep time.
- adafruit_tmag5273.SLEEP_500MS = 8
500ms sleep time.
- adafruit_tmag5273.SLEEP_50MS = 6
50ms sleep time.
- adafruit_tmag5273.SLEEP_5MS = 1
5ms sleep time.
- adafruit_tmag5273.TEMPCO_CERAMIC = 3
0.2%/°C compensation for ceramic/ferrite magnets.
- adafruit_tmag5273.TEMPCO_NDFEB = 1
0.12%/°C compensation for NdFeB magnets.
- adafruit_tmag5273.TEMPCO_NONE = 0
No temperature compensation (0%).
- class adafruit_tmag5273.TMAG5273(i2c_bus: busio.I2C, address: int = _DEFAULT_I2CADDR)
Driver for the TI TMAG5273 3-axis Hall-effect magnetic sensor.
- Parameters:
- property angle: float
The calculated angle in degrees (0-360) based on the configured axis pair (see
angle_calculation).
- angle_calculation = 2
The angle calculation axis pair. Use one of the
ANGLE_*constants.
- conversion_average = 3
The conversion averaging setting. Use one of the
CONV_AVG_*constants.
- conversion_status = 24
The conversion status register byte.
- crc_enabled = 0
Whether CRC is enabled for I2C communication.
- device_id = 13
The 8-bit device ID register value.
- device_status = 28
The device status register byte.
- gain_value = 9
The gain correction value (0-255, where 0 means 1.0 gain).
- interrupt_mode = 3
The interrupt mode. Use one of the
INT_*constants.
- interrupt_pulsed = 8
Whether the interrupt pin uses pulsed mode (10us pulse). When
False, latched mode is used.
- low_noise = 1
Whether low-noise mode is enabled. When
False, low-power mode is used.
- mag_tempco = 2
The magnet temperature compensation setting. Use one of the
TEMPCO_*constants.
- property magnetic: Tuple[float, float, float]
The magnetic field readings for X, Y, and Z axes in microTesla, as a 3-tuple
(x, y, z).
- magnetic_channels = 4
The magnetic channel configuration. Use one of the
MAG_CH_*constants.
- property magnitude_mt: float
The calculated magnitude in milliTesla for the configured angle axis pair.
- offset1 = 10
The first axis offset correction as a signed 8-bit value.
- offset2 = 11
The second axis offset correction as a signed 8-bit value.
- operating_mode = 2
The operating mode. Use one of the
MODE_*constants.
- result_interrupt = 8
Whether the conversion-complete result interrupt is enabled.
- sleep_time = 4
The sleep time for wake-up and sleep mode. Use one of the
SLEEP_*constants.
- temperature_enabled = 7
Whether the temperature measurement channel is enabled.
- temperature_threshold = 7
The temperature threshold (7-bit, 8°C per LSB).
- threshold_interrupt = 8
Whether the threshold interrupt is enabled.
- trigger_conversion() None
Trigger a single conversion when in standby mode.
Briefly switches to continuous mode to initiate a conversion, then returns to standby.
- x_threshold = 4
The X-axis threshold as a signed 8-bit value.
- property xy_range_wide: bool
Whether XY axes use wide range (80mT for x1 / 266mT for x2). When
False, narrow range is used (40mT for x1 / 133mT for x2).
- y_threshold = 5
The Y-axis threshold as a signed 8-bit value.
- property z_range_wide: bool
Whether Z axis uses wide range (80mT for x1 / 266mT for x2). When
False, narrow range is used (40mT for x1 / 133mT for x2).
- z_threshold = 6
The Z-axis threshold as a signed 8-bit value.