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
MLX90393
class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C import micropython_mlx90393.mlx90393 as mlx90393
Once this is done you can define your
machine.I2C
object and define your sensor objecti2c = I2C(sda=Pin(8), scl=Pin(9)) mlx = mlx90393.MLX90393(i2c)
Now you have access to the
magnetic
attributemagx, magy, magz = mlx.magnetic
- property digital_filter¶
Digital filter applicable to ADC
Mode
Value
mlx90393.FILTER_0
0x0
mlx90393.FILTER_1
0x1
mlx90393.FILTER_2
0x2
mlx90393.FILTER_3
0x3
mlx90393.FILTER_4
0x4
mlx90393.FILTER_5
0x5
mlx90393.FILTER_6
0x6
mlx90393.FILTER_7
0x7
- 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_z
parameter.
- 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
oversampling
anddigital_filter
Mode
Value
mlx90393.OSR_0
0x0
mlx90393.OSR_1
0x1
mlx90393.OSR_2
0x2
mlx90393.OSR_3
0x3
- property resolution_x¶
X Axis Resolution
Mode
Value
mlx90393.RESOLUTION_3
0x3
mlx90393.RESOLUTION_2
0x2
mlx90393.RESOLUTION_1
0x1
mlx90393.RESOLUTION_0
0x0
- property resolution_y¶
Y Axis Resolution
Mode
Value
mlx90393.RESOLUTION_3
0x3
mlx90393.RESOLUTION_2
0x2
mlx90393.RESOLUTION_1
0x1
mlx90393.RESOLUTION_0
0x0
- property resolution_z¶
Z Axis Resolution
Mode
Value
mlx90393.RESOLUTION_3
0x3
mlx90393.RESOLUTION_2
0x2
mlx90393.RESOLUTION_1
0x1
mlx90393.RESOLUTION_0
0x0