This is a breakout for the Adafruit MLX90393 magnetometer sensor breakout.
Adafruit MLX90393 Magnetometer Sensor Breakout Board (Product ID: 4022)
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
- class adafruit_mlx90393.MLX90393(i2c_bus: busio.I2C, address: int = 12, gain: int = 7, resolution: int = 0, filt: int = 7, oversampling: int = 3, debug: bool = False)¶
Driver for the MLX90393 magnetometer.
i2c_bus – The I2C bus the device is connected to
address (int) – The I2C device address. Defaults to
gain (int) – The gain level to apply. Defaults to
resolution (int) – The resolution level to use. Defaults to
filt (int) – The filter to use. Defaults to
oversampling (int) – The oversampleing setting to use. Defaults to
Quickstart: Importing and using the device
Here is an example of using the
MLX90393class. First you will need to import the libraries to use the sensor
import board import adafruit_mlx90393
Once this is done you can define your
board.I2Cobject and define your sensor object
i2c = board.I2C() # uses board.SCL and board.SDA SENSOR = adafruit_mlx90393.MLX90393(i2c)
Now you have access to the
MX, MY, MZ = SENSOR.magnetic
- property magnetic: Tuple[float, float, float]¶
The processed magnetometer sensor values. A 3-tuple of X, Y, Z axis values in microteslas that are signed floats.
- read_reg(reg: int) int ¶
Gets the current value of the specified register.
reg (int) – The register to read