adafruit_mmc56x3

Python MMC5603 / MMC5613 magnetometer sensor library

  • Author(s): ladyada

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_mmc56x3.MMC5603(i2c_bus: I2C, address: int = 48)

Driver for the MMC5603 3-axis magnetometer.

Quickstart: Importing and using the device

Here is an example of using the MMC5603 class. First you will need to import the libraries to use the sensor

import board
import adafruit_mmc56x3

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()
sensor = adafruit_mmc56x3.MMC5603(i2c)

Now you have access to the magnetic attribute

mag_x, mag_y, mag_z = sensor.magnetic
Parameters:
  • i2c_bus (I2C) – The I2C bus the MMC5603 is connected to.

  • address (int) – The I2C device address. Defaults to 0x30

property continuous_mode: bool

Whether or not to put the chip in continous mode - be sure to set the data_rate as well!

property data_rate: int

Output data rate, 0 for on-request data. 1-255 or 1000 for freq of continuous-mode readings

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.

reset() None

Reset the sensor to the default state set by the library

set_reset() None

Pulse large currents through the sense coils to clear any offset

property temperature: float

The processed temperature sensor value, returned in floating point C