ADXL90393 MicroPython Library¶
mlx90393¶
MicroPython Driver for the MLX90393 magnetometer sensor
Author(s): Jose D. Montoya
Implementation Notes¶
Software and Dependencies:
This library depends on Micropython
-
class micropython_mlx90393.mlx90393.CBits(num_bits: int, register_address: int, start_bit: int, register_width=
2, lsb_first=True, cmd_read=None, cmd_write=None)[source]¶ Changes bits from a byte register
-
class micropython_mlx90393.mlx90393.MLX90393(i2c, address=
0x0C)[source]¶ Main class for the Sensor
- Parameters:¶
- Raises:¶
RuntimeError – if the sensor is not found
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 sensorfrom machine import Pin, I2C import micropython_mlx90393.mlx90393 as mlx90393Once this is done you can define your
machine.I2Cobject and define your sensor objecti2c = I2C(sda=Pin(8), scl=Pin(9)) mlx = mlx90393.MLX90393(i2c)Now you have access to the
magneticattributemagx, magy, magz = mlx.magnetic- property digital_filter¶
Digital filter applicable to ADC
Mode
Value
mlx90393.FILTER_00x0mlx90393.FILTER_10x1mlx90393.FILTER_20x2mlx90393.FILTER_30x3mlx90393.FILTER_40x4mlx90393.FILTER_50x5mlx90393.FILTER_60x6mlx90393.FILTER_70x7
- property gain¶
The gain setting for the device. Sets the analog gain to the desired value. The sensitivity is dependent on the axis (the X- and Y-axis have higher sensitivity, compared with the Z-axis, expressed in LSB/µT) as well as the setting of the
resolution_x,resolution_y,resolution_zparameter.
- property magnetic¶
The processed magnetometer sensor values. A 3-tuple of X, Y, Z axis values in microteslas that are signed floats.
- property oversampling¶
Temperature sensor ADC oversampling ratio
Note
The MLX90393 provides configurable filters to adjust the tradeoff between current consumption, noise, and conversion time. See section 15.1.5 for details on selecting the conversion time by adjusting
oversamplinganddigital_filterMode
Value
mlx90393.OSR_00x0mlx90393.OSR_10x1mlx90393.OSR_20x2mlx90393.OSR_30x3
- property resolution_x¶
X Axis Resolution
Mode
Value
mlx90393.RESOLUTION_30x3mlx90393.RESOLUTION_20x2mlx90393.RESOLUTION_10x1mlx90393.RESOLUTION_00x0
- property resolution_y¶
Y Axis Resolution
Mode
Value
mlx90393.RESOLUTION_30x3mlx90393.RESOLUTION_20x2mlx90393.RESOLUTION_10x1mlx90393.RESOLUTION_00x0
- property resolution_z¶
Z Axis Resolution
Mode
Value
mlx90393.RESOLUTION_30x3mlx90393.RESOLUTION_20x2mlx90393.RESOLUTION_10x1mlx90393.RESOLUTION_00x0