MicroPython BMM150 Library¶
bmm150
¶
MicroPython Driver for the Bosch BMM150 Magnetometer
Author(s): Jose D. Montoya
- class micropython_bmm150.bmm150.AlertStatus(high_x, high_y, high_z, low_x, low_y, low_z)¶
Create new instance of AlertStatus(high_x, high_y, high_z, low_x, low_y, low_z)
- high_x¶
Alias for field number 0
- high_y¶
Alias for field number 1
- high_z¶
Alias for field number 2
- low_x¶
Alias for field number 3
- low_y¶
Alias for field number 4
- low_z¶
Alias for field number 5
-
class micropython_bmm150.bmm150.BMM150(i2c, address: int =
0x13
)[source]¶ Driver for the BMM150 Sensor connected over I2C.
- Parameters:¶
- Raises:¶
RuntimeError – if the sensor is not found
Quickstart: Importing and using the device
Here is an example of using the
BMM150
class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_bmm150 import bmm150
Once this is done you can define your
machine.I2C
object and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) bmm150 = bmm150.BMM150(i2c)
Now you have access to the attributes
magx, magy, magz, hall = bmm150.measurements
- property data_rate : str¶
Sensor data_rate
Mode
Value
bmm150.RATE_10HZ
0b000
bmm150.RATE_2HZ
0b001
bmm150.RATE_6HZ
0b010
bmm150.RATE_8HZ
0b011
bmm150.RATE_15HZ
0b100
bmm150.RATE_20HZ
0b101
bmm150.RATE_25HZ
0b110
bmm150.RATE_30HZ
0b111
- property interrupt_mode : str¶
Sensor interrupt_mode
Mode
Value
bmm150.INT_DISABLED
0x00
bmm150.INT_ENABLED
0xFF
- property measurements : tuple[float, float, float, float]¶
Return Magnetometer data and hall resistance. This is Raw data. There are some code exposed from bosch in their github to adjust this data, however this is not exposed in the datasheet.
- property operation_mode : str¶
Sensor operation_mode
Mode
Value
bmm150.NORMAL
0b00
bmm150.FORCED
0b01
bmm150.SLEEP
0b11
- property status_interrupt¶
Interrupt Status.