adafruit_mlx90393
¶
This is a breakout for the Adafruit MLX90393 magnetometer sensor breakout.
Author(s): ktown
Implementation Notes¶
Hardware:
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: I2C, address: int = 12, gain: int = 7, resolution: int = 0, filt: int = 7, oversampling: int = 3, debug: bool = False)¶
Driver for the MLX90393 magnetometer.
- Parameters
i2c_bus – The I2C bus the device is connected to
address (int) – The I2C device address. Defaults to
0x0C
gain (int) – The gain level to apply. Defaults to
GAIN_1X
resolution (int) – The resolution level to use. Defaults to
RESOLUTION_16
filt (int) – The filter to use. Defaults to
FILTER_7
oversampling (int) – The oversampleing setting to use. Defaults to
OSR_3
Quickstart: Importing and using the device
Here is an example of using the
MLX90393
class. First you will need to import the libraries to use the sensorimport board import adafruit_mlx90393
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA SENSOR = adafruit_mlx90393.MLX90393(i2c)
Now you have access to the
magnetic
attributeMX, 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.